diff --git a/base_comment_template/README.rst b/base_comment_template/README.rst index 5ee2ff53..16a15ad5 100644 --- a/base_comment_template/README.rst +++ b/base_comment_template/README.rst @@ -14,13 +14,13 @@ Base Comments Templates :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |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/12.0/base_comment_template + :target: https://github.com/OCA/account-invoice-reporting/tree/14.0/base_comment_template :alt: OCA/account-invoice-reporting .. |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 :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/94/12.0 + :target: https://runbot.odoo-community.org/runbot/94/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -50,7 +50,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. 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 promote its widespread use. -This module is part of the `OCA/account-invoice-reporting `_ project on GitHub. +This module is part of the `OCA/account-invoice-reporting `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_comment_template/__manifest__.py b/base_comment_template/__manifest__.py index 9dd125d0..f5408320 100644 --- a/base_comment_template/__manifest__.py +++ b/base_comment_template/__manifest__.py @@ -4,15 +4,13 @@ { "name": "Base Comments Templates", "summary": "Comments templates on documents", - "version": "12.0.3.0.0", + "version": "14.0.1.0.0", "category": "Sale", "website": "https://github.com/OCA/account-invoice-reporting", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", "installable": True, - "depends": [ - "base" - ], + "depends": ["base"], "data": [ "security/ir.model.access.csv", "security/security.xml", diff --git a/base_comment_template/i18n/base_comment_template.pot b/base_comment_template/i18n/base_comment_template.pot index 58386837..65b70a9b 100644 --- a/base_comment_template/i18n/base_comment_template.pot +++ b/base_comment_template/i18n/base_comment_template.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" diff --git a/base_comment_template/migrations/12.0.2.0.0/pre-migration.py b/base_comment_template/migrations/12.0.2.0.0/pre-migration.py deleted file mode 100644 index bccc1563..00000000 --- a/base_comment_template/migrations/12.0.2.0.0/pre-migration.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2020 Tecnativa - Pedro M. Baeza -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from openupgradelib import openupgrade - - -@openupgrade.migrate() -def migrate(env, version): - cr = env.cr - table = 'res_partner' - old_column = 'comment_template_id' - new_column = 'property_comment_template_id' - if openupgrade.column_exists(cr, table, old_column): - openupgrade.rename_columns(cr, {table: [(old_column, new_column)]}) diff --git a/base_comment_template/models/comment.py b/base_comment_template/models/comment.py index 6dec9062..f139c60e 100644 --- a/base_comment_template/models/comment.py +++ b/base_comment_template/models/comment.py @@ -2,7 +2,7 @@ # Copyright 2013-2014 Nicolas Bessi (Camptocamp SA) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models, fields, api +from odoo import fields, models class BaseCommentTemplate(models.Model): @@ -12,38 +12,37 @@ class BaseCommentTemplate(models.Model): active = fields.Boolean(default=True) name = fields.Char( - string='Comment summary', + string="Comment summary", required=True, ) position = fields.Selection( selection=[ - ('before_lines', 'Before lines'), - ('after_lines', 'After lines'), + ("before_lines", "Before lines"), + ("after_lines", "After lines"), ], required=True, - default='before_lines', + default="before_lines", help="Position on document", ) text = fields.Html( - string='Comment', + string="Comment", translate=True, required=True, ) company_id = fields.Many2one( - 'res.company', - string='Company', + "res.company", + string="Company", help="If set, it'll only be available for this company", - ondelete='cascade', + ondelete="cascade", index=True, ) - @api.multi def get_value(self, partner_id=False): self.ensure_one() lang = None if partner_id: - lang = self.env['res.partner'].browse(partner_id).lang - return self.with_context({'lang': lang}).text + lang = self.env["res.partner"].browse(partner_id).lang + return self.with_context({"lang": lang}).text diff --git a/base_comment_template/models/res_partner.py b/base_comment_template/models/res_partner.py index c2d04609..0a4cc9cc 100644 --- a/base_comment_template/models/res_partner.py +++ b/base_comment_template/models/res_partner.py @@ -7,13 +7,13 @@ class ResPartner(models.Model): _inherit = "res.partner" property_comment_template_id = fields.Many2one( - comodel_name='base.comment.template', - string='Conditions template', + comodel_name="base.comment.template", + string="Conditions template", company_dependent=True, ) @api.model def _commercial_fields(self): res = super(ResPartner, self)._commercial_fields() - res += ['property_comment_template_id'] + res += ["property_comment_template_id"] return res diff --git a/base_comment_template/readme/CONTRIBUTORS.rst b/base_comment_template/readme/CONTRIBUTORS.rst old mode 100755 new mode 100644 index e81ad442..22be356c --- a/base_comment_template/readme/CONTRIBUTORS.rst +++ b/base_comment_template/readme/CONTRIBUTORS.rst @@ -11,4 +11,4 @@ * `Druidoo `_: * Iván Todorovich - +* Pierre Verkest diff --git a/base_comment_template/readme/DESCRIPTION.rst b/base_comment_template/readme/DESCRIPTION.rst index 289173b4..291a014c 100755 --- a/base_comment_template/readme/DESCRIPTION.rst +++ b/base_comment_template/readme/DESCRIPTION.rst @@ -10,4 +10,3 @@ This module is the base module for following modules: * sale_comment_template * purchase_comment_template * invoice_comment_template - diff --git a/base_comment_template/security/security.xml b/base_comment_template/security/security.xml index 3fab3262..e8fa2692 100644 --- a/base_comment_template/security/security.xml +++ b/base_comment_template/security/security.xml @@ -1,11 +1,13 @@ - + Base comment multi-company - - - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] diff --git a/base_comment_template/tests/test_base_comment_template.py b/base_comment_template/tests/test_base_comment_template.py index c963c589..319fab33 100644 --- a/base_comment_template/tests/test_base_comment_template.py +++ b/base_comment_template/tests/test_base_comment_template.py @@ -3,20 +3,20 @@ from odoo.tests.common import TransactionCase class TestResPartner(TransactionCase): - def setUp(self): super(TestResPartner, self).setUp() - self.template_id = self.env['base.comment.template'].create({ - 'name': 'Comment before lines', - 'position': 'before_lines', - 'text': 'Text before lines', - }) + self.template_id = self.env["base.comment.template"].create( + { + "name": "Comment before lines", + "position": "before_lines", + "text": "Text before lines", + } + ) def test_commercial_partner_fields(self): # Azure Interior - partner_id = self.env.ref('base.res_partner_12') + partner_id = self.env.ref("base.res_partner_12") partner_id.property_comment_template_id = self.template_id.id # Test childs propagation of commercial partner field 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) diff --git a/base_comment_template/views/comment_view.xml b/base_comment_template/views/comment_view.xml index d33c4377..6f46d719 100644 --- a/base_comment_template/views/comment_view.xml +++ b/base_comment_template/views/comment_view.xml @@ -1,4 +1,4 @@ - + @@ -6,9 +6,9 @@ base.comment.template - - - + + + @@ -20,26 +20,42 @@
-

- +

- + - + - +
@@ -50,12 +66,12 @@ account.comment.template.list base.comment.template - + - - - + + + @@ -64,9 +80,8 @@ Comment Templates ir.actions.act_window base.comment.template - form tree,form - + diff --git a/base_comment_template/views/res_partner.xml b/base_comment_template/views/res_partner.xml index d12cc53a..09541c0f 100644 --- a/base_comment_template/views/res_partner.xml +++ b/base_comment_template/views/res_partner.xml @@ -2,11 +2,14 @@ res.partner - - + + - +