[MIG] base_comment_template: Migration to 14.0 add unit test

[UPD] Update base_comment_template.pot

[UPD] README.rst
pull/664/head
Pierre Verkest 2021-01-08 01:06:32 +01:00 committed by Achraf Mhadhbi
parent 658003587b
commit 9fb52a9512
8 changed files with 42 additions and 25 deletions

View File

@ -13,14 +13,14 @@ Base Comments Templates
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoice--reporting-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoice-reporting/tree/14.0/base_comment_template :target: https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template
:alt: OCA/account-invoice-reporting :alt: OCA/reporting-engine
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoice-reporting-12-0/account-invoice-reporting-12-0-base_comment_template :target: https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-base_comment_template
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/94/14.0 :target: https://runbot.odoo-community.org/runbot/143/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -37,7 +37,7 @@ This module is the base module for following modules:
* sale_comment_template * sale_comment_template
* purchase_comment_template * purchase_comment_template
* invoice_comment_template * invoice_comment_template
* stock_picking_comment_template
**Table of contents** **Table of contents**
@ -47,10 +47,10 @@ This module is the base module for following modules:
Bug Tracker Bug Tracker
=========== ===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoice-reporting/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-invoice-reporting/issues/new?body=module:%20base_comment_template%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20base_comment_template%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -70,7 +70,6 @@ Contributors
* Yannick Vaucher <yannick.vaucher@camptocamp.com> * Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com> * Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Simone Rubino <simone.rubino@agilebg.com> * Simone Rubino <simone.rubino@agilebg.com>
* Simone Rubino <simone.rubino@agilebg.com>
* `DynApps <https://www.dynapps.be>`_: * `DynApps <https://www.dynapps.be>`_:
* Raf Ven <raf.ven@dynapps.be> * Raf Ven <raf.ven@dynapps.be>
@ -78,7 +77,7 @@ Contributors
* `Druidoo <https://www.druidoo.io>`_: * `Druidoo <https://www.druidoo.io>`_:
* Iván Todorovich <ivan.todorovich@druidoo.io> * Iván Todorovich <ivan.todorovich@druidoo.io>
* Pierre Verkest <pierreverkest84@gmail.com>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -93,6 +92,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/account-invoice-reporting <https://github.com/OCA/account-invoice-reporting/tree/14.0/base_comment_template>`_ project on GitHub. This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -6,7 +6,7 @@
"summary": "Comments templates on documents", "summary": "Comments templates on documents",
"version": "14.0.1.0.0", "version": "14.0.1.0.0",
"category": "Sale", "category": "Sale",
"website": "https://github.com/OCA/account-invoice-reporting", "website": "https://github.com/OCA/reporting-engine",
"author": "Camptocamp, Odoo Community Association (OCA)", "author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"installable": True, "installable": True,

View File

@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 14.0\n" "Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -19,7 +19,7 @@ msgid "Active"
msgstr "" msgstr ""
#. module: base_comment_template #. module: base_comment_template
#: selection:base.comment.template,position:0 #: model:ir.model.fields.selection,name:base_comment_template.selection__base_comment_template__position__after_lines
msgid "After lines" msgid "After lines"
msgstr "" msgstr ""
@ -29,7 +29,7 @@ msgid "Base comment template"
msgstr "" msgstr ""
#. module: base_comment_template #. module: base_comment_template
#: selection:base.comment.template,position:0 #: model:ir.model.fields.selection,name:base_comment_template.selection__base_comment_template__position__before_lines
msgid "Before lines" msgid "Before lines"
msgstr "" msgstr ""
@ -79,11 +79,13 @@ msgstr ""
#. module: base_comment_template #. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__display_name #: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__display_name
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner__display_name
msgid "Display Name" msgid "Display Name"
msgstr "" msgstr ""
#. module: base_comment_template #. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__id #: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__id
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner__id
msgid "ID" msgid "ID"
msgstr "" msgstr ""
@ -94,6 +96,7 @@ msgstr ""
#. module: base_comment_template #. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template____last_update #: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template____last_update
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner____last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "" msgstr ""
@ -121,4 +124,3 @@ msgstr ""
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__position #: model:ir.model.fields,help:base_comment_template.field_base_comment_template__position
msgid "Position on document" msgid "Position on document"
msgstr "" msgstr ""

View File

@ -45,4 +45,4 @@ class BaseCommentTemplate(models.Model):
lang = None lang = None
if partner_id: if partner_id:
lang = self.env["res.partner"].browse(partner_id).lang lang = self.env["res.partner"].browse(partner_id).lang
return self.with_context({"lang": lang}).text return self.with_context(lang=lang).text

View File

