diff --git a/contract_invoice_auto_post/README.rst b/contract_invoice_auto_post/README.rst new file mode 100644 index 00000000000..870c4315be0 --- /dev/null +++ b/contract_invoice_auto_post/README.rst @@ -0,0 +1,86 @@ +========================== +Contract Invoice Auto Post +========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fcontract-lightgray.png?logo=github + :target: https://github.com/OCA/contract/tree/16.0/contract_invoice_auto_post + :alt: OCA/contract +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_invoice_auto_post + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/110/16.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module gets the value of the auto post variable in client contract and it +automatically transfers the value of the variable to the invoice. Moreover, +it will check periodically the status of this value and will confirm the +invoice when it is programed to happen. + +**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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Xtendoo + +Contributors +~~~~~~~~~~~~ + +* `Xtendoo `_: + + * Carlos Camacho + +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-florian-dacosta| image:: https://github.com/florian-dacosta.png?size=40px + :target: https://github.com/florian-dacosta + :alt: florian-dacosta + +Current `maintainer `__: + +|maintainer-florian-dacosta| + +This module is part of the `OCA/contract `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/contract_invoice_auto_post/__init__.py b/contract_invoice_auto_post/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/contract_invoice_auto_post/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/contract_invoice_auto_post/__manifest__.py b/contract_invoice_auto_post/__manifest__.py new file mode 100644 index 00000000000..cc0d141320f --- /dev/null +++ b/contract_invoice_auto_post/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2019-2020 Akretion France (http://www.akretion.com/) +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + "name": "Contract Invoice Auto Post", + "version": "16.0.1.0.0", + "category": "Contract Management", + "author": "Xtendoo, Odoo Community Association (OCA)", + "maintainers": ["florian-dacosta"], + "website": "https://github.com/OCA/contract", + "depends": [ + "contract", + ], + "data": [ + "views/contract_view.xml", + ], + "license": "AGPL-3", + "installable": True, +} diff --git a/contract_invoice_auto_post/i18n/contract_invoice_auto_post.pot b/contract_invoice_auto_post/i18n/contract_invoice_auto_post.pot new file mode 100644 index 00000000000..4fa3ec702c2 --- /dev/null +++ b/contract_invoice_auto_post/i18n/contract_invoice_auto_post.pot @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_invoice_auto_post +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-10-24 12:23+0000\n" +"PO-Revision-Date: 2023-10-24 12:23+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: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__at_date +msgid "At Date" +msgstr "" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields,field_description:contract_invoice_auto_post.field_contract_contract__auto_post +msgid "Auto-post" +msgstr "" + +#. module: contract_invoice_auto_post +#: model:ir.model,name:contract_invoice_auto_post.model_contract_contract +msgid "Contract" +msgstr "" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__monthly +msgid "Monthly" +msgstr "" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__no +msgid "No" +msgstr "" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__quarterly +msgid "Quarterly" +msgstr "" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields,help:contract_invoice_auto_post.field_contract_contract__auto_post +msgid "" +"Specify whether this entry is posted automatically on its accounting date, " +"and any similar recurring invoices." +msgstr "" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__yearly +msgid "Yearly" +msgstr "" diff --git a/contract_invoice_auto_post/i18n/es.po b/contract_invoice_auto_post/i18n/es.po new file mode 100644 index 00000000000..5c03ed08c12 --- /dev/null +++ b/contract_invoice_auto_post/i18n/es.po @@ -0,0 +1,60 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_invoice_auto_post +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-10-24 12:23+0000\n" +"PO-Revision-Date: 2023-10-24 12:23+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: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__at_date +msgid "At Date" +msgstr "En fecha" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields,field_description:contract_invoice_auto_post.field_contract_contract__auto_post +msgid "Auto-post" +msgstr "Publicar automáticamente" + +#. module: contract_invoice_auto_post +#: model:ir.model,name:contract_invoice_auto_post.model_contract_contract +msgid "Contract" +msgstr "Contrato" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__monthly +msgid "Monthly" +msgstr "Mensual" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__no +msgid "No" +msgstr "" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__quarterly +msgid "Quarterly" +msgstr "Trimestralmente" + +#. module: contract_invoice_auto_post +#: model:ir.model.fields,help:contract_invoice_auto_post.field_contract_contract__auto_post +msgid "" +"Specify whether this entry is posted automatically on its accounting date, " +"and any similar recurring invoices." +msgstr "" +"Indica si esta entrada se contabiliza automáticamente en su fecha contable " +"y en facturas recurrentes similares." + +#. module: contract_invoice_auto_post +#: model:ir.model.fields.selection,name:contract_invoice_auto_post.selection__contract_contract__auto_post__yearly +msgid "Yearly" +msgstr "Anualmente" diff --git a/contract_invoice_auto_post/models/__init__.py b/contract_invoice_auto_post/models/__init__.py new file mode 100644 index 00000000000..99a5468ac8a --- /dev/null +++ b/contract_invoice_auto_post/models/__init__.py @@ -0,0 +1 @@ +from . import contract diff --git a/contract_invoice_auto_post/models/contract.py b/contract_invoice_auto_post/models/contract.py new file mode 100644 index 00000000000..d779098e17d --- /dev/null +++ b/contract_invoice_auto_post/models/contract.py @@ -0,0 +1,35 @@ +# Copyright 2019-2020 Akretion France (http://www.akretion.com/) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ContractContract(models.Model): + _inherit = "contract.contract" + + auto_post = fields.Selection( + string="Auto-post", + selection=[ + ("no", "No"), + ("at_date", "At Date"), + ("monthly", "Monthly"), + ("quarterly", "Quarterly"), + ("yearly", "Yearly"), + ], + default="no", + required=True, + copy=False, + help="Specify whether this entry is posted automatically on its accounting date, and any similar recurring invoices.", + ) + + def _prepare_invoice(self, date_invoice, journal=None): + invoice_vals = super()._prepare_invoice( + date_invoice=date_invoice, journal=journal + ) + if self.auto_post: + invoice_vals.update( + { + "auto_post": self.auto_post, + } + ) + return invoice_vals diff --git a/contract_invoice_auto_post/readme/CONTRIBUTORS.rst b/contract_invoice_auto_post/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..a4a9063fd2e --- /dev/null +++ b/contract_invoice_auto_post/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Xtendoo `_: + + * Carlos Camacho diff --git a/contract_invoice_auto_post/readme/DESCRIPTION.rst b/contract_invoice_auto_post/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..32deeda0ba7 --- /dev/null +++ b/contract_invoice_auto_post/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module gets the value of the auto post variable in client contract and it +automatically transfers the value of the variable to the invoice. Moreover, +it will check periodically the status of this value and will confirm the +invoice when it is programed to happen. diff --git a/contract_invoice_auto_post/static/description/icon.png b/contract_invoice_auto_post/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/contract_invoice_auto_post/static/description/icon.png differ diff --git a/contract_invoice_auto_post/static/description/index.html b/contract_invoice_auto_post/static/description/index.html new file mode 100644 index 00000000000..9523a694371 --- /dev/null +++ b/contract_invoice_auto_post/static/description/index.html @@ -0,0 +1,427 @@ + + + + + + +Contract Invoice Auto Post + + + +
+

