Browse Source

[MIG][9.0] contract_recurring_plans module

pull/106/head
cubells 8 years ago
committed by Pedro M. Baeza
parent
commit
25057c0b40
  1. 60
      contract_recurring_analytic_distribution/README.rst
  2. 5
      contract_recurring_analytic_distribution/__init__.py
  3. 22
      contract_recurring_analytic_distribution/__openerp__.py
  4. 28
      contract_recurring_analytic_distribution/i18n/ca.po
  5. 29
      contract_recurring_analytic_distribution/i18n/de.po
  6. 28
      contract_recurring_analytic_distribution/i18n/el_GR.po
  7. 28
      contract_recurring_analytic_distribution/i18n/es.po
  8. 28
      contract_recurring_analytic_distribution/i18n/es_MX.po
  9. 29
      contract_recurring_analytic_distribution/i18n/fi.po
  10. 29
      contract_recurring_analytic_distribution/i18n/fr.po
  11. 29
      contract_recurring_analytic_distribution/i18n/pt_BR.po
  12. 28
      contract_recurring_analytic_distribution/i18n/sk_SK.po
  13. 29
      contract_recurring_analytic_distribution/i18n/sl.po
  14. 5
      contract_recurring_analytic_distribution/models/__init__.py
  15. 30
      contract_recurring_analytic_distribution/models/account_analytic_invoice_line.py
  16. BIN
      contract_recurring_analytic_distribution/static/description/icon.png
  17. 463
      contract_recurring_analytic_distribution/static/description/icon.svg
  18. 5
      contract_recurring_analytic_distribution/tests/__init__.py
  19. 69
      contract_recurring_analytic_distribution/tests/test_contract_recurring_distribution.py
  20. 15
      contract_recurring_analytic_distribution/views/account_analytic_invoice_line_view.xml

60
contract_recurring_analytic_distribution/README.rst

@ -0,0 +1,60 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
==============================================
Analytic plans for contract recurring invoices
==============================================
This module allows to include an analytic distribution on each recurring
invoice line, so if you set it, this will be taken to be transferred to the
invoice instead of the analytic account of the contract.
Usage
=====
On the contract view, select or create an analytic distribution for the
invoice recurring lines that you want.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/110/9.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/issues>`_.
In case of trouble, please check there if your issue has already been
reported. If you spotted it first, help us smash it by providing detailed and
welcomed feedback.
Credits
=======
Contributors
------------
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
Icon
----
* https://openclipart.org/detail/125071/pie-graph
* Subicon made by `Freepik <http://www.flaticon.com/authors/freepik>_ from
www.flaticon.com
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

5
contract_recurring_analytic_distribution/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Tecnativa - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models

22
contract_recurring_analytic_distribution/__openerp__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Tecnativa - Pedro M. Baeza
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Analytic plans on contracts recurring invoices',
'version': '9.0.1.0.0',
'category': 'Contract Management',
'author': 'Tecnativa, '
'Odoo Community Association (OCA)',
'website': 'http://www.tecnativa.com',
'license': 'AGPL-3',
'depends': [
'account_analytic_distribution',
'contract',
],
'data': [
'views/account_analytic_invoice_line_view.xml',
],
'installable': True,
}

28
contract_recurring_analytic_distribution/i18n/ca.po

@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-20 18:39+0000\n"
"PO-Revision-Date: 2015-11-29 23:23+0000\n"
"Last-Translator: <>\n"
"Language-Team: Catalan (http://www.transifex.com/oca/OCA-contract-8-0/language/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ca\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Compte analític"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr ""

29
contract_recurring_analytic_distribution/i18n/de.po

@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2016
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-08 08:38+0000\n"
"PO-Revision-Date: 2016-01-14 14:23+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-contract-8-0/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Kostenstelle"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr "Kostenumlage"

28
contract_recurring_analytic_distribution/i18n/el_GR.po

@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-07 03:42+0000\n"
"PO-Revision-Date: 2015-11-29 23:23+0000\n"
"Last-Translator: <>\n"
"Language-Team: Greek (Greece) (http://www.transifex.com/oca/OCA-contract-8-0/language/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Αναλυτικός Λογαριασμός"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr ""

28
contract_recurring_analytic_distribution/i18n/es.po

@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-30 01:38+0000\n"
"PO-Revision-Date: 2015-11-29 23:23+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-contract-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Cuenta analítica"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr "Distribución analítica"

28
contract_recurring_analytic_distribution/i18n/es_MX.po

@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-03 01:11+0000\n"
"PO-Revision-Date: 2015-11-29 23:23+0000\n"
"Last-Translator: <>\n"
"Language-Team: Spanish (Mexico) (http://www.transifex.com/oca/OCA-contract-8-0/language/es_MX/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es_MX\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Cuenta analítica"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr ""

29
contract_recurring_analytic_distribution/i18n/fi.po

@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
# Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-05-28 11:00+0000\n"
"PO-Revision-Date: 2016-07-08 10:45+0000\n"
"Last-Translator: Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>\n"
"Language-Team: Finnish (http://www.transifex.com/oca/OCA-contract-8-0/language/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Analyyttinen tili"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr "Analyyttinen jakelu"

29
contract_recurring_analytic_distribution/i18n/fr.po

@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
# Christophe CHAUVET <christophe.chauvet@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-30 10:34+0000\n"
"PO-Revision-Date: 2016-05-19 16:11+0000\n"
"Last-Translator: Christophe CHAUVET <christophe.chauvet@gmail.com>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-contract-8-0/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Compte analytique"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr "Distribution analytique"

29
contract_recurring_analytic_distribution/i18n/pt_BR.po

@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
# danimaribeiro <danimaribeiro@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-08 01:39+0000\n"
"PO-Revision-Date: 2016-03-05 18:19+0000\n"
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-contract-8-0/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Conta analítica"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr "Distribuição analítica"

28
contract_recurring_analytic_distribution/i18n/sk_SK.po

@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-05-21 10:53+0000\n"
"PO-Revision-Date: 2015-11-29 23:23+0000\n"
"Last-Translator: <>\n"
"Language-Team: Slovak (Slovakia) (http://www.transifex.com/oca/OCA-contract-8-0/language/sk_SK/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sk_SK\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Analytický účet"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr ""

29
contract_recurring_analytic_distribution/i18n/sl.po

@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_recurring_analytic_distribution
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-30 04:18+0000\n"
"PO-Revision-Date: 2015-11-30 07:24+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-contract-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: contract_recurring_analytic_distribution
#: model:ir.model,name:contract_recurring_analytic_distribution.model_account_analytic_account
msgid "Analytic Account"
msgstr "Analitični konto"
#. module: contract_recurring_analytic_distribution
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr "Analitična distribucija"

5
contract_recurring_analytic_distribution/models/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Tecnativa - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import account_analytic_invoice_line

30
contract_recurring_analytic_distribution/models/account_analytic_invoice_line.py

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Tecnativa - Pedro M. Baeza
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
class AccountAnalyticAccount(models.Model):
_inherit = "account.analytic.account"
@api.model
def _prepare_invoice_line(self, line, invoice_id):
res = super(AccountAnalyticAccount, self)._prepare_invoice_line(
line, invoice_id)
if line.analytic_distribution_id:
res.update({
'account_analytic_id': False,
'analytic_distribution_id': line.analytic_distribution_id.id,
})
return res
class AccountAnalyticInvoiceLine(models.Model):
_inherit = "account.analytic.invoice.line"
analytic_distribution_id = fields.Many2one(
comodel_name='account.analytic.distribution',
string='Analytic Distribution', oldname='analytics_id',
)

BIN
contract_recurring_analytic_distribution/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 6.1 KiB

463
contract_recurring_analytic_distribution/static/description/icon.svg

