diff --git a/agreement_account/README.rst b/agreement_account/README.rst new file mode 100644 index 00000000..6df0eac8 --- /dev/null +++ b/agreement_account/README.rst @@ -0,0 +1,88 @@ +================= +Agreement Account +================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d458d0727ff574f7c7eed6da2751d9674f63580d2b2c0b737234b7caff1a8a4a + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-OCA%2Fagreement-lightgray.png?logo=github + :target: https://github.com/OCA/agreement/tree/17.0/agreement_account + :alt: OCA/agreement +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/agreement-17-0/agreement-17-0-agreement_account + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/agreement&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds *Agreement* field on invoices. + +**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 +------- + +* Akretion + +Contributors +------------ + +- Alexis de Lattre +- Italo LOPES + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-alexis-via| image:: https://github.com/alexis-via.png?size=40px + :target: https://github.com/alexis-via + :alt: alexis-via +.. |maintainer-bealdav| image:: https://github.com/bealdav.png?size=40px + :target: https://github.com/bealdav + :alt: bealdav + +Current `maintainers `__: + +|maintainer-alexis-via| |maintainer-bealdav| + +This module is part of the `OCA/agreement `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/agreement_account/__init__.py b/agreement_account/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/agreement_account/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/agreement_account/__manifest__.py b/agreement_account/__manifest__.py new file mode 100644 index 00000000..a7d2c1d8 --- /dev/null +++ b/agreement_account/__manifest__.py @@ -0,0 +1,28 @@ +# Copyright 2017-2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Agreement Account", + "summary": "Agreement on invoices", + "version": "17.0.1.0.0", + "category": "Contract", + "author": "Akretion, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/agreement", + "license": "AGPL-3", + "depends": [ + "agreement", + "account", + ], + "data": [ + "security/ir.model.access.csv", + "views/agreement.xml", + "views/account_move.xml", + ], + "development_status": "Beta", + "maintainers": [ + "alexis-via", + "bealdav", + ], + "installable": True, +} diff --git a/agreement_account/i18n/agreement_account.pot b/agreement_account/i18n/agreement_account.pot new file mode 100644 index 00000000..12dcbe1a --- /dev/null +++ b/agreement_account/i18n/agreement_account.pot @@ -0,0 +1,73 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * agreement_account +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \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: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_agreement__out_invoice_count +msgid "# of Customer Invoices" +msgstr "" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_agreement__in_invoice_count +msgid "# of Vendor Bills" +msgstr "" + +#. module: agreement_account +#: model:ir.model,name:agreement_account.model_agreement +#: model:ir.model.fields,field_description:agreement_account.field_account_bank_statement_line__agreement_id +#: model:ir.model.fields,field_description:agreement_account.field_account_move__agreement_id +#: model:ir.model.fields,field_description:agreement_account.field_account_payment__agreement_id +#: model_terms:ir.ui.view,arch_db:agreement_account.view_account_invoice_filter +msgid "Agreement" +msgstr "" + +#. module: agreement_account +#: model:ir.ui.menu,name:agreement_account.agreement_type_menu +msgid "Agreement Types" +msgstr "" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_account_move__display_name +#: model:ir.model.fields,field_description:agreement_account.field_agreement__display_name +msgid "Display Name" +msgstr "" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_account_move__id +#: model:ir.model.fields,field_description:agreement_account.field_agreement__id +msgid "ID" +msgstr "" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_agreement__invoice_ids +#: model_terms:ir.ui.view,arch_db:agreement_account.agreement_form +msgid "Invoices" +msgstr "" + +#. module: agreement_account +#: model:ir.model,name:agreement_account.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_account_move____last_update +#: model:ir.model.fields,field_description:agreement_account.field_agreement____last_update +msgid "Last Modified on" +msgstr "" + +#. module: agreement_account +#: model:ir.actions.act_window,name:agreement_account.account_invoice_in_invoice_refund_action +#: model_terms:ir.ui.view,arch_db:agreement_account.agreement_form +msgid "Vendor Bills" +msgstr "" diff --git a/agreement_account/i18n/es.po b/agreement_account/i18n/es.po new file mode 100644 index 00000000..09468b9d --- /dev/null +++ b/agreement_account/i18n/es.po @@ -0,0 +1,76 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * agreement_account +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-12-19 13:33+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_agreement__out_invoice_count +msgid "# of Customer Invoices" +msgstr "# de Facturas de Cliente" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_agreement__in_invoice_count +msgid "# of Vendor Bills" +msgstr "# de Facturas de Proveedores" + +#. module: agreement_account +#: model:ir.model,name:agreement_account.model_agreement +#: model:ir.model.fields,field_description:agreement_account.field_account_bank_statement_line__agreement_id +#: model:ir.model.fields,field_description:agreement_account.field_account_move__agreement_id +#: model:ir.model.fields,field_description:agreement_account.field_account_payment__agreement_id +#: model_terms:ir.ui.view,arch_db:agreement_account.view_account_invoice_filter +msgid "Agreement" +msgstr "Acuerdo" + +#. module: agreement_account +#: model:ir.ui.menu,name:agreement_account.agreement_type_menu +msgid "Agreement Types" +msgstr "Tipos de Acuerdo" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_account_move__display_name +#: model:ir.model.fields,field_description:agreement_account.field_agreement__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_account_move__id +#: model:ir.model.fields,field_description:agreement_account.field_agreement__id +msgid "ID" +msgstr "ID (identificación)" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_agreement__invoice_ids +#: model_terms:ir.ui.view,arch_db:agreement_account.agreement_form +msgid "Invoices" +msgstr "Facturas" + +#. module: agreement_account +#: model:ir.model,name:agreement_account.model_account_move +msgid "Journal Entry" +msgstr "Entrada en Diario" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_account_move____last_update +#: model:ir.model.fields,field_description:agreement_account.field_agreement____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: agreement_account +#: model:ir.actions.act_window,name:agreement_account.account_invoice_in_invoice_refund_action +#: model_terms:ir.ui.view,arch_db:agreement_account.agreement_form +msgid "Vendor Bills" +msgstr "Facturas de Vendedor" diff --git a/agreement_account/i18n/es_AR.po b/agreement_account/i18n/es_AR.po new file mode 100644 index 00000000..8b5ca842 --- /dev/null +++ b/agreement_account/i18n/es_AR.po @@ -0,0 +1,76 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * agreement_account +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-02-06 20:59+0000\n" +"Last-Translator: Ignacio Buioli \n" +"Language-Team: none\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_agreement__out_invoice_count +msgid "# of Customer Invoices" +msgstr "# de Facturas de Cliente" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_agreement__in_invoice_count +msgid "# of Vendor Bills" +msgstr "# de Facturas de Proveedores" + +#. module: agreement_account +#: model:ir.model,name:agreement_account.model_agreement +#: model:ir.model.fields,field_description:agreement_account.field_account_bank_statement_line__agreement_id +#: model:ir.model.fields,field_description:agreement_account.field_account_move__agreement_id +#: model:ir.model.fields,field_description:agreement_account.field_account_payment__agreement_id +#: model_terms:ir.ui.view,arch_db:agreement_account.view_account_invoice_filter +msgid "Agreement" +msgstr "Acuerdo" + +#. module: agreement_account +#: model:ir.ui.menu,name:agreement_account.agreement_type_menu +msgid "Agreement Types" +msgstr "Tipos de Acuerdo" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_account_move__display_name +#: model:ir.model.fields,field_description:agreement_account.field_agreement__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_account_move__id +#: model:ir.model.fields,field_description:agreement_account.field_agreement__id +msgid "ID" +msgstr "ID" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_agreement__invoice_ids +#: model_terms:ir.ui.view,arch_db:agreement_account.agreement_form +msgid "Invoices" +msgstr "Facturas" + +#. module: agreement_account +#: model:ir.model,name:agreement_account.model_account_move +msgid "Journal Entry" +msgstr "Apunte Contable" + +#. module: agreement_account +#: model:ir.model.fields,field_description:agreement_account.field_account_move____last_update +#: model:ir.model.fields,field_description:agreement_account.field_agreement____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: agreement_account +#: model:ir.actions.act_window,name:agreement_account.account_invoice_in_invoice_refund_action +#: model_terms:ir.ui.view,arch_db:agreement_account.agreement_form +msgid "Vendor Bills" +msgstr "Facturas de Proveedores" diff --git a/agreement_account/models/__init__.py b/agreement_account/models/__init__.py new file mode 100644 index 00000000..77c03597 --- /dev/null +++ b/agreement_account/models/__init__.py @@ -0,0 +1,2 @@ +from . import account_move +from . import agreement diff --git a/agreement_account/models/account_move.py b/agreement_account/models/account_move.py new file mode 100644 index 00000000..7d9dc8bf --- /dev/null +++ b/agreement_account/models/account_move.py @@ -0,0 +1,18 @@ +# Copyright 2017-2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import fields, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + agreement_id = fields.Many2one( + comodel_name="agreement", + string="Agreement", + ondelete="restrict", + tracking=True, + copy=False, + ) diff --git a/agreement_account/models/agreement.py b/agreement_account/models/agreement.py new file mode 100644 index 00000000..80922845 --- /dev/null +++ b/agreement_account/models/agreement.py @@ -0,0 +1,39 @@ +# Copyright 2017-2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import fields, models + + +class Agreement(models.Model): + _inherit = "agreement" + + invoice_ids = fields.One2many( + "account.move", "agreement_id", string="Invoices", readonly=True + ) + out_invoice_count = fields.Integer( + compute="_compute_invoice_count", string="# of Customer Invoices" + ) + in_invoice_count = fields.Integer( + compute="_compute_invoice_count", string="# of Vendor Bills" + ) + + def _compute_invoice_count(self): + base_domain = [("agreement_id", "in", self.ids)] + aio = self.env["account.move"] + out_rg_res = aio.read_group( + base_domain + [("move_type", "in", ("out_invoice", "out_refund"))], + ["agreement_id"], + ["agreement_id"], + ) + out_data = {x["agreement_id"][0]: x["agreement_id_count"] for x in out_rg_res} + in_rg_res = aio.read_group( + base_domain + [("move_type", "in", ("in_invoice", "in_refund"))], + ["agreement_id"], + ["agreement_id"], + ) + in_data = {x["agreement_id"][0]: x["agreement_id_count"] for x in in_rg_res} + for agreement in self: + agreement.out_invoice_count = out_data.get(agreement.id, 0) + agreement.in_invoice_count = in_data.get(agreement.id, 0) diff --git a/agreement_account/pyproject.toml b/agreement_account/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/agreement_account/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/agreement_account/readme/CONTRIBUTORS.md b/agreement_account/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..f3e85da2 --- /dev/null +++ b/agreement_account/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Alexis de Lattre \<\> +- Italo LOPES \<\> diff --git a/agreement_account/readme/DESCRIPTION.md b/agreement_account/readme/DESCRIPTION.md new file mode 100644 index 00000000..18e63adc --- /dev/null +++ b/agreement_account/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module adds *Agreement* field on invoices. diff --git a/agreement_account/security/ir.model.access.csv b/agreement_account/security/ir.model.access.csv new file mode 100644 index 00000000..c1b7f487 --- /dev/null +++ b/agreement_account/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_agreement_full,Full access on agreement to Financial mgr,agreement.model_agreement,account.group_account_manager,1,1,1,1 +access_agreement_type_full,Full access on agreement type to Financial mgr,agreement.model_agreement_type,account.group_account_manager,1,1,1,1 diff --git a/agreement_account/static/description/icon.png b/agreement_account/static/description/icon.png new file mode 100644 index 00000000..a99cce6b Binary files /dev/null and b/agreement_account/static/description/icon.png differ diff --git a/agreement_account/static/description/index.html b/agreement_account/static/description/index.html new file mode 100644 index 00000000..5b5a647e --- /dev/null +++ b/agreement_account/static/description/index.html @@ -0,0 +1,423 @@ + + + + + +Agreement Account + + + +
+

