Browse Source

[ADD] contract_recurring_invoicing_markers

=======================================
Markers for contract recurring invoices
=======================================

This module allows to include some markers on the lines of your recurring
invoices definition inside the contract so that the generated invoice lines
will contain a dynamic text depending on these markers.

These markers are the supported ones:

* #START#: Start date of the invoiced period.
* #END# End date of the invoiced period.

Usage
=====

On a contract (*Sales > Sales > Contracts*), mark "Generate recurring invoices
automatically" for enabling the creation of recurring invoices.

In the "Invoice Lines" section, you can add lines with products. In the
*Description* field, you can now add any of the markers mentioned before
between the rest of the text.

When you invoice this contract (automatically or manually), your invoice
will contain the corresponding text that replaces the marker.

Known issues / Roadmap
======================

* Add more markers, like #START_MONTH# or #END_MONTH#.
pull/38/head
Pedro M. Baeza 9 years ago
parent
commit
76c3bf060d
  1. 79
      contract_recurring_invoicing_marker/README.rst
  2. 5
      contract_recurring_invoicing_marker/__init__.py
  3. 19
      contract_recurring_invoicing_marker/__openerp__.py
  4. 5
      contract_recurring_invoicing_marker/models/__init__.py
  5. 41
      contract_recurring_invoicing_marker/models/account_analytic_account.py
  6. BIN
      contract_recurring_invoicing_marker/static/description/icon.png
  7. 320
      contract_recurring_invoicing_marker/static/description/icon.svg
  8. 5
      contract_recurring_invoicing_marker/tests/__init__.py
  9. 39
      contract_recurring_invoicing_marker/tests/test_contract_recurring_invoicing_marker.py
  10. 20
      contract_recurring_invoicing_marker/views/account_analytic_account_view.xml

79
contract_recurring_invoicing_marker/README.rst

@ -0,0 +1,79 @@
.. 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
=======================================
Markers for contract recurring invoices
=======================================
This module allows to include some markers on the lines of your recurring
invoices definition inside the contract so that the generated invoice lines
will contain a dynamic text depending on these markers.
These markers are the supported ones:
* #START#: Start date of the invoiced period.
* #END# End date of the invoiced period.
Usage
=====
On a contract (*Sales > Sales > Contracts*), mark "Generate recurring invoices
automatically" for enabling the creation of recurring invoices.
In the "Invoice Lines" section, you can add lines with products. In the
*Description* field, you can now add any of the markers mentioned before
between the rest of the text.
When you invoice this contract (automatically or manually), your invoice
will contain the corresponding text that replaces the marker.
.. 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
Known issues / Roadmap
======================
* Add more markers, like #START_MONTH# or #END_MONTH#.
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_invoicing_markers%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_invoicing_marker/__init__.py

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

19
contract_recurring_invoicing_marker/__openerp__.py

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

5
contract_recurring_invoicing_marker/models/__init__.py

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

41
contract_recurring_invoicing_marker/models/account_analytic_account.py

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
# (c) 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import api, fields, models
from dateutil.relativedelta import relativedelta
class AccountAnalyticAccount(models.Model):
_inherit = "account.analytic.account"
@api.model
def _prepare_invoice(self, contract):
next_date = fields.Date.from_string(
contract.recurring_next_date or fields.Date.today())
interval = contract.recurring_interval
old_date = next_date
if contract.recurring_rule_type == 'daily':
new_date = next_date + relativedelta(days=interval - 1)
elif contract.recurring_rule_type == 'weekly':
new_date = next_date + relativedelta(weeks=interval, days=-1)
else:
new_date = next_date + relativedelta(months=interval, days=-1)
obj = self.with_context(old_date=old_date, next_date=new_date)
return super(AccountAnalyticAccount, obj)._prepare_invoice(contract)
@api.model
def _prepare_invoice_line(self, line, invoice_id):
res = super(AccountAnalyticAccount, self)._prepare_invoice_line(
line, invoice_id)
if 'old_date' in self.env.context and 'next_date' in self.env.context:
lang_obj = self.env['res.lang']
contract = line.analytic_account_id
lang = lang_obj.search(
[('code', '=', contract.partner_id.lang)])
date_format = lang.date_format
res['name'] = res['name'].replace(
'#START#', self.env.context['old_date'].strftime(date_format))
res['name'] = res['name'].replace(
'#END#', self.env.context['next_date'].strftime(date_format))
return res

