Browse Source

[MIG] base_comment_template: Migration to 14.0 add unit test

myc-14.0-py3o
Pierre Verkest 4 years ago
parent
commit
8b0cc159e2
  1. 12
      base_comment_template/README.rst
  2. 2
      base_comment_template/__manifest__.py
  3. 2
      base_comment_template/models/comment.py
  4. 1
      base_comment_template/readme/CONTRIBUTORS.rst
  5. 1
      base_comment_template/readme/DESCRIPTION.rst
  6. 1014
      base_comment_template/static/description/index.html
  7. 17
      base_comment_template/tests/test_base_comment_template.py
  8. 1
      setup/base_comment_template/odoo/addons/base_comment_template
  9. 6
      setup/base_comment_template/setup.py

12
base_comment_template/README.rst

@ -14,10 +14,10 @@ Base Comments Templates
: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%2Faccount--invoice--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoice-reporting/tree/14.0/base_comment_template
:alt: OCA/account-invoice-reporting
:target: https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template
: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-12-0/reporting-engine-12-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/94/14.0
@ -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.
@ -93,6 +93,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.

2
base_comment_template/__manifest__.py

@ -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,

2
base_comment_template/models/comment.py

@ -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

1
base_comment_template/readme/CONTRIBUTORS.rst

@ -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>

1
base_comment_template/readme/DESCRIPTION.rst

@ -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

1014
base_comment_template/static/description/index.html
File diff suppressed because it is too large
View File

17
base_comment_template/tests/test_base_comment_template.py

@ -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>",
)

1
setup/base_comment_template/odoo/addons/base_comment_template

@ -0,0 +1 @@
../../../../base_comment_template

6
setup/base_comment_template/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save