diff --git a/edi_account_oca/README.rst b/edi_account_oca/README.rst new file mode 100644 index 0000000000..c205d5a6a7 --- /dev/null +++ b/edi_account_oca/README.rst @@ -0,0 +1,99 @@ +=========== +Edi Account +=========== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:0fec295b66ff07158849734fc7d99d4bebf50e1de9c820d7f292dc726055c9e2 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi--framework-lightgray.png?logo=github + :target: https://github.com/OCA/edi-framework/tree/16.0/edi_account_oca + :alt: OCA/edi-framework +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/edi-framework-16-0/edi-framework-16-0-edi_account_oca + :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/edi-framework&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module intends to create a base to be extended by local edi rules +for accounting. + +In order to add a new integration for an account, you need to create a listener: + +.. code-block:: python + + class MyEventListener(Component): + _name = "account.move.event.listener.demo" + _inherit = "base.event.listener" + _apply_on = ["account.move"] + + def on_post_account_move(self, move): + """Add your code here about creation of record""" + +A skip if decorator can be added in order to make some checks on the state of the move + +**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 +~~~~~~~ + +* Creu Blanca + +Contributors +~~~~~~~~~~~~ + +* Enric Tobella + +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-etobella| image:: https://github.com/etobella.png?size=40px + :target: https://github.com/etobella + :alt: etobella + +Current `maintainer `__: + +|maintainer-etobella| + +This module is part of the `OCA/edi-framework `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/edi_account_oca/__init__.py b/edi_account_oca/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/edi_account_oca/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/edi_account_oca/__manifest__.py b/edi_account_oca/__manifest__.py new file mode 100644 index 0000000000..5952d24abf --- /dev/null +++ b/edi_account_oca/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2020 Creu Blanca +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +{ + "name": "Edi Account", + "summary": """ + Define EDI Configuration for Account Invoices""", + "version": "12.0.1.0.0", + "license": "LGPL-3", + "author": "Creu Blanca,Odoo Community Association (OCA)", + "maintainers": ["etobella"], + "development_status": "Beta", + "website": "https://github.com/OCA/edi", + "depends": ["account", "edi_oca", "component_event"], + "data": [ + "views/account_journal.xml", + "views/res_partner.xml", + "views/account_invoice.xml", + "views/edi_exchange_record.xml", + ], + "demo": [], +} diff --git a/edi_account_oca/i18n/edi_account.pot b/edi_account_oca/i18n/edi_account.pot new file mode 100644 index 0000000000..938887ab61 --- /dev/null +++ b/edi_account_oca/i18n/edi_account.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * edi_account +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.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: edi_account +#: model_terms:ir.ui.view,arch_db:edi_account.account_move_form_view +msgid "EDI" +msgstr "" + +#. module: edi_account +#: model_terms:ir.ui.view,arch_db:edi_account.view_account_journal_form +#: model_terms:ir.ui.view,arch_db:edi_account.view_partner_form +msgid "EDI Configuration" +msgstr "" + +#. module: edi_account +#: model:ir.model,name:edi_account.model_account_move +msgid "Journal Entries" +msgstr "" diff --git a/edi_account_oca/i18n/edi_account_oca.pot b/edi_account_oca/i18n/edi_account_oca.pot new file mode 100644 index 0000000000..335d3e2352 --- /dev/null +++ b/edi_account_oca/i18n/edi_account_oca.pot @@ -0,0 +1,109 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * edi_account_oca +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: edi_account_oca +#: model_terms:ir.ui.view,arch_db:edi_account_oca.account_move_form_view +msgid "EDI" +msgstr "" + +#. module: edi_account_oca +#: model:ir.actions.act_window,name:edi_account_oca.act_open_edi_exchange_record_account_move_view +msgid "Account Moves Exchange Record" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_bank_statement_line__edi_disable_auto +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__edi_disable_auto +#: model:ir.model.fields,field_description:edi_account_oca.field_account_payment__edi_disable_auto +msgid "Disable auto" +msgstr "" + +#. module: edi_account_oca +#: model_terms:ir.ui.view,arch_db:edi_account_oca.view_account_journal_form +#: model_terms:ir.ui.view,arch_db:edi_account_oca.view_partner_form +msgid "EDI Configuration" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__origin_edi_endpoint_id +msgid "EDI origin endpoint" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__origin_exchange_type_id +msgid "EDI origin exchange type" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__origin_exchange_record_id +msgid "EDI origin record" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,help:edi_account_oca.field_account_move__origin_exchange_record_id +msgid "EDI record that originated this document." +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__edi_config +msgid "Edi Config" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__edi_has_form_config +msgid "Edi Has Form Config" +msgstr "" + +#. module: edi_account_oca +#: model_terms:ir.ui.view,arch_db:edi_account_oca.account_move_form_view +msgid "Electronic Data Interchange" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__exchange_record_ids +msgid "Exchange Record" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__exchange_record_count +msgid "Exchange Record Count" +msgstr "" + +#. module: edi_account_oca +#: model:ir.ui.menu,name:edi_account_oca.menu_account_edi_root +msgid "Exchange records" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model,name:edi_account_oca.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: edi_account_oca +#: model:ir.ui.menu,name:edi_account_oca.menu_account_edi_exchange_record +msgid "Moves" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,help:edi_account_oca.field_account_move__origin_edi_endpoint_id +msgid "Record generated via this endpoint" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,help:edi_account_oca.field_account_bank_statement_line__edi_disable_auto +#: model:ir.model.fields,help:edi_account_oca.field_account_move__edi_disable_auto +#: model:ir.model.fields,help:edi_account_oca.field_account_payment__edi_disable_auto +msgid "When marked, EDI automatic processing will be avoided" +msgstr "" diff --git a/edi_account_oca/i18n/fr.po b/edi_account_oca/i18n/fr.po new file mode 100644 index 0000000000..8832dc2531 --- /dev/null +++ b/edi_account_oca/i18n/fr.po @@ -0,0 +1,115 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * edi_account_oca +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-06-17 15:48+0000\n" +"Last-Translator: Yves Le Doeuff \n" +"Language-Team: none\n" +"Language: fr\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: edi_account_oca +#: model_terms:ir.ui.view,arch_db:edi_account_oca.account_move_form_view +msgid "EDI" +msgstr "" + +#. module: edi_account_oca +#: model:ir.actions.act_window,name:edi_account_oca.act_open_edi_exchange_record_account_move_view +msgid "Account Moves Exchange Record" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_bank_statement_line__edi_disable_auto +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__edi_disable_auto +#: model:ir.model.fields,field_description:edi_account_oca.field_account_payment__edi_disable_auto +msgid "Disable auto" +msgstr "" + +#. module: edi_account_oca +#: model_terms:ir.ui.view,arch_db:edi_account_oca.view_account_journal_form +#: model_terms:ir.ui.view,arch_db:edi_account_oca.view_partner_form +msgid "EDI Configuration" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__origin_edi_endpoint_id +msgid "EDI origin endpoint" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__origin_exchange_type_id +msgid "EDI origin exchange type" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__origin_exchange_record_id +msgid "EDI origin record" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,help:edi_account_oca.field_account_move__origin_exchange_record_id +msgid "EDI record that originated this document." +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__edi_config +msgid "Edi Config" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__edi_has_form_config +msgid "Edi Has Form Config" +msgstr "" + +#. module: edi_account_oca +#: model_terms:ir.ui.view,arch_db:edi_account_oca.account_move_form_view +msgid "Electronic Data Interchange" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__exchange_record_ids +msgid "Exchange Record" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__exchange_record_count +msgid "Exchange Record Count" +msgstr "" + +#. module: edi_account_oca +#: model:ir.ui.menu,name:edi_account_oca.menu_account_edi_root +msgid "Exchange records" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model,name:edi_account_oca.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: edi_account_oca +#: model:ir.ui.menu,name:edi_account_oca.menu_account_edi_exchange_record +msgid "Moves" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,help:edi_account_oca.field_account_move__origin_edi_endpoint_id +msgid "Record generated via this endpoint" +msgstr "" + +#. module: edi_account_oca +#: model:ir.model.fields,help:edi_account_oca.field_account_bank_statement_line__edi_disable_auto +#: model:ir.model.fields,help:edi_account_oca.field_account_move__edi_disable_auto +#: model:ir.model.fields,help:edi_account_oca.field_account_payment__edi_disable_auto +msgid "When marked, EDI automatic processing will be avoided" +msgstr "" + +#~ msgid "Display Name" +#~ msgstr "Nom affiché" diff --git a/edi_account_oca/i18n/it.po b/edi_account_oca/i18n/it.po new file mode 100644 index 0000000000..b5996d3771 --- /dev/null +++ b/edi_account_oca/i18n/it.po @@ -0,0 +1,112 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * edi_account_oca +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-07-29 08:58+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\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 5.6.2\n" + +#. module: edi_account_oca +#: model_terms:ir.ui.view,arch_db:edi_account_oca.account_move_form_view +msgid "EDI" +msgstr "EDI" + +#. module: edi_account_oca +#: model:ir.actions.act_window,name:edi_account_oca.act_open_edi_exchange_record_account_move_view +msgid "Account Moves Exchange Record" +msgstr "Recod scambio movimenti conto" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_bank_statement_line__edi_disable_auto +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__edi_disable_auto +#: model:ir.model.fields,field_description:edi_account_oca.field_account_payment__edi_disable_auto +msgid "Disable auto" +msgstr "Disabilita automatico" + +#. module: edi_account_oca +#: model_terms:ir.ui.view,arch_db:edi_account_oca.view_account_journal_form +#: model_terms:ir.ui.view,arch_db:edi_account_oca.view_partner_form +msgid "EDI Configuration" +msgstr "Configurazione EDI" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__origin_edi_endpoint_id +msgid "EDI origin endpoint" +msgstr "Endpoint origine EDI" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__origin_exchange_type_id +msgid "EDI origin exchange type" +msgstr "Tipo scambio origine EDI" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__origin_exchange_record_id +msgid "EDI origin record" +msgstr "Record origine EDI" + +#. module: edi_account_oca +#: model:ir.model.fields,help:edi_account_oca.field_account_move__origin_exchange_record_id +msgid "EDI record that originated this document." +msgstr "Record EDI che ha generato questo documento." + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__edi_config +msgid "Edi Config" +msgstr "Configurazione EDI" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__edi_has_form_config +msgid "Edi Has Form Config" +msgstr "EDI ha una maschera di configurazione" + +#. module: edi_account_oca +#: model_terms:ir.ui.view,arch_db:edi_account_oca.account_move_form_view +msgid "Electronic Data Interchange" +msgstr "Scambio Dati Elettronico" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__exchange_record_ids +msgid "Exchange Record" +msgstr "Record di scambio" + +#. module: edi_account_oca +#: model:ir.model.fields,field_description:edi_account_oca.field_account_move__exchange_record_count +msgid "Exchange Record Count" +msgstr "Conteggio record di scambio" + +#. module: edi_account_oca +#: model:ir.ui.menu,name:edi_account_oca.menu_account_edi_root +msgid "Exchange records" +msgstr "Record di scambio" + +#. module: edi_account_oca +#: model:ir.model,name:edi_account_oca.model_account_move +msgid "Journal Entry" +msgstr "Registrazione contabile" + +#. module: edi_account_oca +#: model:ir.ui.menu,name:edi_account_oca.menu_account_edi_exchange_record +msgid "Moves" +msgstr "Movimenti" + +#. module: edi_account_oca +#: model:ir.model.fields,help:edi_account_oca.field_account_move__origin_edi_endpoint_id +msgid "Record generated via this endpoint" +msgstr "Record generato attraverso questo endpoint" + +#. module: edi_account_oca +#: model:ir.model.fields,help:edi_account_oca.field_account_bank_statement_line__edi_disable_auto +#: model:ir.model.fields,help:edi_account_oca.field_account_move__edi_disable_auto +#: model:ir.model.fields,help:edi_account_oca.field_account_payment__edi_disable_auto +msgid "When marked, EDI automatic processing will be avoided" +msgstr "Quando selezionata, l'elaborazione EDI automatica verrà evitata" diff --git a/edi_account_oca/models/__init__.py b/edi_account_oca/models/__init__.py new file mode 100644 index 0000000000..8e072db8f3 --- /dev/null +++ b/edi_account_oca/models/__init__.py @@ -0,0 +1 @@ +from . import account_invoice diff --git a/edi_account_oca/models/account_invoice.py b/edi_account_oca/models/account_invoice.py new file mode 100644 index 0000000000..fcc19c2785 --- /dev/null +++ b/edi_account_oca/models/account_invoice.py @@ -0,0 +1,37 @@ +# Copyright 2020 Creu Blanca +# Copyright 2024 ForgeFlow +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import fields, models + + +class AccountInvoice(models.Model): + _name = "account.invoice" + _inherit = ["account.invoice", "edi.exchange.consumer.mixin"] + + disable_edi_auto = fields.Boolean( + readonly=True, + states={"draft": [("readonly", False)]}, + ) + + def action_invoice_open(self): + result = super().action_invoice_open() + # We will use this event to know which documents needs to be executed + if self: + self._event("on_open_account_invoice").notify(self) + return result + + def action_cancel(self): + """This could be used to notify our provider that we are not accepting the + invoice""" + result = super().action_cancel() + if self: + self._event("on_cancel_account_invoice").notify(self) + return result + + def action_invoice_paid(self): + """This could be used to notify our provider that we are paying""" + result = super().action_invoice_paid() + if self: + self._event("on_paid_account_invoice").notify(self) + return result diff --git a/edi_account_oca/readme/CONTRIBUTORS.rst b/edi_account_oca/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..0379e94bf6 --- /dev/null +++ b/edi_account_oca/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Enric Tobella +* Jordi Masvidal diff --git a/edi_account_oca/readme/DESCRIPTION.rst b/edi_account_oca/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..4db73f89f3 --- /dev/null +++ b/edi_account_oca/readme/DESCRIPTION.rst @@ -0,0 +1,16 @@ +This module intends to create a base to be extended by local edi rules +for accounting. + +In order to add a new integration for an account, you need to create a listener: + +.. code-block:: python + + class MyEventListener(Component): + _name = "account.move.event.listener.demo" + _inherit = "base.event.listener" + _apply_on = ["account.move"] + + def on_post_account_move(self, move): + """Add your code here about creation of record""" + +A skip if decorator can be added in order to make some checks on the state of the move diff --git a/edi_account_oca/static/description/icon.png b/edi_account_oca/static/description/icon.png new file mode 100644 index 0000000000..a79752645c Binary files /dev/null and b/edi_account_oca/static/description/icon.png differ diff --git a/edi_account_oca/static/description/index.html b/edi_account_oca/static/description/index.html new file mode 100644 index 0000000000..32252b0aa8 --- /dev/null +++ b/edi_account_oca/static/description/index.html @@ -0,0 +1,434 @@ + + + + + +Edi Account + + + +
+