BIN
contract_recurring_invoicing_marker/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 6.2 KiB

320
contract_recurring_invoicing_marker/static/description/icon.svg

@ -0,0 +1,320 @@
<?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.48.4 r9939"
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>
</defs>
<sodipodi:namedview
id="base"
bordercolor="#666666"
inkscape:pageshadow="2"
inkscape:window-y="24"
pagecolor="#ffffff"
inkscape:window-height="1176"
inkscape:window-maximized="1"
inkscape:zoom="4.9954589"
inkscape:window-x="59"
showgrid="false"
borderopacity="1.0"
inkscape:current-layer="layer1"
inkscape:cx="73.86699"
inkscape:cy="46.4832"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1861"
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
style="font-size:16px;font-style:normal;font-weight:bold;text-align:center;line-height:92.00000167%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#cccccc;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold"
id="text3060">
<path
d="m 373.03812,577.02563 -0.75,3.00782 2.0625,0 0.75781,-3.00782 1.72656,0 -0.75781,3.00782 2.16406,0 0,1.66406 -2.57812,0 -0.53907,2.14062 2.21875,0 0,1.67969 -2.625,0 -0.75,2.99219 -1.72656,0 0.75,-2.99219 -2.0625,0 -0.75,2.99219 -1.74219,0 0.75,-2.99219 -2.17968,0 0,-1.67969 2.5625,0 0.54687,-2.14062 -2.21094,0 0,-1.66406 2.64063,0 0.75,-3.00782 1.74219,0 m 0.88281,4.67188 -2.0625,0 -0.54688,2.14062 2.0625,0 0.54688,-2.14062"
style=""
id="path3839" />
<path
d="m 388.91312,577.21313 0,2.46875 c -0.64064,-0.28644 -1.26564,-0.50259 -1.875,-0.64843 -0.60939,-0.14583 -1.18491,-0.21874 -1.72657,-0.21875 -0.71875,10e-6 -1.25,0.099 -1.59375,0.29687 -0.34375,0.19793 -0.51562,0.50522 -0.51562,0.92188 0,0.31251 0.11458,0.5573 0.34375,0.73437 0.23437,0.17188 0.65624,0.32032 1.26562,0.44531 l 1.28125,0.25782 c 1.29687,0.26042 2.21874,0.65625 2.76563,1.1875 0.54686,0.53125 0.8203,1.28646 0.82031,2.26562 -1e-5,1.28646 -0.38282,2.2448 -1.14844,2.875 -0.76042,0.625 -1.92448,0.9375 -3.49218,0.9375 -0.73959,0 -1.48178,-0.0703 -2.22657,-0.21094 -0.74479,-0.14062 -1.48958,-0.34895 -2.23437,-0.625 l 0,-2.53906 c 0.74479,0.39584 1.46354,0.69532 2.15625,0.89844 0.69791,0.19792 1.36979,0.29688 2.01562,0.29687 0.65625,10e-6 1.15885,-0.10937 1.50782,-0.32812 0.34895,-0.21875 0.52343,-0.53125 0.52343,-0.9375 0,-0.36458 -0.1198,-0.64583 -0.35937,-0.84375 -0.23438,-0.19791 -0.70574,-0.375 -1.41406,-0.53125 l -1.16407,-0.25781 c -1.16667,-0.25 -2.02083,-0.64843 -2.5625,-1.19532 -0.53646,-0.54686 -0.80468,-1.28384 -0.80468,-2.21093 0,-1.16145 0.37499,-2.05468 1.125,-2.67969 0.74999,-0.62499 1.82812,-0.93749 3.23437,-0.9375 0.64062,1e-5 1.29947,0.0495 1.97656,0.14844 0.67708,0.0938 1.3776,0.23699 2.10157,0.42968"
style=""
id="path3841" />
<path
d="m 390.93655,576.84595 10.75,0 0,2.27343 -3.86718,0 0,9.39063 -3.00782,0 0,-9.39063 -3.875,0 0,-2.27343"
style=""
id="path3843" />
<path
d="m 409.06155,586.38501 -4.70312,0 -0.74219,2.125 -3.02344,0 4.32032,-11.66406 3.58593,0 4.32032,11.66406 -3.02344,0 -0.73438,-2.125 m -3.95312,-2.16406 3.19531,0 -1.59375,-4.64063 -1.60156,4.64063"
style=""
id="path3845" />
<path
d="m 418.63187,582.01782 c 0.6302,10e-6 1.08072,-0.11718 1.35156,-0.35156 0.27603,-0.23437 0.41405,-0.61978 0.41406,-1.15625 -1e-5,-0.53124 -0.13803,-0.91145 -0.41406,-1.14063 -0.27084,-0.22915 -0.72136,-0.34374 -1.35156,-0.34375 l -1.26563,0 0,2.99219 1.26563,0 m -1.26563,2.07813 0,4.41406 -3.00781,0 0,-11.66406 4.59375,0 c 1.53645,10e-6 2.66145,0.25782 3.375,0.77343 0.71874,0.51564 1.07811,1.33074 1.07812,2.44532 -1e-5,0.77084 -0.18751,1.40365 -0.5625,1.89843 -0.3698,0.4948 -0.92969,0.85939 -1.67968,1.09375 0.41145,0.0938 0.77863,0.3073 1.10156,0.64063 0.32811,0.32813 0.65884,0.82813 0.99219,1.5 l 1.63281,3.3125 -3.20313,0 -1.42187,-2.89844 c -0.28647,-0.58333 -0.57813,-0.98176 -0.875,-1.19531 -0.29167,-0.21354 -0.6823,-0.32031 -1.17188,-0.32031 l -0.85156,0"
style=""
id="path3847" />
<path
d="m 424.56155,576.84595 10.75,0 0,2.27343 -3.86718,0 0,9.39063 -3.00782,0 0,-9.39063 -3.875,0 0,-2.27343"
style=""
id="path3849" />
<path
d="m 442.50687,577.02563 -0.75,3.00782 2.0625,0 0.75781,-3.00782 1.72656,0 -0.75781,3.00782 2.16406,0 0,1.66406 -2.57812,0 -0.53907,2.14062 2.21875,0 0,1.67969 -2.625,0 -0.75,2.99219 -1.72656,0 0.75,-2.99219 -2.0625,0 -0.75,2.99219 -1.74219,0 0.75,-2.99219 -2.17968,0 0,-1.67969 2.5625,0 0.54687,-2.14062 -2.21094,0 0,-1.66406 2.64063,0 0.75,-3.00782 1.74219,0 m 0.88281,4.67188 -2.0625,0 -0.54688,2.14062 2.0625,0 0.54688,-2.14062"
style=""
id="path3851" />
<path
d="m 382.25687,591.74564 -0.75,3.00781 2.0625,0 0.75781,-3.00781 1.72656,0 -0.75781,3.00781 2.16406,0 0,1.66406 -2.57812,0 -0.53907,2.14063 2.21875,0 0,1.67968 -2.625,0 -0.75,2.99219 -1.72656,0 0.75,-2.99219 -2.0625,0 -0.75,2.99219 -1.74219,0 0.75,-2.99219 -2.17968,0 0,-1.67968 2.5625,0 0.54687,-2.14063 -2.21094,0 0,-1.66406 2.64063,0 0.75,-3.00781 1.74219,0 m 0.88281,4.67187 -2.0625,0 -0.54688,2.14063 2.0625,0 0.54688,-2.14063"
style=""
id="path3853" />
<path
d="m 390.01468,591.56595 8.11719,0 0,2.27344 -5.10938,0 0,2.17187 4.80469,0 0,2.27344 -4.80469,0 0,2.67187 5.28125,0 0,2.27344 -8.28906,0 0,-11.66406"
style=""
id="path3855" />
<path
d="m 400.95218,591.56595 3.35937,0 4.24219,8 0,-8 2.85156,0 0,11.66406 -3.35937,0 -4.24219,-8 0,8 -2.85156,0 0,-11.66406"
style=""
id="path3857" />
<path
d="m 417.36624,593.83939 0,7.11718 1.07813,0 c 1.22916,0 2.16666,-0.30468 2.8125,-0.91406 0.65103,-0.60937 0.97655,-1.49479 0.97656,-2.65625 -10e-6,-1.15624 -0.32293,-2.03645 -0.96875,-2.64062 -0.64584,-0.60416 -1.58595,-0.90625 -2.82031,-0.90625 l -1.07813,0 m -3.00781,-2.27344 3.17187,0 c 1.77083,10e-6 3.08854,0.12761 3.95313,0.38281 0.86978,0.25001 1.61457,0.67709 2.23437,1.28125 0.54687,0.52605 0.95312,1.13282 1.21875,1.82031 0.26562,0.68751 0.39843,1.46616 0.39844,2.33594 -1e-5,0.88021 -0.13282,1.66667 -0.39844,2.35938 -0.26563,0.6875 -0.67188,1.29427 -1.21875,1.82031 -0.62501,0.60417 -1.37501,1.03385 -2.25,1.28906 -0.875,0.25 -2.1875,0.375 -3.9375,0.375 l -3.17187,0 0,-11.66406"
style=""
id="path3859" />
<path
d="m 433.28812,591.74564 -0.75,3.00781 2.0625,0 0.75781,-3.00781 1.72656,0 -0.75781,3.00781 2.16406,0 0,1.66406 -2.57812,0 -0.53907,2.14063 2.21875,0 0,1.67968 -2.625,0 -0.75,2.99219 -1.72656,0 0.75,-2.99219 -2.0625,0 -0.75,2.99219 -1.74219,0 0.75,-2.99219 -2.17968,0 0,-1.67968 2.5625,0 0.54687,-2.14063 -2.21094,0 0,-1.66406 2.64063,0 0.75,-3.00781 1.74219,0 m 0.88281,4.67187 -2.0625,0 -0.54688,2.14063 2.0625,0 0.54688,-2.14063"
style=""
id="path3861" />
</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_invoicing_marker/tests/__init__.py

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

