From b4fc3af4df0a0725d33ba51fb21656d2b91bbffa Mon Sep 17 00:00:00 2001 From: unaiberis <146723346+unaiberis@users.noreply.github.com> Date: Tue, 28 May 2024 10:41:57 +0200 Subject: [PATCH 01/13] [FIX] repair_refurbish: comodel name stock.production.lot to stock.lot (#97) --- repair_refurbish/models/repair.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repair_refurbish/models/repair.py b/repair_refurbish/models/repair.py index e765762..99e5df8 100644 --- a/repair_refurbish/models/repair.py +++ b/repair_refurbish/models/repair.py @@ -18,7 +18,7 @@ class RepairOrder(models.Model): string="Refurbished product", comodel_name="product.product" ) refurbish_lot_id = fields.Many2one( - string="Refurbished Lot", comodel_name="stock.production.lot" + string="Refurbished Lot", comodel_name="stock.lot" ) refurbish_move_id = fields.Many2one( string="Refurbished Inventory Move", comodel_name="stock.move" From f8cd586ee6116e93543ffde88bbfc49b8695e5db Mon Sep 17 00:00:00 2001 From: Daniel-CA Date: Wed, 1 Aug 2018 15:56:02 +0200 Subject: [PATCH 02/13] [ADD] mrp_repair_warranty --- mrp_repair_warranty/README.rst | 28 +++++++++++++ mrp_repair_warranty/__init__.py | 5 +++ mrp_repair_warranty/__openerp__.py | 23 +++++++++++ mrp_repair_warranty/i18n/es.po | 38 ++++++++++++++++++ mrp_repair_warranty/models/__init__.py | 5 +++ mrp_repair_warranty/models/mrp_repair.py | 11 ++++++ mrp_repair_warranty/views/mrp_repair_view.xml | 39 +++++++++++++++++++ 7 files changed, 149 insertions(+) create mode 100644 mrp_repair_warranty/README.rst create mode 100644 mrp_repair_warranty/__init__.py create mode 100644 mrp_repair_warranty/__openerp__.py create mode 100644 mrp_repair_warranty/i18n/es.po create mode 100644 mrp_repair_warranty/models/__init__.py create mode 100644 mrp_repair_warranty/models/mrp_repair.py create mode 100644 mrp_repair_warranty/views/mrp_repair_view.xml diff --git a/mrp_repair_warranty/README.rst b/mrp_repair_warranty/README.rst new file mode 100644 index 0000000..c27db05 --- /dev/null +++ b/mrp_repair_warranty/README.rst @@ -0,0 +1,28 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +=================== +MRP Repair Warranty +=================== + +This module adds a check field to define repairs in warranty. + +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 +------------ + +* Daniel Campos +* Ana Juaristi + +Do not contact contributors directly about support or help with technical issues. diff --git a/mrp_repair_warranty/__init__.py b/mrp_repair_warranty/__init__.py new file mode 100644 index 0000000..2422074 --- /dev/null +++ b/mrp_repair_warranty/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Daniel Campos - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import models diff --git a/mrp_repair_warranty/__openerp__.py b/mrp_repair_warranty/__openerp__.py new file mode 100644 index 0000000..dd9bb56 --- /dev/null +++ b/mrp_repair_warranty/__openerp__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Daniel Campos - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + "name": "MRP Repair Warranty", + "version": "8.0.1.0.0", + "category": "Manufacturing", + "license": "AGPL-3", + "author": "AvanzOSC", + "website": "http://www.avanzosc.es", + "contributors": [ + "Daniel Campos ", + "Ana Juaristi ", + ], + "depends": [ + "mrp_repair", + ], + "data": [ + "views/mrp_repair_view.xml", + ], + "installable": True, +} diff --git a/mrp_repair_warranty/i18n/es.po b/mrp_repair_warranty/i18n/es.po new file mode 100644 index 0000000..3839880 --- /dev/null +++ b/mrp_repair_warranty/i18n/es.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_repair_warranty +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-08-01 13:34+0000\n" +"PO-Revision-Date: 2018-08-01 13:34+0000\n" +"Last-Translator: <>\n" +"Language: Spanish\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: mrp_repair_warranty +#: view:mrp.repair:mrp_repair_warranty.view_repair_order_form_filter +msgid "Company" +msgstr "Compañia" + +#. module: mrp_repair_warranty +#: field:mrp.repair,is_in_warranty:0 +msgid "In warranty" +msgstr "En garantia" + +#. module: mrp_repair_warranty +#: view:mrp.repair:mrp_repair_warranty.view_repair_order_form_filter +msgid "Is in warranty" +msgstr "En garantia" + +#. module: mrp_repair_warranty +#: model:ir.model,name:mrp_repair_warranty.model_mrp_repair +msgid "Repair Order" +msgstr "Orden de reparación" + diff --git a/mrp_repair_warranty/models/__init__.py b/mrp_repair_warranty/models/__init__.py new file mode 100644 index 0000000..2d215a4 --- /dev/null +++ b/mrp_repair_warranty/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Daniel Campos - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import mrp_repair diff --git a/mrp_repair_warranty/models/mrp_repair.py b/mrp_repair_warranty/models/mrp_repair.py new file mode 100644 index 0000000..80ddf42 --- /dev/null +++ b/mrp_repair_warranty/models/mrp_repair.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Daniel Campos - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from openerp import fields, models + + +class MrpRepair(models.Model): + _inherit = 'mrp.repair' + + is_in_warranty = fields.Boolean(string='In warranty') diff --git a/mrp_repair_warranty/views/mrp_repair_view.xml b/mrp_repair_warranty/views/mrp_repair_view.xml new file mode 100644 index 0000000..db02728 --- /dev/null +++ b/mrp_repair_warranty/views/mrp_repair_view.xml @@ -0,0 +1,39 @@ + + + + + mrp.repair.tree + mrp.repair + + + + + + + + + mrp.repair.form + mrp.repair + + + + + + + + + + mrp.repair.select + mrp.repair + + + + + + + + + + + + From 65f40b9c48ac516d6932602c8dc0274a747634d3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 25 Sep 2019 16:15:03 +0200 Subject: [PATCH 03/13] [IMP] mrp_repair_warranty: Add warranty filter and auto select no invoice repair (#61) --- mrp_repair_warranty/__init__.py | 2 -- mrp_repair_warranty/i18n/es.po | 1 + mrp_repair_warranty/models/__init__.py | 2 -- mrp_repair_warranty/models/mrp_repair.py | 7 +++- mrp_repair_warranty/tests/__init__.py | 3 ++ .../tests/test_mrp_repair_warranty.py | 36 +++++++++++++++++++ mrp_repair_warranty/views/mrp_repair_view.xml | 3 ++ 7 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 mrp_repair_warranty/tests/__init__.py create mode 100644 mrp_repair_warranty/tests/test_mrp_repair_warranty.py diff --git a/mrp_repair_warranty/__init__.py b/mrp_repair_warranty/__init__.py index 2422074..cde864b 100644 --- a/mrp_repair_warranty/__init__.py +++ b/mrp_repair_warranty/__init__.py @@ -1,5 +1,3 @@ # -*- coding: utf-8 -*- -# Copyright 2018 Daniel Campos - AvanzOSC -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import models diff --git a/mrp_repair_warranty/i18n/es.po b/mrp_repair_warranty/i18n/es.po index 3839880..88e883f 100644 --- a/mrp_repair_warranty/i18n/es.po +++ b/mrp_repair_warranty/i18n/es.po @@ -23,6 +23,7 @@ msgstr "Compañia" #. module: mrp_repair_warranty #: field:mrp.repair,is_in_warranty:0 +#: view:mrp.repair:mrp_repair_warranty.view_repair_order_form_filter msgid "In warranty" msgstr "En garantia" diff --git a/mrp_repair_warranty/models/__init__.py b/mrp_repair_warranty/models/__init__.py index 2d215a4..6067a30 100644 --- a/mrp_repair_warranty/models/__init__.py +++ b/mrp_repair_warranty/models/__init__.py @@ -1,5 +1,3 @@ # -*- coding: utf-8 -*- -# Copyright 2018 Daniel Campos - AvanzOSC -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import mrp_repair diff --git a/mrp_repair_warranty/models/mrp_repair.py b/mrp_repair_warranty/models/mrp_repair.py index 80ddf42..f44f56f 100644 --- a/mrp_repair_warranty/models/mrp_repair.py +++ b/mrp_repair_warranty/models/mrp_repair.py @@ -2,10 +2,15 @@ # Copyright 2018 Daniel Campos - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from openerp import fields, models +from openerp import api, fields, models class MrpRepair(models.Model): _inherit = 'mrp.repair' is_in_warranty = fields.Boolean(string='In warranty') + + @api.onchange('is_in_warranty') + def onchange_warranty(self): + for repair in self.filtered('is_in_warranty'): + repair.invoice_method = 'none' diff --git a/mrp_repair_warranty/tests/__init__.py b/mrp_repair_warranty/tests/__init__.py new file mode 100644 index 0000000..3bd9c2e --- /dev/null +++ b/mrp_repair_warranty/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import test_mrp_repair_warranty diff --git a/mrp_repair_warranty/tests/test_mrp_repair_warranty.py b/mrp_repair_warranty/tests/test_mrp_repair_warranty.py new file mode 100644 index 0000000..fcda7fb --- /dev/null +++ b/mrp_repair_warranty/tests/test_mrp_repair_warranty.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Daniel Campos - AvanzOSC +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import openerp.tests.common as common + + +class TestMrpRepairWarranty(common.TransactionCase): + + def setUp(self): + super(TestMrpRepairWarranty, self).setUp() + self.mrp_repair_model = self.env['mrp.repair'] + self.product = self.browse_ref('product.product_product_3') + self.location_id = self.ref('stock.location_inventory') + self.customer = self.env['res.partner'].create({ + 'name': 'Test Customer', + 'is_company': True, + 'customer': True, + 'company_id': self.env.user.company_id.id, + }) + vals = {'name': 'test', + 'product_id': self.product.id, + 'location_id': self.location_id, + 'location_dest_id': self.location_id, + 'product_uom': self.product.uom_id.id, + 'partner_id': self.customer.id, + 'invoice_method': 'after_repair'} + self.mrp_repair_customer = self.env['mrp.repair'].create(vals) + + def test_warranty(self): + self.assertEqual(self.mrp_repair_customer.invoice_method, + 'after_repair') + self.mrp_repair_customer.is_in_warranty = True + self.mrp_repair_customer.onchange_warranty() + self.assertEqual(self.mrp_repair_customer.invoice_method, + 'none') diff --git a/mrp_repair_warranty/views/mrp_repair_view.xml b/mrp_repair_warranty/views/mrp_repair_view.xml index db02728..437a7bd 100644 --- a/mrp_repair_warranty/views/mrp_repair_view.xml +++ b/mrp_repair_warranty/views/mrp_repair_view.xml @@ -30,6 +30,9 @@ + + + From 49ac9070f871453d473827e64ffa9fd71e8c244d Mon Sep 17 00:00:00 2001 From: Unai Beristain Date: Mon, 25 Mar 2024 15:10:44 +0100 Subject: [PATCH 04/13] [MIG] repair_warranty: Migration to 16.0 --- mrp_repair_warranty/__init__.py | 3 -- mrp_repair_warranty/__openerp__.py | 23 ---------- mrp_repair_warranty/i18n/es.po | 39 ----------------- mrp_repair_warranty/models/__init__.py | 3 -- mrp_repair_warranty/models/mrp_repair.py | 16 ------- .../tests/test_mrp_repair_warranty.py | 36 ---------------- mrp_repair_warranty/views/mrp_repair_view.xml | 42 ------------------- .../README.rst | 6 +-- repair_warranty/__init__.py | 1 + repair_warranty/__manifest__.py | 18 ++++++++ repair_warranty/i18n/es.po | 36 ++++++++++++++++ repair_warranty/i18n/repair_warranty.pot | 36 ++++++++++++++++ repair_warranty/models/__init__.py | 1 + repair_warranty/models/repair_order.py | 15 +++++++ .../tests/__init__.py | 2 - .../tests/test_mrp_repair_warranty.py | 34 +++++++++++++++ repair_warranty/views/mrp_repair_view.xml | 39 +++++++++++++++++ .../odoo/addons/repair_warranty | 1 + setup/repair_warranty/setup.py | 6 +++ 19 files changed, 190 insertions(+), 167 deletions(-) delete mode 100644 mrp_repair_warranty/__init__.py delete mode 100644 mrp_repair_warranty/__openerp__.py delete mode 100644 mrp_repair_warranty/i18n/es.po delete mode 100644 mrp_repair_warranty/models/__init__.py delete mode 100644 mrp_repair_warranty/models/mrp_repair.py delete mode 100644 mrp_repair_warranty/tests/test_mrp_repair_warranty.py delete mode 100644 mrp_repair_warranty/views/mrp_repair_view.xml rename {mrp_repair_warranty => repair_warranty}/README.rst (92%) create mode 100644 repair_warranty/__init__.py create mode 100644 repair_warranty/__manifest__.py create mode 100644 repair_warranty/i18n/es.po create mode 100644 repair_warranty/i18n/repair_warranty.pot create mode 100644 repair_warranty/models/__init__.py create mode 100644 repair_warranty/models/repair_order.py rename {mrp_repair_warranty => repair_warranty}/tests/__init__.py (60%) create mode 100644 repair_warranty/tests/test_mrp_repair_warranty.py create mode 100644 repair_warranty/views/mrp_repair_view.xml create mode 120000 setup/repair_warranty/odoo/addons/repair_warranty create mode 100644 setup/repair_warranty/setup.py diff --git a/mrp_repair_warranty/__init__.py b/mrp_repair_warranty/__init__.py deleted file mode 100644 index cde864b..0000000 --- a/mrp_repair_warranty/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*- coding: utf-8 -*- - -from . import models diff --git a/mrp_repair_warranty/__openerp__.py b/mrp_repair_warranty/__openerp__.py deleted file mode 100644 index dd9bb56..0000000 --- a/mrp_repair_warranty/__openerp__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2018 Daniel Campos - AvanzOSC -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - -{ - "name": "MRP Repair Warranty", - "version": "8.0.1.0.0", - "category": "Manufacturing", - "license": "AGPL-3", - "author": "AvanzOSC", - "website": "http://www.avanzosc.es", - "contributors": [ - "Daniel Campos ", - "Ana Juaristi ", - ], - "depends": [ - "mrp_repair", - ], - "data": [ - "views/mrp_repair_view.xml", - ], - "installable": True, -} diff --git a/mrp_repair_warranty/i18n/es.po b/mrp_repair_warranty/i18n/es.po deleted file mode 100644 index 88e883f..0000000 --- a/mrp_repair_warranty/i18n/es.po +++ /dev/null @@ -1,39 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * mrp_repair_warranty -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-01 13:34+0000\n" -"PO-Revision-Date: 2018-08-01 13:34+0000\n" -"Last-Translator: <>\n" -"Language: Spanish\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: mrp_repair_warranty -#: view:mrp.repair:mrp_repair_warranty.view_repair_order_form_filter -msgid "Company" -msgstr "Compañia" - -#. module: mrp_repair_warranty -#: field:mrp.repair,is_in_warranty:0 -#: view:mrp.repair:mrp_repair_warranty.view_repair_order_form_filter -msgid "In warranty" -msgstr "En garantia" - -#. module: mrp_repair_warranty -#: view:mrp.repair:mrp_repair_warranty.view_repair_order_form_filter -msgid "Is in warranty" -msgstr "En garantia" - -#. module: mrp_repair_warranty -#: model:ir.model,name:mrp_repair_warranty.model_mrp_repair -msgid "Repair Order" -msgstr "Orden de reparación" - diff --git a/mrp_repair_warranty/models/__init__.py b/mrp_repair_warranty/models/__init__.py deleted file mode 100644 index 6067a30..0000000 --- a/mrp_repair_warranty/models/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*- coding: utf-8 -*- - -from . import mrp_repair diff --git a/mrp_repair_warranty/models/mrp_repair.py b/mrp_repair_warranty/models/mrp_repair.py deleted file mode 100644 index f44f56f..0000000 --- a/mrp_repair_warranty/models/mrp_repair.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2018 Daniel Campos - AvanzOSC -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - -from openerp import api, fields, models - - -class MrpRepair(models.Model): - _inherit = 'mrp.repair' - - is_in_warranty = fields.Boolean(string='In warranty') - - @api.onchange('is_in_warranty') - def onchange_warranty(self): - for repair in self.filtered('is_in_warranty'): - repair.invoice_method = 'none' diff --git a/mrp_repair_warranty/tests/test_mrp_repair_warranty.py b/mrp_repair_warranty/tests/test_mrp_repair_warranty.py deleted file mode 100644 index fcda7fb..0000000 --- a/mrp_repair_warranty/tests/test_mrp_repair_warranty.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2019 Daniel Campos - AvanzOSC -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import openerp.tests.common as common - - -class TestMrpRepairWarranty(common.TransactionCase): - - def setUp(self): - super(TestMrpRepairWarranty, self).setUp() - self.mrp_repair_model = self.env['mrp.repair'] - self.product = self.browse_ref('product.product_product_3') - self.location_id = self.ref('stock.location_inventory') - self.customer = self.env['res.partner'].create({ - 'name': 'Test Customer', - 'is_company': True, - 'customer': True, - 'company_id': self.env.user.company_id.id, - }) - vals = {'name': 'test', - 'product_id': self.product.id, - 'location_id': self.location_id, - 'location_dest_id': self.location_id, - 'product_uom': self.product.uom_id.id, - 'partner_id': self.customer.id, - 'invoice_method': 'after_repair'} - self.mrp_repair_customer = self.env['mrp.repair'].create(vals) - - def test_warranty(self): - self.assertEqual(self.mrp_repair_customer.invoice_method, - 'after_repair') - self.mrp_repair_customer.is_in_warranty = True - self.mrp_repair_customer.onchange_warranty() - self.assertEqual(self.mrp_repair_customer.invoice_method, - 'none') diff --git a/mrp_repair_warranty/views/mrp_repair_view.xml b/mrp_repair_warranty/views/mrp_repair_view.xml deleted file mode 100644 index 437a7bd..0000000 --- a/mrp_repair_warranty/views/mrp_repair_view.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - mrp.repair.tree - mrp.repair - - - - - - - - - mrp.repair.form - mrp.repair - - - - - - - - - - mrp.repair.select - mrp.repair - - - - - - - - - - - - - - - diff --git a/mrp_repair_warranty/README.rst b/repair_warranty/README.rst similarity index 92% rename from mrp_repair_warranty/README.rst rename to repair_warranty/README.rst index c27db05..7003c92 100644 --- a/mrp_repair_warranty/README.rst +++ b/repair_warranty/README.rst @@ -2,9 +2,9 @@ :target: https://www.gnu.org/licenses/agpl :alt: License: AGPL-3 -=================== -MRP Repair Warranty -=================== +=============== +Repair Warranty +=============== This module adds a check field to define repairs in warranty. diff --git a/repair_warranty/__init__.py b/repair_warranty/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/repair_warranty/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/repair_warranty/__manifest__.py b/repair_warranty/__manifest__.py new file mode 100644 index 0000000..6cb451c --- /dev/null +++ b/repair_warranty/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2018 Daniel Campos - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + "name": "Repair Warranty", + "version": "16.0.1.0.0", + "category": "Inventory/Inventory", + "license": "AGPL-3", + "author": "AvanzOSC", + "website": "https://github.com/avanzosc/mrp-repair-addons", + "depends": [ + "repair", + ], + "data": [ + "views/mrp_repair_view.xml", + ], + "installable": True, +} diff --git a/repair_warranty/i18n/es.po b/repair_warranty/i18n/es.po new file mode 100644 index 0000000..46863a0 --- /dev/null +++ b/repair_warranty/i18n/es.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_warranty +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-06-06 14:53+0000\n" +"PO-Revision-Date: 2024-06-06 14:53+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_warranty +#: model:ir.model.fields,field_description:repair_warranty.field_repair_order__is_in_warranty +msgid "Is it in warranty?" +msgstr "¿Se encuentra en garantía?" + +#. module: repair_warranty +#: model:ir.model,name:repair_warranty.model_repair_order +msgid "Repair Order" +msgstr "Orden de reparación" + +#. module: repair_warranty +#: model_terms:ir.ui.view,arch_db:repair_warranty.view_repair_order_form_filter +msgid "With Warranty" +msgstr "Con garantía" + +#. module: repair_warranty +#: model_terms:ir.ui.view,arch_db:repair_warranty.view_repair_order_form_filter +msgid "Without Warranty" +msgstr "Sin garantía" diff --git a/repair_warranty/i18n/repair_warranty.pot b/repair_warranty/i18n/repair_warranty.pot new file mode 100644 index 0000000..8062297 --- /dev/null +++ b/repair_warranty/i18n/repair_warranty.pot @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_warranty +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-06-06 14:53+0000\n" +"PO-Revision-Date: 2024-06-06 14:53+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_warranty +#: model:ir.model.fields,field_description:repair_warranty.field_repair_order__is_in_warranty +msgid "Is it in warranty?" +msgstr "" + +#. module: repair_warranty +#: model:ir.model,name:repair_warranty.model_repair_order +msgid "Repair Order" +msgstr "" + +#. module: repair_warranty +#: model_terms:ir.ui.view,arch_db:repair_warranty.view_repair_order_form_filter +msgid "With Warranty" +msgstr "" + +#. module: repair_warranty +#: model_terms:ir.ui.view,arch_db:repair_warranty.view_repair_order_form_filter +msgid "Without Warranty" +msgstr "" diff --git a/repair_warranty/models/__init__.py b/repair_warranty/models/__init__.py new file mode 100644 index 0000000..2251f67 --- /dev/null +++ b/repair_warranty/models/__init__.py @@ -0,0 +1 @@ +from . import repair_order diff --git a/repair_warranty/models/repair_order.py b/repair_warranty/models/repair_order.py new file mode 100644 index 0000000..96ee892 --- /dev/null +++ b/repair_warranty/models/repair_order.py @@ -0,0 +1,15 @@ +# Copyright 2018 Daniel Campos - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from odoo import api, fields, models + + +class RepairOrder(models.Model): + _inherit = "repair.order" + + is_in_warranty = fields.Boolean(string="Is it in warranty?") + + @api.onchange("is_in_warranty") + def onchange_warranty(self): + for repair in self.filtered("is_in_warranty"): + repair.invoice_method = "none" diff --git a/mrp_repair_warranty/tests/__init__.py b/repair_warranty/tests/__init__.py similarity index 60% rename from mrp_repair_warranty/tests/__init__.py rename to repair_warranty/tests/__init__.py index 3bd9c2e..a9fcf81 100644 --- a/mrp_repair_warranty/tests/__init__.py +++ b/repair_warranty/tests/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import test_mrp_repair_warranty diff --git a/repair_warranty/tests/test_mrp_repair_warranty.py b/repair_warranty/tests/test_mrp_repair_warranty.py new file mode 100644 index 0000000..7b28b7b --- /dev/null +++ b/repair_warranty/tests/test_mrp_repair_warranty.py @@ -0,0 +1,34 @@ +# Copyright 2019 Daniel Campos - AvanzOSC +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import odoo.tests.common as common + + +class TestMrpRepairWarranty(common.TransactionCase): + def setUp(self): + super().setUp() + self.mrp_repair_model = self.env["repair.order"] + self.product = self.browse_ref("product.product_product_3") + self.location_id = self.ref("stock.stock_location_locations") + self.customer = self.env["res.partner"].create( + { + "name": "Test Customer", + "is_company": True, + "company_id": self.env.user.company_id.id, + } + ) + vals = { + "name": "test", + "product_id": self.product.id, + "location_id": self.location_id, + "product_uom": self.product.uom_id.id, + "partner_id": self.customer.id, + "invoice_method": "after_repair", + } + self.mrp_repair_customer = self.mrp_repair_model.create(vals) + + def test_warranty(self): + self.assertEqual(self.mrp_repair_customer.invoice_method, "after_repair") + self.mrp_repair_customer.is_in_warranty = True + self.mrp_repair_customer.onchange_warranty() + self.assertEqual(self.mrp_repair_customer.invoice_method, "none") diff --git a/repair_warranty/views/mrp_repair_view.xml b/repair_warranty/views/mrp_repair_view.xml new file mode 100644 index 0000000..a692495 --- /dev/null +++ b/repair_warranty/views/mrp_repair_view.xml @@ -0,0 +1,39 @@ + + + + repair.order + + + + + + + + + + repair.order + + + + + + + + + + repair.order + + + + + + + + + + + + + diff --git a/setup/repair_warranty/odoo/addons/repair_warranty b/setup/repair_warranty/odoo/addons/repair_warranty new file mode 120000 index 0000000..d380058 --- /dev/null +++ b/setup/repair_warranty/odoo/addons/repair_warranty @@ -0,0 +1 @@ +../../../../repair_warranty \ No newline at end of file diff --git a/setup/repair_warranty/setup.py b/setup/repair_warranty/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/repair_warranty/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From 84e4a83843d2d55f5c1213c530a3f835684425f9 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 12:08:51 +0200 Subject: [PATCH 05/13] [IMP] add continuous integration --- .eslintrc.yml | 1 + .github/workflows/pre-commit.yml | 46 +++++++++++++++++++ .gitignore | 5 +- .pre-commit-config.yaml | 37 +++++++++------ LICENSE | 12 ++--- .../odoo/addons/mrp_repair_cancel_reason | 1 + setup/mrp_repair_cancel_reason/setup.py | 6 +++ .../odoo/addons/mrp_repair_date | 1 + setup/mrp_repair_date/setup.py | 6 +++ .../odoo/addons/mrp_repair_full_editable | 1 + setup/mrp_repair_full_editable/setup.py | 6 +++ .../odoo/addons/mrp_repair_type | 1 + setup/mrp_repair_type/setup.py | 6 +++ .../odoo/addons/repair_order_type | 1 + setup/repair_order_type/setup.py | 6 +++ .../odoo/addons/repair_refurbish | 1 + setup/repair_refurbish/setup.py | 6 +++ 17 files changed, 123 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/pre-commit.yml create mode 120000 setup/mrp_repair_cancel_reason/odoo/addons/mrp_repair_cancel_reason create mode 100644 setup/mrp_repair_cancel_reason/setup.py create mode 120000 setup/mrp_repair_date/odoo/addons/mrp_repair_date create mode 100644 setup/mrp_repair_date/setup.py create mode 120000 setup/mrp_repair_full_editable/odoo/addons/mrp_repair_full_editable create mode 100644 setup/mrp_repair_full_editable/setup.py create mode 120000 setup/mrp_repair_type/odoo/addons/mrp_repair_type create mode 100644 setup/mrp_repair_type/setup.py create mode 120000 setup/repair_order_type/odoo/addons/repair_order_type create mode 100644 setup/repair_order_type/setup.py create mode 120000 setup/repair_refurbish/odoo/addons/repair_refurbish create mode 100644 setup/repair_refurbish/setup.py diff --git a/.eslintrc.yml b/.eslintrc.yml index 9429bc6..fed88d7 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -22,6 +22,7 @@ globals: odoo: readonly openerp: readonly owl: readonly + luxon: readonly # Styling is handled by Prettier, so we only need to enable AST rules; # see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..38b0ba1 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,46 @@ +name: pre-commit + +on: + pull_request: + branches: + - "16.0*" + push: + branches: + - "16.0" + - "16.0-ocabot-*" + +jobs: + pre-commit: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v2 + with: + python-version: "3.11" + - name: Get python version + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v1 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure --color=always + env: + # Consider valid a PR that changes README fragments but doesn't + # change the README.rst file itself. It's not really a problem + # because the bot will update it anyway after merge. This way, we + # lower the barrier for functional contributors that want to fix the + # readme fragments, while still letting developers get README + # auto-generated (which also helps functionals when using runboat). + # DOCS https://pre-commit.com/#temporarily-disabling-hooks + SKIP: oca-gen-addon-readme + - name: Check that all files generated by pre-commit are in git + run: | + newfiles="$(git ls-files --others --exclude-from=.gitignore)" + if [ "$newfiles" != "" ] ; then + echo "Please check-in the following files:" + echo "$newfiles" + exit 1 + fi diff --git a/.gitignore b/.gitignore index 9ef94ac..0090721 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ *.py[cod] /.venv /.pytest_cache +/.ruff_cache # C extensions *.so @@ -15,7 +16,6 @@ build/ develop-eggs/ dist/ eggs/ -lib/ lib64/ parts/ sdist/ @@ -70,3 +70,6 @@ docs/_build/ # Backup files *~ *.swp + +# OCA rules +!static/lib/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1769349..df41989 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,12 @@ exclude: | /static/(src/)?lib/| # Repos using Sphinx to generate docs don't need prettying ^docs/_templates/.*\.html$| + # Don't bother non-technical authors with formatting issues in docs + readme/.*\.(rst|md)$| + # Ignore build and dist directories in addons + /build/|/dist/| + # Ignore test files in addons + /tests/samples/.*| # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: @@ -33,14 +39,19 @@ repos: language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/oca/maintainer-tools - rev: 969238e47c07d0c40573acff81d170f63245d738 + rev: 1faff6d90f8a0d189aad3f148c5fc72df3117193 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons - id: oca-fix-manifest-website args: ["https://github.com/avanzosc/mrp-repair-addons"] + - repo: https://github.com/OCA/odoo-pre-commit-hooks + rev: v0.0.25 + hooks: + - id: oca-checks-odoo-module + - id: oca-checks-po - repo: https://github.com/myint/autoflake - rev: v2.2.1 + rev: v2.3.1 hooks: - id: autoflake args: @@ -51,22 +62,22 @@ repos: - --remove-duplicate-keys - --remove-unused-variables - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v4.0.0-alpha.8 hooks: - id: prettier name: prettier (with plugin-xml) additional_dependencies: - - "prettier@2.7.1" - - "@prettier/plugin-xml@2.2.0" + - "prettier@2.1.2" + - "@prettier/plugin-xml@0.12.0" args: - --plugin=@prettier/plugin-xml files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.48.0 + rev: v8.24.0 hooks: - id: eslint verbose: true @@ -74,7 +85,7 @@ repos: - --color - --fix - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: trailing-whitespace # exclude autogenerated files @@ -96,12 +107,12 @@ repos: - id: mixed-line-ending args: ["--fix=lf"] - repo: https://github.com/asottile/pyupgrade - rev: v3.10.1 + rev: v3.16.0 hooks: - id: pyupgrade args: ["--keep-percent-format"] - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort name: isort except __init__.py @@ -109,7 +120,7 @@ repos: - --settings=. exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo - rev: 3.1.12 + rev: "3.3" hooks: - id: setuptools-odoo-make-default - id: setuptools-odoo-get-requirements @@ -119,13 +130,13 @@ repos: - --header - "# generated from manifests external_dependencies" - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.1.0 hooks: - id: flake8 name: flake8 additional_dependencies: ["flake8-bugbear==21.9.2"] - repo: https://github.com/OCA/pylint-odoo - rev: v8.0.20 + rev: v9.1.2 hooks: - id: pylint_odoo name: pylint with optional checks diff --git a/LICENSE b/LICENSE index 3ffc567..be3f7b2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ -GNU AFFERO GENERAL PUBLIC LICENSE + GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -633,8 +633,8 @@ the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -643,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -658,4 +658,4 @@ specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see -. \ No newline at end of file +. diff --git a/setup/mrp_repair_cancel_reason/odoo/addons/mrp_repair_cancel_reason b/setup/mrp_repair_cancel_reason/odoo/addons/mrp_repair_cancel_reason new file mode 120000 index 0000000..4c13284 --- /dev/null +++ b/setup/mrp_repair_cancel_reason/odoo/addons/mrp_repair_cancel_reason @@ -0,0 +1 @@ +../../../../mrp_repair_cancel_reason \ No newline at end of file diff --git a/setup/mrp_repair_cancel_reason/setup.py b/setup/mrp_repair_cancel_reason/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/mrp_repair_cancel_reason/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_repair_date/odoo/addons/mrp_repair_date b/setup/mrp_repair_date/odoo/addons/mrp_repair_date new file mode 120000 index 0000000..a2b7a87 --- /dev/null +++ b/setup/mrp_repair_date/odoo/addons/mrp_repair_date @@ -0,0 +1 @@ +../../../../mrp_repair_date \ No newline at end of file diff --git a/setup/mrp_repair_date/setup.py b/setup/mrp_repair_date/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/mrp_repair_date/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_repair_full_editable/odoo/addons/mrp_repair_full_editable b/setup/mrp_repair_full_editable/odoo/addons/mrp_repair_full_editable new file mode 120000 index 0000000..3438a62 --- /dev/null +++ b/setup/mrp_repair_full_editable/odoo/addons/mrp_repair_full_editable @@ -0,0 +1 @@ +../../../../mrp_repair_full_editable \ No newline at end of file diff --git a/setup/mrp_repair_full_editable/setup.py b/setup/mrp_repair_full_editable/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/mrp_repair_full_editable/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/mrp_repair_type/odoo/addons/mrp_repair_type b/setup/mrp_repair_type/odoo/addons/mrp_repair_type new file mode 120000 index 0000000..9b7342d --- /dev/null +++ b/setup/mrp_repair_type/odoo/addons/mrp_repair_type @@ -0,0 +1 @@ +../../../../mrp_repair_type \ No newline at end of file diff --git a/setup/mrp_repair_type/setup.py b/setup/mrp_repair_type/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/mrp_repair_type/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/repair_order_type/odoo/addons/repair_order_type b/setup/repair_order_type/odoo/addons/repair_order_type new file mode 120000 index 0000000..090063b --- /dev/null +++ b/setup/repair_order_type/odoo/addons/repair_order_type @@ -0,0 +1 @@ +../../../../repair_order_type \ No newline at end of file diff --git a/setup/repair_order_type/setup.py b/setup/repair_order_type/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/repair_order_type/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/repair_refurbish/odoo/addons/repair_refurbish b/setup/repair_refurbish/odoo/addons/repair_refurbish new file mode 120000 index 0000000..8de81cf --- /dev/null +++ b/setup/repair_refurbish/odoo/addons/repair_refurbish @@ -0,0 +1 @@ +../../../../repair_refurbish \ No newline at end of file diff --git a/setup/repair_refurbish/setup.py b/setup/repair_refurbish/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/repair_refurbish/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From a46ce5323c5af1a04eeb87d423920f67d74dca75 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 12:19:07 +0200 Subject: [PATCH 06/13] [IMP] repair_warranty: pre-commit stuff --- repair_warranty/views/mrp_repair_view.xml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/repair_warranty/views/mrp_repair_view.xml b/repair_warranty/views/mrp_repair_view.xml index a692495..abd2b61 100644 --- a/repair_warranty/views/mrp_repair_view.xml +++ b/repair_warranty/views/mrp_repair_view.xml @@ -28,11 +28,17 @@ - - - + + + From 4bba04eccaef48eb63fe162f71d816d156c8e5da Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 12:19:46 +0200 Subject: [PATCH 07/13] [IMP] repair_refurbish: pre-commit stuff --- repair_refurbish/__manifest__.py | 2 +- repair_refurbish/data/stock_data.xml | 12 ++++---- repair_refurbish/models/repair.py | 2 +- .../tests/test_repair_refurbish.py | 2 +- .../views/product_template_view.xml | 14 ++++----- repair_refurbish/views/repair_view.xml | 30 +++++++++---------- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/repair_refurbish/__manifest__.py b/repair_refurbish/__manifest__.py index 6703279..85cf3a1 100644 --- a/repair_refurbish/__manifest__.py +++ b/repair_refurbish/__manifest__.py @@ -5,7 +5,7 @@ "summary": "Create refurbished products during repair", "version": "14.0.1.0.1", "category": "Manufacturing", - "website": "https://github.com/OCA/manufacture", + "website": "https://github.com/avanzosc/mrp-repair-addons", "author": "ForgeFlow S.L., Odoo Community Association (OCA)", "license": "AGPL-3", "installable": True, diff --git a/repair_refurbish/data/stock_data.xml b/repair_refurbish/data/stock_data.xml index 2c45818..248f150 100644 --- a/repair_refurbish/data/stock_data.xml +++ b/repair_refurbish/data/stock_data.xml @@ -12,13 +12,13 @@ property_stock_refurbish + name="fields_id" + search="[('model','=','product.template'),('name','=','property_stock_refurbish')]" + /> + eval="'stock.location,'+str(stock_location_refurbish)" + name="value" + /> diff --git a/repair_refurbish/models/repair.py b/repair_refurbish/models/repair.py index 99e5df8..6a51326 100644 --- a/repair_refurbish/models/repair.py +++ b/repair_refurbish/models/repair.py @@ -94,7 +94,7 @@ class RepairLine(models.Model): @api.onchange("type", "repair_id") def onchange_operation_type(self): - res = super(RepairLine, self).onchange_operation_type() + res = super().onchange_operation_type() context = self.env.context if self.type == "add" and "to_refurbish" in context and context["to_refurbish"]: self.location_dest_id = context["refurbish_location_dest_id"] diff --git a/repair_refurbish/tests/test_repair_refurbish.py b/repair_refurbish/tests/test_repair_refurbish.py index b05b4a0..cd8aed7 100644 --- a/repair_refurbish/tests/test_repair_refurbish.py +++ b/repair_refurbish/tests/test_repair_refurbish.py @@ -6,7 +6,7 @@ class TestMrpMtoWithStock(TransactionCase): def setUp(self, *args, **kwargs): - super(TestMrpMtoWithStock, self).setUp(*args, **kwargs) + super().setUp(*args, **kwargs) self.repair_obj = self.env["repair.order"] self.repair_line_obj = self.env["repair.line"] self.product_obj = self.env["product.product"] diff --git a/repair_refurbish/views/product_template_view.xml b/repair_refurbish/views/product_template_view.xml index 9bfd935..4f4eb9b 100644 --- a/repair_refurbish/views/product_template_view.xml +++ b/repair_refurbish/views/product_template_view.xml @@ -7,10 +7,10 @@ + name="refurbish" + string="Refurbish" + attrs="{'invisible':[('product_variant_count', '>', 1)]}" + > @@ -23,9 +23,9 @@ + name="property_stock_refurbish" + domain="[('usage','=','production')]" + /> diff --git a/repair_refurbish/views/repair_view.xml b/repair_refurbish/views/repair_view.xml index 07c4a27..a3b4a35 100644 --- a/repair_refurbish/views/repair_view.xml +++ b/repair_refurbish/views/repair_view.xml @@ -17,9 +17,9 @@ + name="location_dest_id" + attrs="{'invisible': [('to_refurbish', '=', False)], 'required': [('to_refurbish', '=', True)]}" + /> @@ -27,24 +27,24 @@ + name="refurbish_product_id" + attrs="{'required': [('to_refurbish', '=', True)]}" + /> + name="refurbish_lot_id" + context="{'default_product_id': refurbish_product_id, 'default_company_id': company_id}" + groups="stock.group_production_lot" + /> + name="refurbish_location_dest_id" + attrs="{'required': [('to_refurbish', '=', True)]}" + /> {'default_product_uom_qty': product_qty, 'to_refurbish': to_refurbish, 'refurbish_location_dest_id': location_dest_id} + name='context' + >{'default_product_uom_qty': product_qty, 'to_refurbish': to_refurbish, 'refurbish_location_dest_id': location_dest_id} From 7e02819d6153a5a23d39ebbc696dc36647387c13 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 12:20:06 +0200 Subject: [PATCH 08/13] [IMP] repair_order_type: pre-commit stuff --- repair_order_type/__manifest__.py | 6 +- repair_order_type/data/default_type.xml | 4 +- repair_order_type/models/repair_line.py | 9 +- repair_order_type/models/repair_order.py | 27 ++--- repair_order_type/models/repair_order_type.py | 33 +++--- repair_order_type/models/stock_location.py | 6 +- .../views/repair_order_type_view.xml | 111 ++++++++++++------ repair_order_type/views/repair_order_view.xml | 28 +++-- .../views/stock_location_view.xml | 10 +- 9 files changed, 137 insertions(+), 97 deletions(-) diff --git a/repair_order_type/__manifest__.py b/repair_order_type/__manifest__.py index 1a06046..2b88c1f 100644 --- a/repair_order_type/__manifest__.py +++ b/repair_order_type/__manifest__.py @@ -5,10 +5,10 @@ "version": "16.0.1.0.0", "category": "Manufacturing", "author": "AvanzOSC", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-repair-addons", "license": "AGPL-3", "depends": [ - 'repair', + "repair", ], "data": [ "security/ir.model.access.csv", @@ -17,5 +17,5 @@ "views/repair_order_type_view.xml", "views/stock_location_view.xml", ], - 'installable': True, + "installable": True, } diff --git a/repair_order_type/data/default_type.xml b/repair_order_type/data/default_type.xml index 902f959..c694d52 100644 --- a/repair_order_type/data/default_type.xml +++ b/repair_order_type/data/default_type.xml @@ -1,7 +1,7 @@ - + Normal Order - + diff --git a/repair_order_type/models/repair_line.py b/repair_order_type/models/repair_line.py index 43e5ef2..5f11ea4 100644 --- a/repair_order_type/models/repair_line.py +++ b/repair_order_type/models/repair_line.py @@ -4,14 +4,15 @@ class RepairLine(models.Model): - _inherit = 'repair.line' + _inherit = "repair.line" - @api.onchange('type', 'repair_id', 'repair_id.type_id') + @api.onchange("type", "repair_id", "repair_id.type_id") def onchange_operation_type(self): - super(RepairLine, self).onchange_operation_type() - if self.type == 'add': + res = super().onchange_operation_type() + if self.type == "add": self.location_id = self.repair_id.type_id.location_id.id self.location_dest_id = self.repair_id.type_id.location_dest_id.id else: self.location_id = self.repair_id.type_id.location_dest_id.id self.location_dest_id = self.repair_id.type_id.location_id.id + return res diff --git a/repair_order_type/models/repair_order.py b/repair_order_type/models/repair_order.py index bafa0fb..6605898 100644 --- a/repair_order_type/models/repair_order.py +++ b/repair_order_type/models/repair_order.py @@ -4,43 +4,42 @@ class RepairOrder(models.Model): - _inherit = 'repair.order' + _inherit = "repair.order" def _get_order_type(self): - return self.env['repair.order.type'].search([], limit=1) + return self.env["repair.order.type"].search([], limit=1) name = fields.Char(default="/") type_id = fields.Many2one( - comodel_name='repair.order.type', - string='Type', + comodel_name="repair.order.type", + string="Type", default=_get_order_type, required=True, readonly=True, - states={"draft": [("readonly", False)]} + states={"draft": [("readonly", False)]}, ) - @api.onchange('type_id') + @api.onchange("type_id") def onchange_location_id(self): if self.type_id and self.type_id.reparation_location_id: self.location_id = self.type_id.reparation_location_id.id @api.model def create(self, vals): - if vals.get('name', '/') == '/' and vals.get('type_id'): - repair_type = self.env['repair.order.type'].browse(vals['type_id']) + if vals.get("name", "/") == "/" and vals.get("type_id"): + repair_type = self.env["repair.order.type"].browse(vals["type_id"]) if repair_type.sequence_id: - vals['name'] = repair_type.sequence_id.next_by_id() - return super(RepairOrder, self).create(vals) + vals["name"] = repair_type.sequence_id.next_by_id() + return super().create(vals) def write(self, vals): if vals.get("type_id"): repair_type = self.env["repair.order.type"].browse(vals["type_id"]) if repair_type.sequence_id: for record in self: - if ( - record.state in {"draft"}) and ( - record.type_id.sequence_id != ( - repair_type.sequence_id)): + if (record.state in {"draft"}) and ( + record.type_id.sequence_id != (repair_type.sequence_id) + ): new_vals = vals.copy() new_vals["name"] = repair_type.sequence_id.next_by_id() super(RepairOrder, record).write(new_vals) diff --git a/repair_order_type/models/repair_order_type.py b/repair_order_type/models/repair_order_type.py index 30916eb..c517b4f 100644 --- a/repair_order_type/models/repair_order_type.py +++ b/repair_order_type/models/repair_order_type.py @@ -4,28 +4,29 @@ class RepairOrderType(models.Model): - _name = 'repair.order.type' - _description = 'Repair Order Type' - _order = 'sequence' + _name = "repair.order.type" + _description = "Repair Order Type" + _order = "sequence" @api.model def _get_domain_sequence_id(self): - seq_type = self.env.ref('repair.seq_repair') - return [('code', '=', seq_type.code)] + seq_type = self.env.ref("repair.seq_repair") + return [("code", "=", seq_type.code)] - name = fields.Char(string='Name', required=True) - sequence = fields.Integer(string='Sequence') + name = fields.Char(required=True) + sequence = fields.Integer() sequence_id = fields.Many2one( - comodel_name='ir.sequence', - string='Entry Sequence', + comodel_name="ir.sequence", + string="Entry Sequence", copy=False, - domain=_get_domain_sequence_id) + domain=_get_domain_sequence_id, + ) reparation_location_id = fields.Many2one( - string='Reparation Location', - comodel_name='stock.location') + string="Reparation Location", comodel_name="stock.location" + ) location_id = fields.Many2one( - string='Location Origin', - comodel_name='stock.location') + string="Location Origin", comodel_name="stock.location" + ) location_dest_id = fields.Many2one( - string='Destination Location', - comodel_name='stock.location') + string="Destination Location", comodel_name="stock.location" + ) diff --git a/repair_order_type/models/stock_location.py b/repair_order_type/models/stock_location.py index c2715c4..b04f755 100644 --- a/repair_order_type/models/stock_location.py +++ b/repair_order_type/models/stock_location.py @@ -4,8 +4,6 @@ class StockLocation(models.Model): - _inherit = 'stock.location' + _inherit = "stock.location" - repair_eligible = fields.Boolean( - string='Eligible in Repairs', - default=False) + repair_eligible = fields.Boolean(string="Eligible in Repairs", default=False) diff --git a/repair_order_type/views/repair_order_type_view.xml b/repair_order_type/views/repair_order_type_view.xml index 737a64d..52deada 100644 --- a/repair_order_type/views/repair_order_type_view.xml +++ b/repair_order_type/views/repair_order_type_view.xml @@ -1,4 +1,4 @@ - + repair.order.type.form.view @@ -8,20 +8,29 @@
-
- + - - - + + +
@@ -34,12 +43,12 @@ repair.order.type - - - - - - + + + + + +
@@ -49,20 +58,36 @@ repair.order.type - - - - - + + + + + - - - - + + + + @@ -72,32 +97,40 @@ Repair Order Types repair.order.type form,tree - + -

Click to set a new type for repair order.

+

Click to set a new type for repair order.

- + form - - + + - + tree - - + + + id="menu_repair_configuration" + name="Configuration" + parent="repair.menu_repair_order" + /> - +
diff --git a/repair_order_type/views/repair_order_view.xml b/repair_order_type/views/repair_order_view.xml index d2efc28..4db3c66 100644 --- a/repair_order_type/views/repair_order_view.xml +++ b/repair_order_type/views/repair_order_view.xml @@ -1,19 +1,25 @@ - + repair.order - + [('repair_eligible', '=', True)] - + - + [('repair_eligible', '=', True)] - + [('repair_eligible', '=', True)] @@ -21,15 +27,17 @@ repair.order - + - + - + diff --git a/repair_order_type/views/stock_location_view.xml b/repair_order_type/views/stock_location_view.xml index 64af5e2..bbfbf7c 100644 --- a/repair_order_type/views/stock_location_view.xml +++ b/repair_order_type/views/stock_location_view.xml @@ -1,21 +1,21 @@ - + stock.location - + - + stock.location - + - + From b88ebcc12c1555276638cc5dee20b049fdccb76b Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 12:20:19 +0200 Subject: [PATCH 09/13] [IMP] mrp_repair_type: pre-commit stuff --- mrp_repair_type/__manifest__.py | 2 +- mrp_repair_type/models/mrp_repair.py | 10 +++++----- mrp_repair_type/views/mrp_repair_view.xml | 17 +++++++++-------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/mrp_repair_type/__manifest__.py b/mrp_repair_type/__manifest__.py index 865fd54..b896284 100644 --- a/mrp_repair_type/__manifest__.py +++ b/mrp_repair_type/__manifest__.py @@ -7,7 +7,7 @@ "category": "Manufacturing", "license": "AGPL-3", "author": "AvanzOSC", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-repair-addons", "contributors": [ "Daniel Campos ", "Ana Juaristi ", diff --git a/mrp_repair_type/models/mrp_repair.py b/mrp_repair_type/models/mrp_repair.py index 9ec3c3e..522607c 100644 --- a/mrp_repair_type/models/mrp_repair.py +++ b/mrp_repair_type/models/mrp_repair.py @@ -5,14 +5,14 @@ class RepairOrderType(models.Model): - _name = 'repair.order.type' + _name = "repair.order.type" - name = fields.Char(string='Repair type', help='Repair order type', - translate=True) + name = fields.Char(string="Repair type", help="Repair order type", translate=True) class RepairOrder(models.Model): - _inherit = 'repair.order' + _inherit = "repair.order" repair_type_id = fields.Many2one( - comodel_name='repair.order.type', string='Repair order type') + comodel_name="repair.order.type", string="Repair order type" + ) diff --git a/mrp_repair_type/views/mrp_repair_view.xml b/mrp_repair_type/views/mrp_repair_view.xml index 68c9c3d..df6a199 100644 --- a/mrp_repair_type/views/mrp_repair_view.xml +++ b/mrp_repair_type/views/mrp_repair_view.xml @@ -1,7 +1,6 @@ - + - repair.order.form repair.order @@ -12,10 +11,9 @@ - repair.order.type.tree repair.order.type - + @@ -23,7 +21,6 @@ - repair.order.form.filter repair.order @@ -48,6 +45,10 @@ - - \ No newline at end of file + + From 374e27779c27757e8c5fcb7e95862adadd8de699 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 12:20:32 +0200 Subject: [PATCH 10/13] [IMP] mrp_repair_full_editable: pre-commit stuff --- mrp_repair_full_editable/__manifest__.py | 2 +- mrp_repair_full_editable/models/repair_order.py | 9 +++++---- .../tests/test_repair_full_editable.py | 10 +++++----- .../views/repair_order_view.xml | 14 ++++++++++---- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/mrp_repair_full_editable/__manifest__.py b/mrp_repair_full_editable/__manifest__.py index a8847e9..e856d30 100644 --- a/mrp_repair_full_editable/__manifest__.py +++ b/mrp_repair_full_editable/__manifest__.py @@ -5,7 +5,7 @@ "version": "16.0.1.0.0", "author": "OdooMRP team", "license": "AGPL-3", - "website": "http://www.odoomrp.com", + "website": "https://github.com/avanzosc/mrp-repair-addons", "depends": [ "repair", ], diff --git a/mrp_repair_full_editable/models/repair_order.py b/mrp_repair_full_editable/models/repair_order.py index bd6a388..15b2283 100644 --- a/mrp_repair_full_editable/models/repair_order.py +++ b/mrp_repair_full_editable/models/repair_order.py @@ -4,13 +4,14 @@ class RepairOrder(models.Model): - _inherit = 'repair.order' + _inherit = "repair.order" fees_lines = fields.One2many(readonly=False) operations = fields.One2many(readonly=False) - @api.onchange('product_id') + @api.onchange("product_id") def onchange_product_id(self): - super(RepairOrder, self).onchange_product_id() + res = super().onchange_product_id() if not self.partner_id: - self.pricelist_id = self.env.ref('product.list0') + self.pricelist_id = self.env.ref("product.list0") + return res diff --git a/mrp_repair_full_editable/tests/test_repair_full_editable.py b/mrp_repair_full_editable/tests/test_repair_full_editable.py index 858f973..f78d34e 100644 --- a/mrp_repair_full_editable/tests/test_repair_full_editable.py +++ b/mrp_repair_full_editable/tests/test_repair_full_editable.py @@ -9,13 +9,13 @@ class TestRepairFullEditable(common.TransactionCase): def setUp(self): - super(TestRepairFullEditable, self).setUp() - self.repair = self.env.ref('repair.repair_r1') - self.product = self.ref('product.product_product_2') - self.pricelist = self.env.ref('product.list0') + super().setUp() + self.repair = self.env.ref("repair.repair_r1") + self.product = self.ref("product.product_product_2") + self.pricelist = self.env.ref("product.list0") def test_onchange_product_id(self): - self.repair.partner_id = '' + self.repair.partner_id = "" self.repair.product_id = self.product self.repair.onchange_product_id() self.assertEqual(self.repair.pricelist_id, self.pricelist) diff --git a/mrp_repair_full_editable/views/repair_order_view.xml b/mrp_repair_full_editable/views/repair_order_view.xml index 2c4337d..04d78e1 100644 --- a/mrp_repair_full_editable/views/repair_order_view.xml +++ b/mrp_repair_full_editable/views/repair_order_view.xml @@ -1,4 +1,4 @@ - + repair.order @@ -6,13 +6,19 @@ - {'readonly': ['|', '&', ('invoice_method', '!=', 'b4repair'),('state','=','done')]} + {'readonly': ['|', '&', ('invoice_method', '!=', 'b4repair'),('state','=','done')]} - {'readonly': ['|', '&', ('invoice_method', '!=', 'b4repair'),('state','=','done')]} + {'readonly': ['|', '&', ('invoice_method', '!=', 'b4repair'),('state','=','done')]} - {'readonly': ['|', '&', ('invoice_method', '!=', 'b4repair'),('state','=','done')]} + {'readonly': ['|', '&', ('invoice_method', '!=', 'b4repair'),('state','=','done')]} From c62facb13d3fd827dad3b1a372354c12bee9d63f Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 12:20:42 +0200 Subject: [PATCH 11/13] [IMP] mrp_repair_date: pre-commit stuff --- mrp_repair_date/__init__.py | 0 mrp_repair_date/__manifest__.py | 26 ++++----- mrp_repair_date/models/__init__.py | 0 mrp_repair_date/models/mrp_repair.py | 25 ++++---- mrp_repair_date/tests/__init__.py | 0 mrp_repair_date/tests/test_mrp_repair_date.py | 57 +++++++++++-------- mrp_repair_date/views/mrp_repair_view.xml | 10 +++- 7 files changed, 63 insertions(+), 55 deletions(-) mode change 100755 => 100644 mrp_repair_date/__init__.py mode change 100755 => 100644 mrp_repair_date/__manifest__.py mode change 100755 => 100644 mrp_repair_date/models/__init__.py mode change 100755 => 100644 mrp_repair_date/models/mrp_repair.py mode change 100755 => 100644 mrp_repair_date/tests/__init__.py mode change 100755 => 100644 mrp_repair_date/tests/test_mrp_repair_date.py mode change 100755 => 100644 mrp_repair_date/views/mrp_repair_view.xml diff --git a/mrp_repair_date/__init__.py b/mrp_repair_date/__init__.py old mode 100755 new mode 100644 diff --git a/mrp_repair_date/__manifest__.py b/mrp_repair_date/__manifest__.py old mode 100755 new mode 100644 index c5735d0..2a5aa8a --- a/mrp_repair_date/__manifest__.py +++ b/mrp_repair_date/__manifest__.py @@ -1,22 +1,22 @@ # (c) 2015 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { - 'name': 'MRP Repair Date', + "name": "MRP Repair Date", "version": "16.0.1.0.0", - "license": 'AGPL-3', - "author": 'OdooMRP team,' - 'AvanzOSC,' - 'Serv. Tecnol. Avanzados - Pedro M. Baeza', - 'website': "http://www.odoomrp.com", + "license": "AGPL-3", + "author": "OdooMRP team," "AvanzOSC," "Serv. Tecnol. Avanzados - Pedro M. Baeza", + "website": "https://github.com/avanzosc/mrp-repair-addons", "contributors": [ "Ana Juaristi ", "Oihane Crucelaegui ", "Alfredo de la Fuente ", - ], - 'category': 'Manufacturing', - 'depends': ['mrp_repair', - ], - 'data': ['views/mrp_repair_view.xml', - ], - 'installable': True, + ], + "category": "Manufacturing", + "depends": [ + "mrp_repair", + ], + "data": [ + "views/mrp_repair_view.xml", + ], + "installable": True, } diff --git a/mrp_repair_date/models/__init__.py b/mrp_repair_date/models/__init__.py old mode 100755 new mode 100644 diff --git a/mrp_repair_date/models/mrp_repair.py b/mrp_repair_date/models/mrp_repair.py old mode 100755 new mode 100644 index c7ec35b..3b3932b --- a/mrp_repair_date/models/mrp_repair.py +++ b/mrp_repair_date/models/mrp_repair.py @@ -1,29 +1,26 @@ # (c) 2015 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from odoo import models, fields, api +from odoo import fields, models class MrpRepair(models.Model): - _inherit = 'repair.order' + _inherit = "repair.order" - scheduled_departure_date = fields.Date( - string='Scheduled Departure Date', copy=False) - start_date = fields.Date( - string='Start Date', readonly=True, copy=False) - end_date = fields.Date( - string='End Date', readonly=True, copy=False) + scheduled_departure_date = fields.Date(copy=False) + start_date = fields.Date(readonly=True, copy=False) + end_date = fields.Date(readonly=True, copy=False) def action_repair_start(self): - result = super(MrpRepair, self).action_repair_start() - self.write({'start_date': fields.Date.context_today(self)}) + result = super().action_repair_start() + self.write({"start_date": fields.Date.context_today(self)}) return result def action_repair_end(self): - result = super(MrpRepair, self).action_repair_end() - self.write({'end_date': fields.Date.context_today(self)}) + result = super().action_repair_end() + self.write({"end_date": fields.Date.context_today(self)}) return result def action_cancel_draft(self): - result = super(MrpRepair, self).action_cancel_draft() - self.write({'start_date': False, 'end_date': False}) + result = super().action_cancel_draft() + self.write({"start_date": False, "end_date": False}) return result diff --git a/mrp_repair_date/tests/__init__.py b/mrp_repair_date/tests/__init__.py old mode 100755 new mode 100644 diff --git a/mrp_repair_date/tests/test_mrp_repair_date.py b/mrp_repair_date/tests/test_mrp_repair_date.py old mode 100755 new mode 100644 index df6da61..0498e7e --- a/mrp_repair_date/tests/test_mrp_repair_date.py +++ b/mrp_repair_date/tests/test_mrp_repair_date.py @@ -6,35 +6,42 @@ class TestMrpRepairDate(common.TransactionCase): def setUp(self): - super(TestMrpRepairDate, self).setUp() - self.data_model = self.env['ir.model.data'] - fee_vals = {'user_id': self.env.ref('base.user_root').id, - 'name': 'Test mrp repair dates', - 'product_uom': self.env.ref('product.product_uom_unit').id, - 'price_unit': 1, - 'product_uom_qty': 5} - vals = {'product_id': self.env.ref('product.product_product_8').id, - 'product_uom': self.env.ref('product.product_uom_unit').id, - 'location_id': self.env.ref('stock.stock_location_7').id, - 'location_dest_id': self.env.ref('stock.stock_location_7').id, - 'fees_lines': [(0, 0, fee_vals)]} - self.repair = self.env['repair.order'].create(vals) + super().setUp() + self.data_model = self.env["ir.model.data"] + fee_vals = { + "user_id": self.env.ref("base.user_root").id, + "name": "Test mrp repair dates", + "product_uom": self.env.ref("product.product_uom_unit").id, + "price_unit": 1, + "product_uom_qty": 5, + } + vals = { + "product_id": self.env.ref("product.product_product_8").id, + "product_uom": self.env.ref("product.product_uom_unit").id, + "location_id": self.env.ref("stock.stock_location_7").id, + "location_dest_id": self.env.ref("stock.stock_location_7").id, + "fees_lines": [(0, 0, fee_vals)], + } + self.repair = self.env["repair.order"].create(vals) def test_mrp_repair_date(self): - self.repair.signal_workflow('repair_confirm') - self.repair.signal_workflow('repair_ready') + self.repair.signal_workflow("repair_confirm") + self.repair.signal_workflow("repair_ready") self.assertNotEqual( - self.repair.start_date, False, - 'Repair initiated, and is not loaded start date') + self.repair.start_date, + False, + "Repair initiated, and is not loaded start date", + ) self.repair.action_cancel() self.repair.action_cancel_draft() self.assertEqual( - self.repair.start_date, False, - 'Repair to draft, and it did not initialize the value of start ' - 'date') - self.repair.signal_workflow('repair_confirm') - self.repair.signal_workflow('repair_ready') - self.repair.signal_workflow('action_repair_end') + self.repair.start_date, + False, + "Repair to draft, and it did not initialize the value of start " "date", + ) + self.repair.signal_workflow("repair_confirm") + self.repair.signal_workflow("repair_ready") + self.repair.signal_workflow("action_repair_end") self.assertNotEqual( - self.repair.end_date, False, - 'Repair finished, and is not loaded end date') + self.repair.end_date, False, "Repair finished, and is not loaded end date" + ) diff --git a/mrp_repair_date/views/mrp_repair_view.xml b/mrp_repair_date/views/mrp_repair_view.xml old mode 100755 new mode 100644 index bab9aed..fcff650 --- a/mrp_repair_date/views/mrp_repair_view.xml +++ b/mrp_repair_date/views/mrp_repair_view.xml @@ -1,11 +1,15 @@ - + view.repair.order.calendar repair.order - - + + From c16cf6b391dc42359210e9ef4e1569ba6a559e47 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 26 Jun 2024 12:21:01 +0200 Subject: [PATCH 12/13] [IMP] mrp_repair_cancel_reason: pre-commit stuff --- mrp_repair_cancel_reason/__init__.py | 1 - mrp_repair_cancel_reason/__manifest__.py | 39 +++++----- .../data/repair_order_cancel_reason.xml | 14 ++-- mrp_repair_cancel_reason/models/__init__.py | 1 - .../models/repair_order.py | 18 +++-- .../security/ir.model.access.csv | 0 mrp_repair_cancel_reason/tests/__init__.py | 1 - .../tests/test_repair_order_cancel_reason.py | 54 +++++++------ .../views/repair_order_cancel_reason_view.xml | 65 ++++++++-------- .../views/repair_order_view.xml | 55 +++++++------- mrp_repair_cancel_reason/wizard/__init__.py | 1 - .../wizard/wiz_repair_order_cancel_reason.py | 20 ++--- .../wiz_repair_order_cancel_reason_view.xml | 76 ++++++++++--------- 13 files changed, 176 insertions(+), 169 deletions(-) mode change 100755 => 100644 mrp_repair_cancel_reason/__init__.py mode change 100755 => 100644 mrp_repair_cancel_reason/__manifest__.py mode change 100755 => 100644 mrp_repair_cancel_reason/data/repair_order_cancel_reason.xml mode change 100755 => 100644 mrp_repair_cancel_reason/models/__init__.py mode change 100755 => 100644 mrp_repair_cancel_reason/models/repair_order.py mode change 100755 => 100644 mrp_repair_cancel_reason/security/ir.model.access.csv mode change 100755 => 100644 mrp_repair_cancel_reason/tests/__init__.py mode change 100755 => 100644 mrp_repair_cancel_reason/tests/test_repair_order_cancel_reason.py mode change 100755 => 100644 mrp_repair_cancel_reason/wizard/__init__.py mode change 100755 => 100644 mrp_repair_cancel_reason/wizard/wiz_repair_order_cancel_reason.py mode change 100755 => 100644 mrp_repair_cancel_reason/wizard/wiz_repair_order_cancel_reason_view.xml diff --git a/mrp_repair_cancel_reason/__init__.py b/mrp_repair_cancel_reason/__init__.py old mode 100755 new mode 100644 index ea48e70..9a6cfc4 --- a/mrp_repair_cancel_reason/__init__.py +++ b/mrp_repair_cancel_reason/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import wizard diff --git a/mrp_repair_cancel_reason/__manifest__.py b/mrp_repair_cancel_reason/__manifest__.py old mode 100755 new mode 100644 index 9d2061c..1153801 --- a/mrp_repair_cancel_reason/__manifest__.py +++ b/mrp_repair_cancel_reason/__manifest__.py @@ -1,27 +1,28 @@ -# -*- coding: utf-8 -*- # (c) 2015 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { - 'name': 'MRP Repair Cancel Reason', + "name": "MRP Repair Cancel Reason", "version": "16.0.1.0.0", - "license": 'AGPL-3', - "author": 'AvanzOSC', - 'website': "http://www.odoomrp.com", + "license": "AGPL-3", + "author": "AvanzOSC", + "website": "https://github.com/avanzosc/mrp-repair-addons", "contributors": [ "Ana Juaristi ", "Alfredo de la Fuente ", - ], - 'category': 'Manufacturing', - 'depends': ['product', - 'stock', - 'mrp', - 'repair', - ], - 'data': ['security/ir.model.access.csv', - 'data/repair_order_cancel_reason.xml', - 'wizard/wiz_repair_order_cancel_reason_view.xml', - 'views/repair_order_view.xml', - 'views/repair_order_cancel_reason_view.xml', - ], - 'installable': True, + ], + "category": "Manufacturing", + "depends": [ + "product", + "stock", + "mrp", + "repair", + ], + "data": [ + "security/ir.model.access.csv", + "data/repair_order_cancel_reason.xml", + "wizard/wiz_repair_order_cancel_reason_view.xml", + "views/repair_order_view.xml", + "views/repair_order_cancel_reason_view.xml", + ], + "installable": True, } diff --git a/mrp_repair_cancel_reason/data/repair_order_cancel_reason.xml b/mrp_repair_cancel_reason/data/repair_order_cancel_reason.xml old mode 100755 new mode 100644 index 29fb792..6ace45a --- a/mrp_repair_cancel_reason/data/repair_order_cancel_reason.xml +++ b/mrp_repair_cancel_reason/data/repair_order_cancel_reason.xml @@ -1,8 +1,6 @@ - - - - - Canceled at customer request - - - + + + + Canceled at customer request + + diff --git a/mrp_repair_cancel_reason/models/__init__.py b/mrp_repair_cancel_reason/models/__init__.py old mode 100755 new mode 100644 index b859987..643c8ac --- a/mrp_repair_cancel_reason/models/__init__.py +++ b/mrp_repair_cancel_reason/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import repair_order diff --git a/mrp_repair_cancel_reason/models/repair_order.py b/mrp_repair_cancel_reason/models/repair_order.py old mode 100755 new mode 100644 index 0ad7d8a..0f259dd --- a/mrp_repair_cancel_reason/models/repair_order.py +++ b/mrp_repair_cancel_reason/models/repair_order.py @@ -1,19 +1,21 @@ -# -*- coding: utf-8 -*- # (c) 2015 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from odoo import models, fields +from odoo import fields, models class MrpRepair(models.Model): - _inherit = 'repair.order' + _inherit = "repair.order" cancel_reason_id = fields.Many2one( - 'repair.order.cancel.reason', string='Reason for cancellation', - readonly=True, ondelete='restrict') + "repair.order.cancel.reason", + string="Reason for cancellation", + readonly=True, + ondelete="restrict", + ) class MrpRepairCancelReason(models.Model): - _name = 'repair.order.cancel.reason' - _description = 'Repair Cancel Reason' + _name = "repair.order.cancel.reason" + _description = "Repair Cancel Reason" - name = fields.Char('Reason', required=True, translate=True) + name = fields.Char("Reason", required=True, translate=True) diff --git a/mrp_repair_cancel_reason/security/ir.model.access.csv b/mrp_repair_cancel_reason/security/ir.model.access.csv old mode 100755 new mode 100644 diff --git a/mrp_repair_cancel_reason/tests/__init__.py b/mrp_repair_cancel_reason/tests/__init__.py old mode 100755 new mode 100644 index 52a2ef8..e17c2a5 --- a/mrp_repair_cancel_reason/tests/__init__.py +++ b/mrp_repair_cancel_reason/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import test_repair_order_cancel_reason diff --git a/mrp_repair_cancel_reason/tests/test_repair_order_cancel_reason.py b/mrp_repair_cancel_reason/tests/test_repair_order_cancel_reason.py old mode 100755 new mode 100644 index a10bac4..4ffdcab --- a/mrp_repair_cancel_reason/tests/test_repair_order_cancel_reason.py +++ b/mrp_repair_cancel_reason/tests/test_repair_order_cancel_reason.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html import openerp.tests.common as common @@ -7,39 +6,48 @@ class TestMrpRepairCancelReason(common.TransactionCase): def setUp(self): - super(TestMrpRepairCancelReason, self).setUp() - self.data_model = self.env['ir.model.data'] - self.repair_order_model = self.env['repair.order'] - self.wiz_model = self.env['wiz.repair.order.cancel.reason'] - self.product = self.env.ref('product.product_product_6') - self.warehouse = self.data_model.get_object('stock', 'warehouse0') - vals = {'product_id': self.product.id, - 'location_id': self.warehouse.lot_stock_id.id, - 'location_dest_id': self.warehouse.lot_stock_id.id, - 'product_uom': self.product.uom_id.id} + super().setUp() + self.data_model = self.env["ir.model.data"] + self.repair_order_model = self.env["repair.order"] + self.wiz_model = self.env["wiz.repair.order.cancel.reason"] + self.product = self.env.ref("product.product_product_6") + self.warehouse = self.data_model.get_object("stock", "warehouse0") + vals = { + "product_id": self.product.id, + "location_id": self.warehouse.lot_stock_id.id, + "location_dest_id": self.warehouse.lot_stock_id.id, + "product_uom": self.product.uom_id.id, + } self.repair_order = self.repair_order_model.create(vals) self.reason = self.env.ref( - 'repair_order_cancel_reason.mrp_cancel_reason_customer') + "repair_order_cancel_reason.mrp_cancel_reason_customer" + ) def test_wizard_cancel_draft_repair_with_reason(self): - vals = {'reason_id': self.reason.id} + vals = {"reason_id": self.reason.id} wiz = self.wiz_model.create(vals) wiz.with_context(active_ids=[self.repair_order.id]).confirm_cancel() self.assertEqual( - self.repair_order.state, 'cancel', - 'Repair order not in CANCEL state') + self.repair_order.state, "cancel", "Repair order not in CANCEL state" + ) self.assertEqual( - self.repair_order.cancel_reason_id.id, self.reason.id, - 'Repair order canceled without cancel reason') + self.repair_order.cancel_reason_id.id, + self.reason.id, + "Repair order canceled without cancel reason", + ) def test_wizard_cancel_confirmed_repair_with_reason(self): - self.repair_order.signal_workflow('repair_confirm') - vals = {'reason_id': self.reason.id} + self.repair_order.signal_workflow("repair_confirm") + vals = {"reason_id": self.reason.id} wiz = self.wiz_model.create(vals) wiz.with_context(active_ids=[self.repair_order.id]).confirm_cancel() self.assertEqual( - self.repair_order.state, 'cancel', - 'Confirmed Repair order not in CANCEL state') + self.repair_order.state, + "cancel", + "Confirmed Repair order not in CANCEL state", + ) self.assertEqual( - self.repair_order.cancel_reason_id.id, self.reason.id, - 'Confirmed Repair order canceled without cancel reason') + self.repair_order.cancel_reason_id.id, + self.reason.id, + "Confirmed Repair order canceled without cancel reason", + ) diff --git a/mrp_repair_cancel_reason/views/repair_order_cancel_reason_view.xml b/mrp_repair_cancel_reason/views/repair_order_cancel_reason_view.xml index 35bdd4d..4d30147 100644 --- a/mrp_repair_cancel_reason/views/repair_order_cancel_reason_view.xml +++ b/mrp_repair_cancel_reason/views/repair_order_cancel_reason_view.xml @@ -1,33 +1,32 @@ - - - - - repair.order.cancel.reason.form.view - repair.order.cancel.reason - -
- - -
-
- - repair.order.cancel.reason.tree.view - repair.order.cancel.reason - - - - - - - - Repair Cancel Reason - repair.order.cancel.reason - tree,form - - -
-
+ + + + repair.order.cancel.reason + +
+ + +
+
+ + repair.order.cancel.reason + + + + + + + + Repair Cancel Reason + repair.order.cancel.reason + tree,form + + +
diff --git a/mrp_repair_cancel_reason/views/repair_order_view.xml b/mrp_repair_cancel_reason/views/repair_order_view.xml index 664517f..2ca40da 100644 --- a/mrp_repair_cancel_reason/views/repair_order_view.xml +++ b/mrp_repair_cancel_reason/views/repair_order_view.xml @@ -1,28 +1,29 @@ - - - - - view.repair.order.form.inh.cancel.reason - repair.order - - - - - - - True - - -