-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][MIG] mrp_production_initial_quality_control: Migration to 16.0
- Loading branch information
1 parent
5bbf217
commit 87343e3
Showing
14 changed files
with
201 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
12 changes: 5 additions & 7 deletions
12
...on_initial_quality_control/__openerp__.py → ...n_initial_quality_control/__manifest__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>", | ||
"Alfredo de la Fuente <[email protected]>", | ||
], | ||
"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, | ||
} |
4 changes: 2 additions & 2 deletions
4
mrp_production_initial_quality_control/data/mrp_production_initial_quality_control_data.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<openerp> | ||
<data> | ||
|
||
<record model="qc.trigger" id="qc_trigger_mrp_i"> | ||
<field name="name">Production confirmed</field> | ||
<field name="company_id"></field> | ||
<field name="company_id" /> | ||
</record> | ||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "" |
26 changes: 26 additions & 0 deletions
26
mrp_production_initial_quality_control/i18n/mrp_production_initial_quality_control.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
34 changes: 19 additions & 15 deletions
34
mrp_production_initial_quality_control/models/mrp_production.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
61 changes: 38 additions & 23 deletions
61
mrp_production_initial_quality_control/tests/test_mrp_production_initial_quality_control.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
) |
1 change: 1 addition & 0 deletions
1
...mrp_production_initial_quality_control/odoo/addons/mrp_production_initial_quality_control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../mrp_production_initial_quality_control |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |