Browse Source

[ADD] contract_recurring_plans

==============================================
Analytic plans for contract recurring invoices
==============================================

This module allows to include an analytic plan 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.
pull/21/head
Pedro M. Baeza 9 years ago
parent
commit
95b3b09a8c
  1. 62
      contract_recurring_plans/README.rst
  2. 5
      contract_recurring_plans/__init__.py
  3. 20
      contract_recurring_plans/__openerp__.py
  4. 36
      contract_recurring_plans/i18n/es.po
  5. 5
      contract_recurring_plans/models/__init__.py
  6. 26
      contract_recurring_plans/models/account_analytic_invoice_line.py
  7. BIN
      contract_recurring_plans/static/description/icon.png
  8. 463
      contract_recurring_plans/static/description/icon.svg
  9. 5
      contract_recurring_plans/tests/__init__.py
  10. 47
      contract_recurring_plans/tests/test_contract_recurring_plans.py
  11. 17
      contract_recurring_plans/views/account_analytic_invoice_line_view.xml

62
contract_recurring_plans/README.rst

@ -0,0 +1,62 @@
.. 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 plan 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/8.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 smashing it by providing a detailed and welcomed feedback `here <https://github.com/OCA/
contract/issues/new?body=module:%20
contract_recurring_plans%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.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 http://odoo-community.org.

5
contract_recurring_plans/__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 models

20
contract_recurring_plans/__openerp__.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Analytic plans on contracts recurring invoices',
'version': '8.0.1.0.0',
'category': 'Contract Management',
'author': 'Serv. Tecnolog. Avanzados - Pedro M. Baeza, '
'Odoo Community Association (OCA)',
'website': 'http://www.serviciosbaeza.com',
'depends': [
'account_analytic_plans',
'account_analytic_analysis',
],
'data': [
'views/account_analytic_invoice_line_view.xml',
],
'installable': True,
}

36
contract_recurring_plans/i18n/es.po

@ -0,0 +1,36 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_analytic_analysis_recurring_plans
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-11-01 01:39+0000\n"
"PO-Revision-Date: 2014-11-01 01:39+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account_analytic_analysis_recurring_plans
#: code:_description:0
#: model:ir.model,name:account_analytic_analysis_recurring_plans.model_account_analytic_account
#, python-format
msgid "Analytic Account"
msgstr "Cuenta analítica"
#. module: account_analytic_analysis_recurring_plans
#: field:account.analytic.invoice.line,analytics_id:0
msgid "Analytic Distribution"
msgstr "Distribución analítica"
#. module: account_analytic_analysis_recurring_plans
#: code:_description:0
#: model:ir.model,name:account_analytic_analysis_recurring_plans.model_account_analytic_invoice_line
#, python-format
msgid "account.analytic.invoice.line"
msgstr "account.analytic.invoice.line"

5
contract_recurring_plans/models/__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 account_analytic_invoice_line

26
contract_recurring_plans/models/account_analytic_invoice_line.py

@ -0,0 +1,26 @@
# -*- 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 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.analytics_id:
res.update({'account_analytic_id': False,
'analytics_id': line.analytics_id.id})
return res
class AccountAnalyticInvoiceLine(models.Model):
_inherit = "account.analytic.invoice.line"
analytics_id = fields.Many2one(
comodel_name='account.analytic.plan.instance',
string='Analytic Distribution')

BIN
contract_recurring_plans/static/description/icon.png

After

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

463
contract_recurring_plans/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_plans/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_plans

47
contract_recurring_plans/tests/test_contract_recurring_plans.py

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import openerp.tests.common as common
class TestContractRecurringPlans(common.TransactionCase):
def setUp(self):
super(TestContractRecurringPlans, self).setUp()
self.partner = self.env['res.partner'].create({'name': 'Test'})
self.product = self.env.ref('product.product_product_consultant')
self.uom = self.env.ref('product.product_uom_hour')
self.contract = self.env['account.analytic.account'].create({
'name': 'Test contract',
'partner_id': self.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': self.product.id,
'uom_id': self.uom.id})],
})
plan = self.env['account.analytic.plan'].create({'name': 'Test'})
self.analytics = self.env['account.analytic.plan.instance'].create(
{'plan_id': plan.id})
def test_invoice_without_plans(self):
self.contract.recurring_create_invoice()
invoice = self.env['account.invoice'].search(
[('partner_id', '=', self.partner.id)])
self.assertEqual(
invoice.invoice_line[0].account_analytic_id, self.contract)
def test_invoice_with_plans(self):
self.contract.recurring_invoice_line_ids.analytics_id = (
self.analytics.id)
self.contract.recurring_create_invoice()
invoice = self.env['account.invoice'].search(
[('partner_id', '=', self.partner.id)])
self.assertFalse(invoice.invoice_line[0].account_analytic_id)
self.assertEqual(
invoice.invoice_line[0].analytics_id, self.analytics)

17
contract_recurring_plans/views/account_analytic_invoice_line_view.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<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="account_analytic_analysis.account_analytic_account_form_form"/>
<field name="arch" type="xml">
<field name="quantity" position="before">
<field name="analytics_id"/>
</field>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save