@ -3,7 +3,6 @@
* Yannick Vaucher <yannick.vaucher@camptocamp.com> * Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com> * Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Simone Rubino <simone.rubino@agilebg.com> * Simone Rubino <simone.rubino@agilebg.com>
* Simone Rubino <simone.rubino@agilebg.com>
* `DynApps <https://www.dynapps.be>`_: * `DynApps <https://www.dynapps.be>`_:
* Raf Ven <raf.ven@dynapps.be> * Raf Ven <raf.ven@dynapps.be>

View File

@ -10,3 +10,4 @@ This module is the base module for following modules:
* sale_comment_template * sale_comment_template
* purchase_comment_template * purchase_comment_template
* invoice_comment_template * invoice_comment_template
* stock_picking_comment_template

View File

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-invoice-reporting/tree/12.0/base_comment_template"><img alt="OCA/account-invoice-reporting" src="https://img.shields.io/badge/github-OCA%2Faccount--invoice--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-invoice-reporting-12-0/account-invoice-reporting-12-0-base_comment_template"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/94/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-base_comment_template"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/143/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Add a new model to define templates of comments to print on <p>Add a new model to define templates of comments to print on
documents.</p> documents.</p>
<p>Two positions are available for the comments: <p>Two positions are available for the comments:
@ -378,6 +378,7 @@ documents.</p>
<li>sale_comment_template</li> <li>sale_comment_template</li>
<li>purchase_comment_template</li> <li>purchase_comment_template</li>
<li>invoice_comment_template</li> <li>invoice_comment_template</li>
<li>stock_picking_comment_template</li>
</ul> </ul>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
@ -393,10 +394,10 @@ documents.</p>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-invoice-reporting/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/account-invoice-reporting/issues/new?body=module:%20base_comment_template%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20base_comment_template%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -415,7 +416,6 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Yannick Vaucher &lt;<a class="reference external" href="mailto:yannick.vaucher&#64;camptocamp.com">yannick.vaucher&#64;camptocamp.com</a>&gt;</li> <li>Yannick Vaucher &lt;<a class="reference external" href="mailto:yannick.vaucher&#64;camptocamp.com">yannick.vaucher&#64;camptocamp.com</a>&gt;</li>
<li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li> <li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li>
<li>Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;agilebg.com">simone.rubino&#64;agilebg.com</a>&gt;</li> <li>Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;agilebg.com">simone.rubino&#64;agilebg.com</a>&gt;</li>
<li>Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;agilebg.com">simone.rubino&#64;agilebg.com</a>&gt;</li>
<li><a class="reference external" href="https://www.dynapps.be">DynApps</a>:<ul> <li><a class="reference external" href="https://www.dynapps.be">DynApps</a>:<ul>
<li>Raf Ven &lt;<a class="reference external" href="mailto:raf.ven&#64;dynapps.be">raf.ven&#64;dynapps.be</a>&gt;</li> <li>Raf Ven &lt;<a class="reference external" href="mailto:raf.ven&#64;dynapps.be">raf.ven&#64;dynapps.be</a>&gt;</li>
</ul> </ul>
@ -424,6 +424,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Iván Todorovich &lt;<a class="reference external" href="mailto:ivan.todorovich&#64;druidoo.io">ivan.todorovich&#64;druidoo.io</a>&gt;</li> <li>Iván Todorovich &lt;<a class="reference external" href="mailto:ivan.todorovich&#64;druidoo.io">ivan.todorovich&#64;druidoo.io</a>&gt;</li>
</ul> </ul>
</li> </li>
<li>Pierre Verkest &lt;<a class="reference external" href="mailto:pierreverkest84&#64;gmail.com">pierreverkest84&#64;gmail.com</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@ -433,7 +434,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-invoice-reporting/tree/12.0/base_comment_template">OCA/account-invoice-reporting</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template">OCA/reporting-engine</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@ -9,7 +9,7 @@ class TestResPartner(TransactionCase):
{ {
"name": "Comment before lines", "name": "Comment before lines",
"position": "before_lines", "position": "before_lines",
"text": "Text before lines", "text": "<p>Text before lines</p>",
} }
) )
@ -20,3 +20,18 @@ class TestResPartner(TransactionCase):
# Test childs propagation of commercial partner field # Test childs propagation of commercial partner field
for child_id in partner_id.child_ids: for child_id in partner_id.child_ids:
self.assertEqual(child_id.property_comment_template_id, self.template_id) self.assertEqual(child_id.property_comment_template_id, self.template_id)
def test_get_value_without_partner(self):
self.assertEqual(self.template_id.get_value(), "<p>Text before lines</p>")
def test_get_value_with_partner(self):
self.env["res.lang"]._activate_lang("fr_BE")
partner = self.env.ref("base.res_partner_12")
partner.write({"lang": "fr_BE"})
self.template_id.with_context(lang="fr_BE").write(
{"text": "<p>Testing translated fr_BE</p>"}
)
self.assertEqual(
self.template_id.get_value(partner_id=partner.id),
"<p>Testing translated fr_BE</p>",
)