From 0011afef81eeeb8793019cbf706832f9ca225c3a Mon Sep 17 00:00:00 2001 From: CristianoMafraJunior Date: Mon, 14 Oct 2024 15:13:16 -0300 Subject: [PATCH 1/2] [ADD] eng_customer_fiscal_comments: customer fiscal comments --- eng_customer_fiscal_comments/__init__.py | 1 + eng_customer_fiscal_comments/__manifest__.py | 23 +++++++++ eng_customer_fiscal_comments/i18n/pt_BR.po | 50 +++++++++++++++++++ .../models/__init__.py | 2 + .../models/document_mixin_methods.py | 13 +++++ .../models/res_partner.py | 7 +++ .../views/res_partner_views.xml | 15 ++++++ 7 files changed, 111 insertions(+) create mode 100644 eng_customer_fiscal_comments/__init__.py create mode 100644 eng_customer_fiscal_comments/__manifest__.py create mode 100644 eng_customer_fiscal_comments/i18n/pt_BR.po create mode 100644 eng_customer_fiscal_comments/models/__init__.py create mode 100644 eng_customer_fiscal_comments/models/document_mixin_methods.py create mode 100644 eng_customer_fiscal_comments/models/res_partner.py create mode 100644 eng_customer_fiscal_comments/views/res_partner_views.xml diff --git a/eng_customer_fiscal_comments/__init__.py b/eng_customer_fiscal_comments/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/eng_customer_fiscal_comments/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/eng_customer_fiscal_comments/__manifest__.py b/eng_customer_fiscal_comments/__manifest__.py new file mode 100644 index 000000000..04b63107b --- /dev/null +++ b/eng_customer_fiscal_comments/__manifest__.py @@ -0,0 +1,23 @@ +{ + "name": "Customer Fiscal Comments ", + "summary": """ + The Customer Fiscal Comments module enables users + to add tax-related comments to customer profiles, + which are displayed on invoices for better compliance. + """, + "license": "AGPL-3", + "author": "Engenere", + "maintainers": ["cristianomafrajunior"], + "website": "https://engenere.one", + "category": "Services/Industry", + "version": "14.0.1.0.0", + "development_status": "Beta", + "depends": [ + "account", + "l10n_br_nfe", + ], + "data": [ + "views/res_partner_views.xml", + ], + "installable": True, +} diff --git a/eng_customer_fiscal_comments/i18n/pt_BR.po b/eng_customer_fiscal_comments/i18n/pt_BR.po new file mode 100644 index 000000000..d131ab1c3 --- /dev/null +++ b/eng_customer_fiscal_comments/i18n/pt_BR.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * eng_customer_fiscal_comments +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-14 20:17+0000\n" +"PO-Revision-Date: 2024-10-14 20:17+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: eng_customer_fiscal_comments +#: model:ir.model,name:eng_customer_fiscal_comments.model_res_partner +msgid "Contact" +msgstr "Contato" + +#. module: eng_customer_fiscal_comments +#: model:ir.model.fields,field_description:eng_customer_fiscal_comments.field_l10n_br_fiscal_document_mixin_methods__display_name +#: model:ir.model.fields,field_description:eng_customer_fiscal_comments.field_res_partner__display_name +msgid "Display Name" +msgstr "Nome de exibição" + +#. module: eng_customer_fiscal_comments +#: model:ir.model.fields,field_description:eng_customer_fiscal_comments.field_res_partner__fiscal_comments +#: model:ir.model.fields,field_description:eng_customer_fiscal_comments.field_res_users__fiscal_comments +msgid "Fiscal Comments" +msgstr "Comentários Fiscais" + +#. module: eng_customer_fiscal_comments +#: model:ir.model,name:eng_customer_fiscal_comments.model_l10n_br_fiscal_document_mixin_methods +msgid "Fiscal Document Mixin Methods" +msgstr "" + +#. module: eng_customer_fiscal_comments +#: model:ir.model.fields,field_description:eng_customer_fiscal_comments.field_l10n_br_fiscal_document_mixin_methods__id +#: model:ir.model.fields,field_description:eng_customer_fiscal_comments.field_res_partner__id +msgid "ID" +msgstr "ID" + +#. module: eng_customer_fiscal_comments +#: model:ir.model.fields,field_description:eng_customer_fiscal_comments.field_l10n_br_fiscal_document_mixin_methods____last_update +#: model:ir.model.fields,field_description:eng_customer_fiscal_comments.field_res_partner____last_update +msgid "Last Modified on" +msgstr "Última atualização em" diff --git a/eng_customer_fiscal_comments/models/__init__.py b/eng_customer_fiscal_comments/models/__init__.py new file mode 100644 index 000000000..aaa18bdd0 --- /dev/null +++ b/eng_customer_fiscal_comments/models/__init__.py @@ -0,0 +1,2 @@ +from . import res_partner +from . import document_mixin_methods diff --git a/eng_customer_fiscal_comments/models/document_mixin_methods.py b/eng_customer_fiscal_comments/models/document_mixin_methods.py new file mode 100644 index 000000000..61993e557 --- /dev/null +++ b/eng_customer_fiscal_comments/models/document_mixin_methods.py @@ -0,0 +1,13 @@ +from odoo import models + + +class DocumentMixinMethods(models.AbstractModel): + _inherit = "l10n_br_fiscal.document.mixin.methods" + + def _document_comment(self): + for d in self: + if d.partner_id: + d.manual_fiscal_additional_data = d.partner_id.fiscal_comments + super()._document_comment() + else: + d.manual_fiscal_additional_data = False diff --git a/eng_customer_fiscal_comments/models/res_partner.py b/eng_customer_fiscal_comments/models/res_partner.py new file mode 100644 index 000000000..251ed540a --- /dev/null +++ b/eng_customer_fiscal_comments/models/res_partner.py @@ -0,0 +1,7 @@ +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + fiscal_comments = fields.Text() diff --git a/eng_customer_fiscal_comments/views/res_partner_views.xml b/eng_customer_fiscal_comments/views/res_partner_views.xml new file mode 100644 index 000000000..715970741 --- /dev/null +++ b/eng_customer_fiscal_comments/views/res_partner_views.xml @@ -0,0 +1,15 @@ + + + res.partner.property.form.inherit + res.partner + + + + + + + + From 0e2d76891a16a1057998c8265cc27776def2aae0 Mon Sep 17 00:00:00 2001 From: CristianoMafraJunior Date: Mon, 3 Feb 2025 16:13:59 -0300 Subject: [PATCH 2/2] [MIG] eng_customer_fiscal_comments: Migration to 16.0 --- eng_customer_fiscal_comments/README.rst | 65 +++ eng_customer_fiscal_comments/__manifest__.py | 9 +- .../models/document_mixin_methods.py | 2 +- eng_customer_fiscal_comments/pyproject.toml | 3 + .../readme/DESCRIPTION.md | 2 + .../static/description/index.html | 412 ++++++++++++++++++ .../tests/__init__.py | 1 + .../tests/test_document_comment.py | 19 + .../views/res_partner_views.xml | 6 +- 9 files changed, 509 insertions(+), 10 deletions(-) create mode 100644 eng_customer_fiscal_comments/README.rst create mode 100644 eng_customer_fiscal_comments/pyproject.toml create mode 100644 eng_customer_fiscal_comments/readme/DESCRIPTION.md create mode 100644 eng_customer_fiscal_comments/static/description/index.html create mode 100644 eng_customer_fiscal_comments/tests/__init__.py create mode 100644 eng_customer_fiscal_comments/tests/test_document_comment.py diff --git a/eng_customer_fiscal_comments/README.rst b/eng_customer_fiscal_comments/README.rst new file mode 100644 index 000000000..684ae041b --- /dev/null +++ b/eng_customer_fiscal_comments/README.rst @@ -0,0 +1,65 @@ +========================= +Customer Fiscal Comments +========================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:8af292f2a25c59deaeac4397f8d0f9f07118825d592ad0879bc13553244fbcc8 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-Engenere%2Fengenere--addons-lightgray.png?logo=github + :target: https://github.com/Engenere/engenere-addons/tree/16.0/eng_customer_fiscal_comments + :alt: Engenere/engenere-addons + +|badge1| |badge2| |badge3| + +Este módulo permite que os usuários adicionem comentários relacionados a +impostos aos perfis dos clientes, os quais são exibidos nas faturas e +nas NFe. + +**Table of contents** + +.. contents:: + :local: + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Engenere + +Maintainers +----------- + +.. |maintainer-cristianomafrajunior| image:: https://github.com/cristianomafrajunior.png?size=40px + :target: https://github.com/cristianomafrajunior + :alt: cristianomafrajunior + +Current maintainer: + +|maintainer-cristianomafrajunior| + +This module is part of the `Engenere/engenere-addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/eng_customer_fiscal_comments/__manifest__.py b/eng_customer_fiscal_comments/__manifest__.py index 04b63107b..0c979ffa4 100644 --- a/eng_customer_fiscal_comments/__manifest__.py +++ b/eng_customer_fiscal_comments/__manifest__.py @@ -8,14 +8,11 @@ "license": "AGPL-3", "author": "Engenere", "maintainers": ["cristianomafrajunior"], - "website": "https://engenere.one", + "website": "https://github.com/Engenere/engenere-addons", "category": "Services/Industry", - "version": "14.0.1.0.0", + "version": "16.0.1.0.0", "development_status": "Beta", - "depends": [ - "account", - "l10n_br_nfe", - ], + "depends": ["account", "l10n_br_fiscal"], "data": [ "views/res_partner_views.xml", ], diff --git a/eng_customer_fiscal_comments/models/document_mixin_methods.py b/eng_customer_fiscal_comments/models/document_mixin_methods.py index 61993e557..2f3110b70 100644 --- a/eng_customer_fiscal_comments/models/document_mixin_methods.py +++ b/eng_customer_fiscal_comments/models/document_mixin_methods.py @@ -8,6 +8,6 @@ def _document_comment(self): for d in self: if d.partner_id: d.manual_fiscal_additional_data = d.partner_id.fiscal_comments - super()._document_comment() else: d.manual_fiscal_additional_data = False + return super()._document_comment() diff --git a/eng_customer_fiscal_comments/pyproject.toml b/eng_customer_fiscal_comments/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/eng_customer_fiscal_comments/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/eng_customer_fiscal_comments/readme/DESCRIPTION.md b/eng_customer_fiscal_comments/readme/DESCRIPTION.md new file mode 100644 index 000000000..dbbc5a572 --- /dev/null +++ b/eng_customer_fiscal_comments/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ + +Este módulo permite que os usuários adicionem comentários relacionados a impostos aos perfis dos clientes, os quais são exibidos nas faturas e nas NFe. diff --git a/eng_customer_fiscal_comments/static/description/index.html b/eng_customer_fiscal_comments/static/description/index.html new file mode 100644 index 000000000..8fc32da17 --- /dev/null +++ b/eng_customer_fiscal_comments/static/description/index.html @@ -0,0 +1,412 @@ + + + + + +Customer Fiscal Comments + + + +
+