Agreement Account

+ + +

Beta License: AGPL-3 OCA/agreement Translate me on Weblate Try me on Runboat

+

This module adds Agreement field on invoices.

+

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

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainers:

+

alexis-via bealdav

+

This module is part of the OCA/agreement project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/agreement_account/tests/__init__.py b/agreement_account/tests/__init__.py new file mode 100644 index 00000000..b636caa9 --- /dev/null +++ b/agreement_account/tests/__init__.py @@ -0,0 +1 @@ +from . import test_agreement diff --git a/agreement_account/tests/test_agreement.py b/agreement_account/tests/test_agreement.py new file mode 100644 index 00000000..9a2982da --- /dev/null +++ b/agreement_account/tests/test_agreement.py @@ -0,0 +1,31 @@ +# Copyright 2017-2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestAgreement(TransactionCase): + def setUp(self): + super().setUp() + self.test_customer = self.env["res.partner"].create({"name": "TestCustomer"}) + self.test_agreement_sale = self.env["agreement"].create( + { + "name": "TestAgreement-Sale", + "code": "SALE", + "partner_id": self.test_customer.id, + "domain": "sale", + } + ) + self.test_agreement_purchase = self.env["agreement"].create( + { + "name": "TestAgreement-Purchase", + "code": "PURCHASE", + "partner_id": self.test_customer.id, + "domain": "purchase", + } + ) + + def test_compute_invoice_count(self): + self.test_agreement_sale._compute_invoice_count() + self.test_agreement_purchase._compute_invoice_count() diff --git a/agreement_account/views/account_move.xml b/agreement_account/views/account_move.xml new file mode 100644 index 00000000..a397b9bb --- /dev/null +++ b/agreement_account/views/account_move.xml @@ -0,0 +1,59 @@ + + + + + agreement.customer.invoice.form + account.move + + + + + + + + + + + agreement.supplier.invoice.form + account.move + + + + + + + + + + agreement.account.move.search + account.move + + + + + + + + + + + + diff --git a/agreement_account/views/agreement.xml b/agreement_account/views/agreement.xml new file mode 100644 index 00000000..1b34ca87 --- /dev/null +++ b/agreement_account/views/agreement.xml @@ -0,0 +1,86 @@ + + + + + 150 + + + + + + Vendor Bills + account.move + tree,form + [('move_type','in', ('in_invoice', 'in_refund')), ('state', 'not in', ('draft', 'cancel'))] + {'default_type': 'in_invoice', 'move_type': 'in_invoice', 'journal_type': 'purchase'} + + + + + tree + + + + + + + form + + + + + + invoice.button.agreement.form + agreement + + +
+ + +
+
+
+ +
diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..5124c48d --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-agreement @ git+https://github.com/OCA/agreement.git@refs/pull/35/head#subdirectory=agreement