@ -0,0 +1,463 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg2"
sodipodi:docname="icon.svg"
viewBox="0 0 128 128"
version="1.1"
inkscape:version="0.91 r"
width="128"
height="128"
inkscape:export-filename="icon.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4">
<linearGradient
id="linearGradient4306">
<stop
id="stop4308"
style="stop-color:#dedc37"
offset="0" />
<stop
id="stop4310"
style="stop-color:#f8fa8d"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3727">
<stop
id="stop3729"
style="stop-color:#f3f360"
offset="0" />
<stop
id="stop3731"
style="stop-color:#cbc630"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3717">
<stop
id="stop3719"
style="stop-color:#e4e240"
offset="0" />
<stop
id="stop3725"
style="stop-color:#d4d237"
offset=".47047" />
<stop
id="stop3721"
style="stop-color:#f8f44e"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3590">
<stop
id="stop3592"
style="stop-color:#b8b852"
offset="0" />
<stop
id="stop3594"
style="stop-color:#dbd649"
offset="1" />
</linearGradient>
<filter
inkscape:menu-tooltip="In and out glow with a possible offset and colorizable flood"
inkscape:menu="Shadows and Glows"
inkscape:label="Cutout Glow"
style="color-interpolation-filters:sRGB;"
id="filter3869">
<feOffset
dy="3"
dx="3"
id="feOffset3871" />
<feGaussianBlur
stdDeviation="3"
result="blur"
id="feGaussianBlur3873" />
<feFlood
flood-color="rgb(0,0,0)"
flood-opacity="1"
result="flood"
id="feFlood3875" />
<feComposite
in="flood"
in2="SourceGraphic"
operator="in"
result="composite"
id="feComposite3877" />
<feBlend
in="blur"
in2="composite"
mode="normal"
id="feBlend3879" />
</filter>
<linearGradient
inkscape:collect="always"
x1="634.97"
y1="631.64"
x2="389.52"
gradientUnits="userSpaceOnUse"
y2="484.49"
id="linearGradient3838">
<stop
offset="0"
style="stop-color:#008000"
id="stop3834" />
<stop
offset="1"
style="stop-color:#4dc149"
id="stop3836" />
</linearGradient>
<filter
color-interpolation-filters="sRGB"
inkscape:collect="always"
id="filter3848">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.82001295"
id="feGaussianBlur3850" />
</filter>
<filter
color-interpolation-filters="sRGB"
inkscape:collect="always"
id="filter3852">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="1.4036521"
id="feGaussianBlur3854" />
</filter>
<radialGradient
inkscape:collect="always"
r="92.316"
gradientTransform="matrix(0.5983,1.4589,-1.4017,0.57484,1052,-556.35)"
cx="539.69"
cy="573.48"
gradientUnits="userSpaceOnUse"
id="radialGradient3872">
<stop
offset="0"
style="stop-color:#64b668"
id="stop3866" />
<stop
offset="1"
style="stop-color:#008900"
id="stop3868" />
</radialGradient>
<linearGradient
inkscape:collect="always"
x1="437.5"
y1="567.07"
gradientTransform="matrix(1.01,0,0,1.01,-4.45,-5.9654)"
x2="441.79"
gradientUnits="userSpaceOnUse"
y2="623.33"
id="linearGradient3880">
<stop
offset="0"
style="stop-color:#008000"
id="stop3876" />
<stop
offset="1"
style="stop-color:#005900"
id="stop3878" />
</linearGradient>
<filter
color-interpolation-filters="sRGB"
inkscape:collect="always"
id="filter3882">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.6119445"
id="feGaussianBlur3884" />
</filter>
<filter
color-interpolation-filters="sRGB"
inkscape:collect="always"
id="filter3886">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.2080926"
id="feGaussianBlur3888" />
</filter>
<linearGradient
inkscape:collect="always"
x1="503.69"
y1="665.51"
x2="382.36"
gradientUnits="userSpaceOnUse"
y2="536.71"
id="linearGradient3896">
<stop
offset="0"
style="stop-color:#ff0000"
id="stop3892" />
<stop
offset="1"
style="stop-color:#ff3537"
id="stop3894" />
</linearGradient>
<filter
color-interpolation-filters="sRGB"
inkscape:collect="always"
id="filter3898">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.68751219"
id="feGaussianBlur3900" />
</filter>
<linearGradient
inkscape:collect="always"
x1="319.87"
y1="631.94"
x2="459.97"
gradientUnits="userSpaceOnUse"
y2="748.04"
id="linearGradient3908">
<stop
offset="0"
style="stop-color:#ff0000"
id="stop3904" />
<stop
offset="1"
style="stop-color:#a20000"
id="stop3906" />
</linearGradient>
<filter
color-interpolation-filters="sRGB"
inkscape:collect="always"
id="filter3910">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.70507812"
id="feGaussianBlur3912" />
</filter>
</defs>
<sodipodi:namedview
id="base"
bordercolor="#666666"
inkscape:pageshadow="2"
inkscape:window-y="24"
pagecolor="#ffffff"
inkscape:window-height="1056"
inkscape:window-maximized="1"
inkscape:zoom="7.0646457"
inkscape:window-x="65"
showgrid="false"
borderopacity="1.0"
inkscape:current-layer="layer1"
inkscape:cx="66.991441"
inkscape:cy="62.957804"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1855"
inkscape:pageopacity="0.0"
inkscape:document-units="px" />
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(-319.71,-475.23)">
<g
id="g3620"
transform="matrix(2.2116072,0,0,2.2116072,-246.9006,-632.55508)">
<path
style="fill:#ffffff"
sodipodi:nodetypes="sssssssss"
inkscape:connector-curvature="0"
d="m 298.70134,500.89595 -38.10593,0 c -2.4922,0 -4.39684,1.9053 -4.39684,4.39684 l 0,38.10527 c 0,2.4922 1.90464,4.39749 4.39684,4.39749 l 38.10593,0 c 2.49154,0 4.39683,-1.90529 4.39683,-4.39749 l 0,-38.10527 c 0,-2.49154 -1.90529,-4.39684 -4.39683,-4.39684 z"
id="path3618" />
<path
id="path3497"
d="m 298.70134,500.89595 -38.10593,0 c -2.4922,0 -4.39684,1.9053 -4.39684,4.39684 l 0,38.10527 c 0,2.4922 1.90464,4.39749 4.39684,4.39749 l 38.10593,0 c 2.49154,0 4.39683,-1.90529 4.39683,-4.39749 l 0,-38.10527 c 0,-2.49154 -1.90529,-4.39684 -4.39683,-4.39684 z m 1.4643,42.50211 c 0,0.88068 -0.58624,1.46561 -1.4643,1.46561 l -38.10593,0 c -0.87937,0 -1.46561,-0.58624 -1.46561,-1.46561 l 0,-38.10527 c 0,-0.88002 0.58624,-1.46561 1.46561,-1.46561 l 38.10593,0 c 0.88002,0 1.4643,0.58624 1.4643,1.46561 l 0,38.10527 z"
inkscape:connector-curvature="0" />
<path
id="path3499"
d="m 291.81296,519.06955 0.14787,-0.73216 c 0.14721,-0.43968 -0.14787,-0.87936 -0.58625,-1.02527 -0.43968,-0.14722 -0.88002,0.14722 -1.02593,0.58625 l -0.14721,0.73215 c -0.87937,-0.14656 -1.61218,0 -1.75874,0.43968 l -3.51812,13.33642 4.54274,1.17184 3.51682,-13.33642 c 0.14721,-0.29378 -0.29247,-0.87937 -1.17118,-1.17249 z"
inkscape:connector-curvature="0" />
<path
id="path3501"
d="m 294.01138,520.09548 c -0.14787,0 -0.441,0.14721 -0.441,0.29246 l -1.75873,6.59526 0.7328,0.14722 1.75874,-6.59526 c 0.001,-0.14656 0.001,-0.43968 -0.29181,-0.43968 z"
inkscape:connector-curvature="0" />
<path
id="path3503"
d="m 286.24363,536.80411 c 0,0 1.17249,-1.02593 2.05251,-1.90529 l -2.93057,-0.73346 c 0.29116,1.17314 0.87806,2.63875 0.87806,2.63875 z"
inkscape:connector-curvature="0" />
<path
id="path3505"
d="m 285.36361,536.07065 -0.29247,0 c -0.73281,0 -1.46496,0.14722 -4.39749,0.14722 -0.29247,0 -0.58625,-0.14722 -0.88003,-0.43969 -0.43902,-0.29312 -0.7328,-0.58624 -1.31905,-0.58624 l 0,0 c -0.43968,0 -0.88002,0.29247 -1.90529,0.73215 -0.43969,0.29312 -1.17249,0.58625 -1.46562,0.73346 0,-0.14787 0,-0.58624 0.14657,-0.73346 0.14721,-0.58624 0.14721,-1.17183 0,-1.4643 -0.14657,-0.14722 -0.29247,-0.14722 -0.43969,-0.14722 l 0,0 c -0.87937,0 -1.75873,1.02528 -2.78466,1.90464 -0.58494,0.5869 -1.31775,1.31906 -1.61087,1.31906 l 0,0 c -0.29312,-0.43969 0.73281,-2.4922 1.02593,-3.3696 0.58625,-1.46562 0.87937,-1.75874 0.43969,-2.05252 -0.14722,-0.14721 -0.29313,-0.14721 -0.73281,0 -0.58625,0.43969 -1.31905,1.02462 -1.9053,1.75874 -1.31905,1.17183 -2.6381,2.49285 -3.66403,2.05186 -0.14721,-0.14657 -0.43968,0 -0.58624,0.14917 -0.14657,0.14722 0,0.43969 0.14721,0.5856 1.46496,0.73215 2.93057,-0.73347 4.54275,-2.19777 0.43968,-0.29247 0.7328,-0.73215 1.17249,-1.02462 -0.14657,0.14656 -0.14657,0.29247 -0.29313,0.43968 -0.87936,1.9053 -1.46495,3.3696 -1.02527,4.10307 0.14656,0.14721 0.29312,0.29115 0.58624,0.29115 l 0,0 c 0.58625,0 1.31971,-0.73215 2.19842,-1.61151 0.73281,-0.73347 1.46562,-1.46562 2.05186,-1.61283 0,0.14721 0,0.43968 -0.14656,0.73346 -0.14722,0.58624 -0.14722,1.17183 0,1.46561 0.14591,0.14329 0.29247,0.29051 0.43903,0.29051 0.43968,0 1.02593,-0.29247 1.9053,-0.87937 0.43968,-0.29378 1.31905,-0.73346 1.46561,-0.73346 l 0,0 c 0.29247,0 0.58624,0.14721 0.87937,0.43968 0.29312,0.29378 0.7328,0.58625 1.31905,0.58625 3.07713,0 3.66534,0 4.54274,-0.14657 l 0.29312,0 c 0.14657,0 0.29247,-0.14721 0.29247,-0.44099 6.6e-4,-0.29116 0.29378,-0.29116 6.6e-4,-0.29116 z"
inkscape:connector-curvature="0" />
<rect
id="rect3507"
height="2.9312253"
width="29.312252"
y="510.569"
x="264.99225" />
<rect
id="rect3509"
height="2.9305711"
width="18.467373"
y="516.43146"
x="264.99225" />
<rect
id="rect3511"
height="2.9312253"
width="18.467373"
y="523.75952"
x="264.99225" />
</g>
<g
id="g3513"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3515"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3517"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3519"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3521"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3523"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3525"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3527"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3529"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3531"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3533"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3535"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3537"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3539"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3541"
transform="matrix(0.65429135,0,0,0.65429135,252.06849,472.60499)" />
<g
id="g3951"
transform="matrix(1.0408634,0,0,1.0408634,202.38498,-56.437759)">
<path
transform="matrix(0.17391897,0,0,0.17391897,113.56733,503.31436)"
d="m 361.55,582.99 -0.3189,52.177 167.41,-24.24 0.12626,-53.004 z"
inkscape:connector-curvature="0"
style="fill:url(#linearGradient3880);filter:url(#filter3882)"
sodipodi:nodetypes="ccccc"
id="path3769" />
<path
sodipodi:start="2.8912232"
sodipodi:end="1.6163158"
sodipodi:cx="511.42856"
sodipodi:cy="558.07648"
transform="matrix(0.19132826,0,0,0.14711806,107.51199,518.39331)"
d="m 359.18527,586.74607 a 157.14285,115.71429 0 0 1 67.56356,-126.14595 157.14285,115.71429 0 0 1 183.85291,7.71681 157.14285,115.71429 0 0 1 47.65992,130.9822 157.14285,115.71429 0 0 1 -153.98369,74.37177 l 7.15059,-115.59442 z"
sodipodi:type="arc"
style="fill:url(#linearGradient3838);filter:url(#filter3852)"
sodipodi:ry="115.71429"
sodipodi:rx="157.14285"
id="path2999" />
<path
transform="matrix(0.17391897,0,0,0.17391897,113.56733,503.31436)"
d="m 519.14,708.32 c 17.065,0.44011 34.171,-0.539 50.721,-2.9353 74.561,-10.796 125.24,-47.545 129.72,-88.817 l 0.2525,0 0,-2.9353 0,-6.2809 0,-46.239 c -2.3396,42.453 -53.653,80.701 -129.97,91.752 -16.55,2.3963 -33.656,3.3754 -50.721,2.9353 z"
inkscape:connector-curvature="0"
style="fill:url(#radialGradient3872);filter:url(#filter3848)"
sodipodi:nodetypes="cscccccscc"
id="rect3771" />
<path
transform="matrix(0.17391897,0,0,0.17391897,113.56733,503.31436)"
d="m 356.44,610.74 0.15782,0 c -0.0187,8.0612 1.738,16.258 5.4288,24.429 l 0.15781,-0.0315 0,-24.398 0,-24.461 0,-3.6612 -0.15781,0.0315 c -3.7744,-8.3563 -5.5225,-16.735 -5.4217,-24.973 z"
inkscape:connector-curvature="0"
style="fill:#339c34;filter:url(#filter3886)"
sodipodi:nodetypes="cccccccccc"
id="path3813" />
<path
sodipodi:start="1.6103913"
sodipodi:end="2.891152"
sodipodi:cx="511.42856"
sodipodi:cy="558.07648"
transform="matrix(0.19132826,0,0,0.14711806,99.424239,525.92035)"
d="M 505.20812,673.70007 A 157.14285,115.71429 0 0 1 359.18804,586.75405 l 152.24052,-28.67757 z"
sodipodi:type="arc"
style="fill:url(#linearGradient3896);filter:url(#filter3898)"
sodipodi:ry="115.71429"
sodipodi:rx="157.14285"
id="path3824" />
<path
transform="matrix(0.17391897,0,0,0.17391897,113.56733,503.31436)"
d="m 314.09,627.03 0.5625,49.531 c 18.756,41.512 83.443,71.116 159.06,72.812 l 0.0625,-49.938 -0.15625,-0.0625 c -75.01,-1.7 -139.24,-30.86 -158.53,-71.87 l -1,-0.46875 z"
inkscape:connector-curvature="0"
style="fill:url(#linearGradient3908);filter:url(#filter3910)"
id="path3826" />
</g>
</g>
<metadata
id="metadata499">
<rdf:RDF>
<cc:Work>
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" />
<dc:publisher>
<cc:Agent
rdf:about="http://openclipart.org/">
<dc:title>Openclipart</dc:title>
</cc:Agent>
</dc:publisher>
<dc:title>Pile of Golden Coins</dc:title>
<dc:date>2010-04-09T03:27:45</dc:date>
<dc:description>A pile of hypothetical golden coins, drawn in Inkscape.</dc:description>
<dc:source>https://openclipart.org/detail/43969/pile-of-golden-coins-by-j_alves</dc:source>
<dc:creator>
<cc:Agent>
<dc:title>J_Alves</dc:title>
</cc:Agent>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>coin</rdf:li>
<rdf:li>currency</rdf:li>
<rdf:li>gold</rdf:li>
<rdf:li>money</rdf:li>
<rdf:li>thaler</rdf:li>
</rdf:Bag>
</dc:subject>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/publicdomain/zero/1.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
</svg>