Customer Fiscal Comments

+ + +

Beta License: AGPL-3 Engenere/engenere-addons

+

Este módulo permite que os usuários adicionem comentários relacionados a +impostos aos perfis dos clientes, os quais são exibidos nas faturas e +nas NFe.

+

Table of contents

+ +
+

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 to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Engenere
  • +
+
+
+

Maintainers

+

Current maintainer:

+

cristianomafrajunior

+

This module is part of the Engenere/engenere-addons project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/eng_customer_fiscal_comments/tests/__init__.py b/eng_customer_fiscal_comments/tests/__init__.py new file mode 100644 index 000000000..c0835d9a6 --- /dev/null +++ b/eng_customer_fiscal_comments/tests/__init__.py @@ -0,0 +1 @@ +from . import test_document_comment diff --git a/eng_customer_fiscal_comments/tests/test_document_comment.py b/eng_customer_fiscal_comments/tests/test_document_comment.py new file mode 100644 index 000000000..f191a7722 --- /dev/null +++ b/eng_customer_fiscal_comments/tests/test_document_comment.py @@ -0,0 +1,19 @@ +from odoo.tests.common import TransactionCase + + +class TestDocumentComment(TransactionCase): + def setUp(self): + super().setUp() + self.partner = self.env["res.partner"].create( + {"name": "Test Client", "fiscal_comments": "Comentário fiscal teste"} + ) + self.document = self.env["l10n_br_fiscal.document"].create( + {"partner_id": self.partner.id} + ) + + def test_document_comment(self): + self.document._document_comment() + self.assertEqual( + self.document.manual_fiscal_additional_data, + "Comentário fiscal teste", + ) diff --git a/eng_customer_fiscal_comments/views/res_partner_views.xml b/eng_customer_fiscal_comments/views/res_partner_views.xml index 715970741..d4ba6f2c6 100644 --- a/eng_customer_fiscal_comments/views/res_partner_views.xml +++ b/eng_customer_fiscal_comments/views/res_partner_views.xml @@ -5,9 +5,9 @@ + expr="//field[@name='property_account_position_id']" + position="after" + >