Skip to content

Commit

Permalink
[16.0][MIG] mrp_production_initial_quality_control: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredoavanzosc committed Aug 21, 2024
1 parent 5bbf217 commit 52c93fa
Show file tree
Hide file tree
Showing 14 changed files with 206 additions and 62 deletions.
1 change: 0 additions & 1 deletion mrp_production_initial_quality_control/__init__.py
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
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,
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?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>
</record>
</data>
</openerp>
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record model="qc.trigger" id="qc_trigger_mrp_i">
<field name="name">Production confirmed</field>
<field name="company_id" />
</record>
</odoo>
26 changes: 26 additions & 0 deletions mrp_production_initial_quality_control/i18n/ca_ES.po
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 ""
26 changes: 26 additions & 0 deletions mrp_production_initial_quality_control/i18n/en_GB.po
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 ""
26 changes: 26 additions & 0 deletions mrp_production_initial_quality_control/i18n/es.po
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"
26 changes: 26 additions & 0 deletions mrp_production_initial_quality_control/i18n/fr.po
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 ""
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 ""
3 changes: 0 additions & 3 deletions mrp_production_initial_quality_control/models/__init__.py
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 mrp_production_initial_quality_control/models/mrp_production.py
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
3 changes: 0 additions & 3 deletions mrp_production_initial_quality_control/tests/__init__.py
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
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",
)
6 changes: 6 additions & 0 deletions setup/mrp_production_initial_quality_control/setup.py
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,
)

0 comments on commit 52c93fa

Please sign in to comment.