Edi Account

+ + +

Beta License: LGPL-3 OCA/edi-framework Translate me on Weblate Try me on Runboat

+

This module intends to create a base to be extended by local edi rules +for accounting.

+

In order to add a new integration for an account, you need to create a listener:

+
+class MyEventListener(Component):
+    _name = "account.move.event.listener.demo"
+    _inherit = "base.event.listener"
+    _apply_on = ["account.move"]
+
+    def on_post_account_move(self, move):
+        """Add your code here about creation of record"""
+
+

A skip if decorator can be added in order to make some checks on the state of the move

+

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

+
    +
  • Creu Blanca
  • +
+
+
+

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:

+

etobella

+

This module is part of the OCA/edi-framework project on GitHub.

+

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

+
+
+
+ + diff --git a/edi_account_oca/tests/__init__.py b/edi_account_oca/tests/__init__.py new file mode 100644 index 0000000000..25aeb70b83 --- /dev/null +++ b/edi_account_oca/tests/__init__.py @@ -0,0 +1 @@ +from . import test_edi diff --git a/edi_account_oca/tests/test_edi.py b/edi_account_oca/tests/test_edi.py new file mode 100644 index 0000000000..f3683563ff --- /dev/null +++ b/edi_account_oca/tests/test_edi.py @@ -0,0 +1,109 @@ +# Copyright 2020 Creu Blanca +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +import logging +from datetime import datetime + +from odoo import fields + +from odoo.addons.account.tests.account_test_no_chart import TestAccountNoChartCommon +from odoo.addons.component.core import Component +from odoo.addons.component.tests.common import SavepointComponentRegistryCase + +_logger = logging.getLogger(__name__) + + +class EDIBackendTestCase(TestAccountNoChartCommon, SavepointComponentRegistryCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.setUpAdditionalAccounts() + cls.setUpAccountJournal() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.cash_journal = cls.env["account.journal"].search( + [("type", "=", "cash"), ("company_id", "=", cls.env.user.company_id.id)] + )[0] + cls.journal_sale.update_posted = True + + class AccountInvoiceEventListenerDemo(Component): + _name = "account.invoice.event.listener.demo" + _inherit = "base.event.listener" + + def on_open_account_invoice(self, invoice): + invoice.name = "new_name" + + def on_paid_account_invoice(self, invoice): + invoice.name = "paid" + + def on_cancel_account_invoice(self, invoice): + invoice.name = "cancelled" + + AccountInvoiceEventListenerDemo._build_component(cls.comp_registry) + cls.comp_registry._cache.clear() + cls.test_invoice = ( + cls.env["account.invoice"] + .with_context(components_registry=cls.comp_registry) + .create( + { + "partner_id": cls.partner_customer_usd.id, + "date_invoice": fields.Date.from_string("2016-01-01"), + "journal_id": cls.journal_sale.id, + "invoice_line_ids": [ + ( + 0, + None, + { + "name": "revenue line 1", + "account_id": cls.account_revenue.id, + "quantity": 1.0, + "price_unit": 100.0, + }, + ), + ( + 0, + None, + { + "name": "revenue line 2", + "account_id": cls.account_revenue.id, + "quantity": 1.0, + "price_unit": 100.0, + }, + ), + ], + } + ) + ) + cls.test_invoice.refresh() + + def test_paid_move(self): + self.test_invoice.action_invoice_open() + self.assertEqual(self.test_invoice.name, "new_name") + + invoice_ctx = { + "active_model": "account.invoice", + "active_ids": [self.test_invoice.id], + } + register_payments = ( + self.env["account.register.payments"] + .with_context(invoice_ctx) + .create( + { + "payment_date": datetime.now().strftime("%Y-%m-%d"), + "payment_method_id": self.env.ref( + "account.account_payment_method_manual_in" + ).id, + "journal_id": self.cash_journal.id, + "amount": 200.0, + } + ) + ) + register_payments.with_context( + components_registry=self.comp_registry + ).create_payments() + self.assertEqual(self.test_invoice.name, "paid") + + def test_cancel_move(self): + self.test_invoice.action_invoice_open() + self.assertEqual(self.test_invoice.name, "new_name") + self.test_invoice.action_cancel() + self.assertEqual(self.test_invoice.name, "cancelled") diff --git a/edi_account_oca/views/account_invoice.xml b/edi_account_oca/views/account_invoice.xml new file mode 100644 index 0000000000..ac752576ed --- /dev/null +++ b/edi_account_oca/views/account_invoice.xml @@ -0,0 +1,34 @@ + + + + + account.invoice.form (in edi_account) + account.invoice + + + + + + + + + + + + + diff --git a/edi_account_oca/views/account_journal.xml b/edi_account_oca/views/account_journal.xml new file mode 100644 index 0000000000..063d2b564c --- /dev/null +++ b/edi_account_oca/views/account_journal.xml @@ -0,0 +1,15 @@ + + + + + account.journal.form (in edi_account) + account.journal + + + + + + + + diff --git a/edi_account_oca/views/edi_exchange_record.xml b/edi_account_oca/views/edi_exchange_record.xml new file mode 100644 index 0000000000..ede05f795b --- /dev/null +++ b/edi_account_oca/views/edi_exchange_record.xml @@ -0,0 +1,30 @@ + + + + + + Account Invoice Exchange Records + ir.actions.act_window + edi.exchange.record + tree,form + [('model', '=', 'account.invoice')] + {} + + + + diff --git a/edi_account_oca/views/res_partner.xml b/edi_account_oca/views/res_partner.xml new file mode 100644 index 0000000000..31a5fcbf44 --- /dev/null +++ b/edi_account_oca/views/res_partner.xml @@ -0,0 +1,16 @@ + + + + + res.partner.form (in edi_account) + res.partner + + + + + + + + + diff --git a/setup/edi_account_oca/odoo/addons/edi_account_oca b/setup/edi_account_oca/odoo/addons/edi_account_oca new file mode 120000 index 0000000000..f8899b2dde --- /dev/null +++ b/setup/edi_account_oca/odoo/addons/edi_account_oca @@ -0,0 +1 @@ +../../../../edi_account_oca \ No newline at end of file diff --git a/setup/edi_account_oca/setup.py b/setup/edi_account_oca/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/edi_account_oca/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)