Contract Invoice Auto Post

+ + +

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runbot

+

This module gets the value of the auto post variable in client contract and it +automatically transfers the value of the variable to the invoice. Moreover, +it will check periodically the status of this value and will confirm the +invoice when it is programed to happen.

+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Xtendoo
  • +
+
+
+

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 maintainer:

+

florian-dacosta

+

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

+

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

+
+
+
+ + diff --git a/contract_invoice_auto_post/tests/__init__.py b/contract_invoice_auto_post/tests/__init__.py new file mode 100644 index 00000000000..be68bbb92eb --- /dev/null +++ b/contract_invoice_auto_post/tests/__init__.py @@ -0,0 +1 @@ +from . import test_contract_invoice_auto_post diff --git a/contract_invoice_auto_post/tests/test_contract_invoice_auto_post.py b/contract_invoice_auto_post/tests/test_contract_invoice_auto_post.py new file mode 100644 index 00000000000..14d683566c9 --- /dev/null +++ b/contract_invoice_auto_post/tests/test_contract_invoice_auto_post.py @@ -0,0 +1,48 @@ +# Copyright 2023 Xtendoo - Carlos Camacho +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import common + + +class TestContractBase(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env["res.partner"].create( + { + "name": "partner test contract", + "email": "demo@demo.com", + } + ) + cls.product_1 = cls.env.ref("product.product_product_1") + cls.contract = cls.env["contract.contract"].create( + { + "name": "Test Contract 2", + "partner_id": cls.partner.id, + "line_recurrence": True, + "generation_type": "invoice", + "auto_post": "at_date", + "contract_line_ids": [ + ( + 0, + 0, + { + "product_id": cls.product_1.id, + "name": "Services from #START# to #END#", + "quantity": 1, + "uom_id": cls.product_1.uom_id.id, + "price_unit": 100, + "discount": 50, + "recurring_rule_type": "monthly", + "recurring_interval": 1, + "date_start": "2018-02-15", + "recurring_next_date": "2018-02-22", + }, + ) + ], + } + ) + + def test_invoice_auto_post_at_date(self): + invoice = self.contract.recurring_create_invoice() + self.assertEqual(invoice.auto_post, "at_date") diff --git a/contract_invoice_auto_post/views/contract_view.xml b/contract_invoice_auto_post/views/contract_view.xml new file mode 100644 index 00000000000..484a912854a --- /dev/null +++ b/contract_invoice_auto_post/views/contract_view.xml @@ -0,0 +1,13 @@ + + + + contract.contract form view (in invoice auto post) + contract.contract + + + + + + + +