5
contract_recurring_analytic_distribution/tests/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import test_contract_recurring_distribution

69
contract_recurring_analytic_distribution/tests/test_contract_recurring_distribution.py

@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Tecnativa - Pedro M. Baeza
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import openerp.tests.common as common
class TestContractRecurringDistribution(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestContractRecurringDistribution, cls).setUpClass()
cls.partner = cls.env['res.partner'].create({'name': 'Test'})
cls.product = cls.env['product.product'].create({
'name': 'Test product',
})
cls.account1 = cls.env['account.analytic.account'].create({
'name': 'Test account #1',
})
cls.account2 = cls.env['account.analytic.account'].create({
'name': 'Test account #2',
})
cls.uom = cls.env.ref('product.product_uom_hour')
cls.contract = cls.env['account.analytic.account'].create({
'name': 'Test contract',
'partner_id': cls.partner.id,
'type': 'contract',
'recurring_invoices': 1,
'recurring_interval': 1,
'recurring_invoice_line_ids': [
(0, 0, {'quantity': 2.0,
'price_unit': 100.0,
'name': 'Test',
'product_id': cls.product.id,
'uom_id': cls.uom.id})],
})
cls.distribution = cls.env['account.analytic.distribution'].create({
'name': 'Test distribution',
'rule_ids': [
(0, 0, {
'sequence': 10,
'percent': 75.00,
'analytic_account_id': cls.account1.id,
}),
(0, 0, {
'sequence': 20,
'percent': 25.00,
'analytic_account_id': cls.account2.id,
}),
]
})
def test_invoice_without_distribution(self):
self.contract.recurring_create_invoice()
invoice = self.env['account.invoice'].search(
[('partner_id', '=', self.partner.id)])
self.assertEqual(
invoice.invoice_line_ids[0].account_analytic_id, self.contract)
def test_invoice_with_distribution(self):
self.contract.recurring_invoice_line_ids.analytic_distribution_id = (
self.distribution.id)
self.contract.recurring_create_invoice()
invoice = self.env['account.invoice'].search(
[('partner_id', '=', self.partner.id)])
self.assertFalse(invoice.invoice_line_ids[0].account_analytic_id)
self.assertEqual(
invoice.invoice_line_ids[0].analytic_distribution_id,
self.distribution)

15
contract_recurring_analytic_distribution/views/account_analytic_invoice_line_view.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_analytic_account_form_form" model="ir.ui.view">
<field name="name">Contract form (with plans)</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="contract.account_analytic_account_recurring_form_form"/>
<field name="arch" type="xml">
<field name="quantity" position="before">
<field name="analytic_distribution_id"/>
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save