Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] mrp_production_initial_quality_control: Migration to 16.0 #414

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions mrp_production_initial_quality_control/README.rst
Original file line number Diff line number Diff line change
@@ -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 production initial quality_control
======================================

* Launch quality controls when confirming a production order.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/mrp-addons/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted
it first, help us smash it by providing detailed and welcomed feedback.

Credits
=======

Contributors
------------

* Ana Juaristi <[email protected]>
* Alfredo de la Fuente <[email protected]>

Do not contact contributors directly about support or help with technical issues.
3 changes: 3 additions & 0 deletions mrp_production_initial_quality_control/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2018 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models
22 changes: 22 additions & 0 deletions mrp_production_initial_quality_control/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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": "16.0.1.0.0",
"category": "Quality control",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/mrp-addons",
"contributors": [
"Ana Juaristi <[email protected]>",
"Alfredo de la Fuente <[email protected]>",
],
"depends": [
"quality_control_mrp_oca",
],
"data": [
"data/mrp_production_initial_quality_control_data.xml",
],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?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 ""
1 change: 1 addition & 0 deletions mrp_production_initial_quality_control/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import mrp_production
34 changes: 34 additions & 0 deletions mrp_production_initial_quality_control/models/mrp_production.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2019 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
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"

def action_confirm(self):
inspection_obj = self.env["qc.inspection"]
result = super().action_confirm()
for production in self:
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"
)
trigger_lines = set()
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
)
)
for trigger_line in _filter_trigger_lines(trigger_lines):
inspection_obj._make_inspection(move, trigger_line)
return result
1 change: 1 addition & 0 deletions mrp_production_initial_quality_control/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_mrp_production_initial_quality_control
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2019 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import odoo.tests.common as common


class TestMrpProductionInitialQualityControl(common.TransactionCase):

def setUp(self):
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_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,
},
)
]
self.production1.action_confirm()
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,
)
Loading