39
contract_recurring_invoicing_marker/tests/test_contract_recurring_invoicing_marker.py

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
# (c) 2016 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 TestContractRecurringInvoicingMarker(common.TransactionCase):
def setUp(self):
super(TestContractRecurringInvoicingMarker, self).setUp()
self.partner = self.env['res.partner'].create({
'name': 'Test',
'lang': 'en_US',
})
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_next_date': '2016-01-01',
'recurring_rule_type': 'monthly',
'recurring_interval': 1,
'recurring_invoice_line_ids': [
(0, 0, {'quantity': 2.0,
'price_unit': 100.0,
'name': '#START# - #END#',
'product_id': self.product.id,
'uom_id': self.uom.id})],
})
def test_invoice_with_marker(self):
self.contract.recurring_create_invoice()
invoice = self.env['account.invoice'].search(
[('partner_id', '=', self.partner.id)])
self.assertEqual(
invoice.invoice_line[0].name, u'01/01/2016 - 01/31/2016')

20
contract_recurring_invoicing_marker/views/account_analytic_account_view.xml

@ -0,0 +1,20 @@
<?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 markers)</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="recurring_invoice_line_ids" position="after">
<group string="Legend (for the markers inside invoice lines description)">
<p colspan="2"> <strong>#START#</strong>: Start date of the invoiced period</p>
<p colspan="2"> <strong>#END#</strong>: End date of the invoiced period</p>
</group>
</field>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save