diff --git a/mrp_production_initial_quality_control/__init__.py b/mrp_production_initial_quality_control/__init__.py index 79e546940..11cade92d 100644 --- a/mrp_production_initial_quality_control/__init__.py +++ b/mrp_production_initial_quality_control/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2018 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import models diff --git a/mrp_production_initial_quality_control/__openerp__.py b/mrp_production_initial_quality_control/__manifest__.py similarity index 68% rename from mrp_production_initial_quality_control/__openerp__.py rename to mrp_production_initial_quality_control/__manifest__.py index 15eccca3c..c8ca3d07b 100644 --- a/mrp_production_initial_quality_control/__openerp__.py +++ b/mrp_production_initial_quality_control/__manifest__.py @@ -1,24 +1,22 @@ -# -*- coding: utf-8 -*- # Copyright 2019 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - { "name": "MRP Production Initial Quality Control", "summary": "Customization Module", - "version": "8.0.1.0.0", - "category": "Manufacturing", + "version": "16.0.1.0.0", + "category": "Quality control", "license": "AGPL-3", "author": "AvanzOSC", - "website": "http://www.avanzosc.es", + "website": "https://github.com/avanzosc/mrp-addons", "contributors": [ "Ana Juaristi ", "Alfredo de la Fuente ", ], "depends": [ - "quality_control_mrp", + "quality_control_mrp_oca", ], "data": [ - 'data/mrp_production_initial_quality_control_data.xml', + "data/mrp_production_initial_quality_control_data.xml", ], "installable": True, } diff --git a/mrp_production_initial_quality_control/data/mrp_production_initial_quality_control_data.xml b/mrp_production_initial_quality_control/data/mrp_production_initial_quality_control_data.xml index dddf39e95..27428262a 100644 --- a/mrp_production_initial_quality_control/data/mrp_production_initial_quality_control_data.xml +++ b/mrp_production_initial_quality_control/data/mrp_production_initial_quality_control_data.xml @@ -1,10 +1,7 @@ - + - - - - Production confirmed - - - + + Production confirmed + + diff --git a/mrp_production_initial_quality_control/i18n/ca_ES.po b/mrp_production_initial_quality_control/i18n/ca_ES.po new file mode 100644 index 000000000..64d655ea4 --- /dev/null +++ b/mrp_production_initial_quality_control/i18n/ca_ES.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_production_initial_quality_control +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-21 11:25+0000\n" +"PO-Revision-Date: 2024-08-21 11:25+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: mrp_production_initial_quality_control +#: model:ir.model,name:mrp_production_initial_quality_control.model_mrp_production +msgid "Production Order" +msgstr "Ordre de producció" + +#. module: mrp_production_initial_quality_control +#: model:qc.trigger,name:mrp_production_initial_quality_control.qc_trigger_mrp_i +msgid "Production confirmed" +msgstr "" diff --git a/mrp_production_initial_quality_control/i18n/en_GB.po b/mrp_production_initial_quality_control/i18n/en_GB.po new file mode 100644 index 000000000..8896d0b10 --- /dev/null +++ b/mrp_production_initial_quality_control/i18n/en_GB.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_production_initial_quality_control +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-21 11:25+0000\n" +"PO-Revision-Date: 2024-08-21 11:25+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: mrp_production_initial_quality_control +#: model:ir.model,name:mrp_production_initial_quality_control.model_mrp_production +msgid "Production Order" +msgstr "" + +#. module: mrp_production_initial_quality_control +#: model:qc.trigger,name:mrp_production_initial_quality_control.qc_trigger_mrp_i +msgid "Production confirmed" +msgstr "" diff --git a/mrp_production_initial_quality_control/i18n/es.po b/mrp_production_initial_quality_control/i18n/es.po new file mode 100644 index 000000000..5db9a99ae --- /dev/null +++ b/mrp_production_initial_quality_control/i18n/es.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_production_initial_quality_control +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-21 11:26+0000\n" +"PO-Revision-Date: 2024-08-21 11:26+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: mrp_production_initial_quality_control +#: model:ir.model,name:mrp_production_initial_quality_control.model_mrp_production +msgid "Production Order" +msgstr "Orden de producción" + +#. module: mrp_production_initial_quality_control +#: model:qc.trigger,name:mrp_production_initial_quality_control.qc_trigger_mrp_i +msgid "Production confirmed" +msgstr "Producción confirmada" diff --git a/mrp_production_initial_quality_control/i18n/fr.po b/mrp_production_initial_quality_control/i18n/fr.po new file mode 100644 index 000000000..16fbaf693 --- /dev/null +++ b/mrp_production_initial_quality_control/i18n/fr.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_production_initial_quality_control +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-21 11:26+0000\n" +"PO-Revision-Date: 2024-08-21 11:26+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: mrp_production_initial_quality_control +#: model:ir.model,name:mrp_production_initial_quality_control.model_mrp_production +msgid "Production Order" +msgstr "Ordre de production" + +#. module: mrp_production_initial_quality_control +#: model:qc.trigger,name:mrp_production_initial_quality_control.qc_trigger_mrp_i +msgid "Production confirmed" +msgstr "" diff --git a/mrp_production_initial_quality_control/i18n/mrp_production_initial_quality_control.pot b/mrp_production_initial_quality_control/i18n/mrp_production_initial_quality_control.pot new file mode 100644 index 000000000..8896d0b10 --- /dev/null +++ b/mrp_production_initial_quality_control/i18n/mrp_production_initial_quality_control.pot @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_production_initial_quality_control +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-21 11:25+0000\n" +"PO-Revision-Date: 2024-08-21 11:25+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: mrp_production_initial_quality_control +#: model:ir.model,name:mrp_production_initial_quality_control.model_mrp_production +msgid "Production Order" +msgstr "" + +#. module: mrp_production_initial_quality_control +#: model:qc.trigger,name:mrp_production_initial_quality_control.qc_trigger_mrp_i +msgid "Production confirmed" +msgstr "" diff --git a/mrp_production_initial_quality_control/models/__init__.py b/mrp_production_initial_quality_control/models/__init__.py index 1581c285a..a9e5f13e4 100644 --- a/mrp_production_initial_quality_control/models/__init__.py +++ b/mrp_production_initial_quality_control/models/__init__.py @@ -1,4 +1 @@ -# -*- coding: utf-8 -*- -# Copyright 2019 Alfredo de la Fuente - AvanzOSC -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import mrp_production diff --git a/mrp_production_initial_quality_control/models/mrp_production.py b/mrp_production_initial_quality_control/models/mrp_production.py index f681306f1..ce0ec8be2 100644 --- a/mrp_production_initial_quality_control/models/mrp_production.py +++ b/mrp_production_initial_quality_control/models/mrp_production.py @@ -1,30 +1,34 @@ -# -*- coding: utf-8 -*- # Copyright 2019 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from openerp import models, api -from openerp.addons.quality_control.models.qc_trigger_line import\ - _filter_trigger_lines +from odoo import models + +from odoo.addons.quality_control_oca.models.qc_trigger_line import _filter_trigger_lines class MrpProduction(models.Model): - _inherit = 'mrp.production' + _inherit = "mrp.production" - @api.multi def action_confirm(self): - inspection_obj = self.env['qc.inspection'] - result = super(MrpProduction, self).action_confirm() + inspection_obj = self.env["qc.inspection"] + result = super().action_confirm() for production in self: - for move in production.move_created_ids.filtered( - lambda r: r.state not in ('done', 'cancel')): + for move in production.move_finished_ids.filtered( + lambda r: r.state not in ("done", "cancel") + ): qc_trigger = self.env.ref( - 'mrp_production_initial_quality_control.qc_trigger_mrp_i') + "mrp_production_initial_quality_control.qc_trigger_mrp_i" + ) trigger_lines = set() - for model in ['qc.trigger.product_category_line', - 'qc.trigger.product_template_line', - 'qc.trigger.product_line']: + for model in [ + "qc.trigger.product_category_line", + "qc.trigger.product_template_line", + "qc.trigger.product_line", + ]: trigger_lines = trigger_lines.union( self.env[model].get_trigger_line_for_product( - qc_trigger, move.product_id)) + qc_trigger, move.product_id + ) + ) for trigger_line in _filter_trigger_lines(trigger_lines): inspection_obj._make_inspection(move, trigger_line) return result diff --git a/mrp_production_initial_quality_control/tests/__init__.py b/mrp_production_initial_quality_control/tests/__init__.py index cf3aabb00..bee4b6a92 100644 --- a/mrp_production_initial_quality_control/tests/__init__.py +++ b/mrp_production_initial_quality_control/tests/__init__.py @@ -1,4 +1 @@ -# -*- coding: utf-8 -*- -# Copyright 2019 Alfredo de la Fuente - AvanzOSC -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import test_mrp_production_initial_quality_control diff --git a/mrp_production_initial_quality_control/tests/test_mrp_production_initial_quality_control.py b/mrp_production_initial_quality_control/tests/test_mrp_production_initial_quality_control.py index 9527282a8..572711d6a 100644 --- a/mrp_production_initial_quality_control/tests/test_mrp_production_initial_quality_control.py +++ b/mrp_production_initial_quality_control/tests/test_mrp_production_initial_quality_control.py @@ -1,34 +1,49 @@ -# -*- coding: utf-8 -*- # Copyright 2019 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from openerp.tests.common import TransactionCase +import odoo.tests.common as common -class TestMrpProductionInitialQualityControl(TransactionCase): +class TestMrpProductionInitialQualityControl(common.TransactionCase): def setUp(self): - super(TestMrpProductionInitialQualityControl, self).setUp() - self.production_model = self.env['mrp.production'] - self.inspection_model = self.env['qc.inspection'] - self.qc_trigger_model = self.env['qc.trigger'] - self.product = self.env.ref('product.product_product_4') - self.test = self.env.ref('quality_control.qc_test_1') + super().setUp() + self.production_model = self.env["mrp.production"] + self.inspection_model = self.env["qc.inspection"] + self.qc_trigger_model = self.env["qc.trigger"] + self.product = self.env.ref("product.product_product_4") + self.test = self.env.ref("quality_control_oca.qc_test_1") self.trigger = self.env.ref( - 'mrp_production_initial_quality_control.qc_trigger_mrp_i') - self.production1 = self.production_model.create({ - 'product_id': self.product.id, - 'product_qty': 2.0, - 'product_uom': self.product.uom_id.id}) - inspection_lines = ( - self.inspection_model._prepare_inspection_lines(self.test)) - self.inspection1 = self.inspection_model.create({ - 'name': 'TestMrpProductionInitialQualityControl', - 'inspection_lines': inspection_lines}) + "mrp_production_initial_quality_control.qc_trigger_mrp_i" + ) + self.production1 = self.production_model.create( + { + "product_id": self.product.id, + "product_qty": 2.0, + "product_uom_id": self.product.uom_id.id, + } + ) + inspection_lines = self.inspection_model._prepare_inspection_lines(self.test) + self.inspection1 = self.inspection_model.create( + { + "name": "TestMrpProductionInitialQualityControl", + "inspection_lines": inspection_lines, + } + ) def test_mrp_production_initial_quality_control(self): self.product.qc_triggers = [ - (0, 0, {'trigger': self.trigger.id, - 'test': self.test.id, })] + ( + 0, + 0, + { + "trigger": self.trigger.id, + "test": self.test.id, + }, + ) + ] self.production1.action_confirm() - self.assertEqual(self.production1.created_inspections, 1, - 'Only one inspection must be created') + self.assertEqual( + self.production1.created_inspections, + 1, + "Only one inspection must be created", + ) diff --git a/setup/mrp_production_initial_quality_control/odoo/addons/mrp_production_initial_quality_control b/setup/mrp_production_initial_quality_control/odoo/addons/mrp_production_initial_quality_control new file mode 120000 index 000000000..822edf346 --- /dev/null +++ b/setup/mrp_production_initial_quality_control/odoo/addons/mrp_production_initial_quality_control @@ -0,0 +1 @@ +../../../../mrp_production_initial_quality_control \ No newline at end of file diff --git a/setup/mrp_production_initial_quality_control/setup.py b/setup/mrp_production_initial_quality_control/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_production_initial_quality_control/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)