From c5a4d973467ed10a18408644936141cc54761330 Mon Sep 17 00:00:00 2001 From: unaiberis <146723346+unaiberis@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:43:31 +0200 Subject: [PATCH] [16.0][MIG] repair_execute_invoice_onchange_partner: Migration to 16.0 (#91) * [ADD] repair_execute_invoice_onchange_partner: When creating an invoice from a repair order, execute the "onchange" partner of the invoice. (#77) * [MIG] repair_execute_invoice_onchange_partner: Migration to 16.0 * [ADD] Change invoice to move --------- Co-authored-by: alfredoavanzosc --- .../README.rst | 28 +++++++++++++++++++ .../__init__.py | 1 + .../__manifest__.py | 16 +++++++++++ .../i18n/ca_ES.po | 27 ++++++++++++++++++ .../i18n/en_US.po | 27 ++++++++++++++++++ .../i18n/es.po | 27 ++++++++++++++++++ ...epair_execute_invoice_onchange_partner.pot | 27 ++++++++++++++++++ .../models/__init__.py | 2 ++ .../models/account_move.py | 14 ++++++++++ .../models/repair_order.py | 12 ++++++++ .../repair_execute_invoice_onchange_partner | 1 + .../setup.py | 6 ++++ 12 files changed, 188 insertions(+) create mode 100644 repair_execute_invoice_onchange_partner/README.rst create mode 100644 repair_execute_invoice_onchange_partner/__init__.py create mode 100644 repair_execute_invoice_onchange_partner/__manifest__.py create mode 100644 repair_execute_invoice_onchange_partner/i18n/ca_ES.po create mode 100644 repair_execute_invoice_onchange_partner/i18n/en_US.po create mode 100644 repair_execute_invoice_onchange_partner/i18n/es.po create mode 100644 repair_execute_invoice_onchange_partner/i18n/repair_execute_invoice_onchange_partner.pot create mode 100644 repair_execute_invoice_onchange_partner/models/__init__.py create mode 100644 repair_execute_invoice_onchange_partner/models/account_move.py create mode 100644 repair_execute_invoice_onchange_partner/models/repair_order.py create mode 120000 setup/repair_execute_invoice_onchange_partner/odoo/addons/repair_execute_invoice_onchange_partner create mode 100644 setup/repair_execute_invoice_onchange_partner/setup.py diff --git a/repair_execute_invoice_onchange_partner/README.rst b/repair_execute_invoice_onchange_partner/README.rst new file mode 100644 index 0000000..e53fe26 --- /dev/null +++ b/repair_execute_invoice_onchange_partner/README.rst @@ -0,0 +1,28 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +======================================= +Repair execute invoice onchange partner +======================================= + +* When creating an invoice from a repair order, execute the "onchange" partner + of the invoice. + +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 smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ +* Ana Juaristi +* Alfredo de la Fuente + +Do not contact contributors directly about support or help with technical issues. diff --git a/repair_execute_invoice_onchange_partner/__init__.py b/repair_execute_invoice_onchange_partner/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/repair_execute_invoice_onchange_partner/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/repair_execute_invoice_onchange_partner/__manifest__.py b/repair_execute_invoice_onchange_partner/__manifest__.py new file mode 100644 index 0000000..d74abfb --- /dev/null +++ b/repair_execute_invoice_onchange_partner/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2023 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Repair Execute Move Onchange Partner", + "version": "16.0.1.0.0", + "category": "Manufacturing", + "author": "AvanzOSC", + "website": "https://github.com/avanzosc/mrp-repair-addons", + "license": "AGPL-3", + "depends": [ + "repair", + ], + "data": [], + "installable": True, + "auto_install": True, +} diff --git a/repair_execute_invoice_onchange_partner/i18n/ca_ES.po b/repair_execute_invoice_onchange_partner/i18n/ca_ES.po new file mode 100644 index 0000000..d6a01eb --- /dev/null +++ b/repair_execute_invoice_onchange_partner/i18n/ca_ES.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_execute_invoice_onchange_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-11-24 08:48+0000\n" +"PO-Revision-Date: 2023-11-24 08:48+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: repair_execute_invoice_onchange_partner +#: model:ir.model,name:repair_execute_invoice_onchange_partner.model_account_invoice +msgid "Invoice" +msgstr "Factura" + +#. module: repair_execute_invoice_onchange_partner +#: model:ir.model,name:repair_execute_invoice_onchange_partner.model_repair_order +msgid "Repair Order" +msgstr "Ordre de reparaciĆ³" + diff --git a/repair_execute_invoice_onchange_partner/i18n/en_US.po b/repair_execute_invoice_onchange_partner/i18n/en_US.po new file mode 100644 index 0000000..c310922 --- /dev/null +++ b/repair_execute_invoice_onchange_partner/i18n/en_US.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_execute_invoice_onchange_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-11-24 08:49+0000\n" +"PO-Revision-Date: 2023-11-24 08:49+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: repair_execute_invoice_onchange_partner +#: model:ir.model,name:repair_execute_invoice_onchange_partner.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: repair_execute_invoice_onchange_partner +#: model:ir.model,name:repair_execute_invoice_onchange_partner.model_repair_order +msgid "Repair Order" +msgstr "" + diff --git a/repair_execute_invoice_onchange_partner/i18n/es.po b/repair_execute_invoice_onchange_partner/i18n/es.po new file mode 100644 index 0000000..73c3f76 --- /dev/null +++ b/repair_execute_invoice_onchange_partner/i18n/es.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_execute_invoice_onchange_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-11-24 08:49+0000\n" +"PO-Revision-Date: 2023-11-24 08:49+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: repair_execute_invoice_onchange_partner +#: model:ir.model,name:repair_execute_invoice_onchange_partner.model_account_invoice +msgid "Invoice" +msgstr "Factura" + +#. module: repair_execute_invoice_onchange_partner +#: model:ir.model,name:repair_execute_invoice_onchange_partner.model_repair_order +msgid "Repair Order" +msgstr "Orden de reparaciĆ³n" + diff --git a/repair_execute_invoice_onchange_partner/i18n/repair_execute_invoice_onchange_partner.pot b/repair_execute_invoice_onchange_partner/i18n/repair_execute_invoice_onchange_partner.pot new file mode 100644 index 0000000..4a6d44d --- /dev/null +++ b/repair_execute_invoice_onchange_partner/i18n/repair_execute_invoice_onchange_partner.pot @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_execute_invoice_onchange_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-11-24 08:48+0000\n" +"PO-Revision-Date: 2023-11-24 08:48+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: repair_execute_invoice_onchange_partner +#: model:ir.model,name:repair_execute_invoice_onchange_partner.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: repair_execute_invoice_onchange_partner +#: model:ir.model,name:repair_execute_invoice_onchange_partner.model_repair_order +msgid "Repair Order" +msgstr "" + diff --git a/repair_execute_invoice_onchange_partner/models/__init__.py b/repair_execute_invoice_onchange_partner/models/__init__.py new file mode 100644 index 0000000..87b614a --- /dev/null +++ b/repair_execute_invoice_onchange_partner/models/__init__.py @@ -0,0 +1,2 @@ +from . import repair_order +from . import account_invoice diff --git a/repair_execute_invoice_onchange_partner/models/account_move.py b/repair_execute_invoice_onchange_partner/models/account_move.py new file mode 100644 index 0000000..ef0a7d3 --- /dev/null +++ b/repair_execute_invoice_onchange_partner/models/account_move.py @@ -0,0 +1,14 @@ +# Copyright 2023 Alfredo de la Fuente - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import api, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + @api.model + def create(self, vals): + move = super().create(vals) + if "create_move_from_repair" in self.env.context: + move._onchange_partner_id() + return move diff --git a/repair_execute_invoice_onchange_partner/models/repair_order.py b/repair_execute_invoice_onchange_partner/models/repair_order.py new file mode 100644 index 0000000..977f9eb --- /dev/null +++ b/repair_execute_invoice_onchange_partner/models/repair_order.py @@ -0,0 +1,12 @@ +# Copyright 2023 Alfredo de la Fuente - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import models + + +class RepairOrder(models.Model): + _inherit = "repair.order" + + def action_move_create(self, group=False): + return super( + RepairOrder, self.with_context(create_move_from_repair=True) + ).action_move_create(group=group) diff --git a/setup/repair_execute_invoice_onchange_partner/odoo/addons/repair_execute_invoice_onchange_partner b/setup/repair_execute_invoice_onchange_partner/odoo/addons/repair_execute_invoice_onchange_partner new file mode 120000 index 0000000..bc1a6b3 --- /dev/null +++ b/setup/repair_execute_invoice_onchange_partner/odoo/addons/repair_execute_invoice_onchange_partner @@ -0,0 +1 @@ +../../../../repair_execute_invoice_onchange_partner \ No newline at end of file diff --git a/setup/repair_execute_invoice_onchange_partner/setup.py b/setup/repair_execute_invoice_onchange_partner/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/repair_execute_invoice_onchange_partner/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)