[MIG] quality_control_mrp_oca: Migration to 16.0

This commit is contained in:
Oihane Crucelaegui
2024-07-23 16:29:11 +02:00
parent bcc93e6302
commit d82a15b563
7 changed files with 46 additions and 61 deletions

View File

@@ -17,13 +17,13 @@ MRP extension for quality control (OCA)
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
:target: https://github.com/OCA/manufacture/tree/14.0/quality_control_mrp_oca
:target: https://github.com/OCA/manufacture/tree/16.0/quality_control_mrp_oca
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-quality_control_mrp_oca
:target: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-quality_control_mrp_oca
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -44,7 +44,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20quality_control_mrp_oca%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20quality_control_mrp_oca%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -82,6 +82,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/14.0/quality_control_mrp_oca>`_ project on GitHub.
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/16.0/quality_control_mrp_oca>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -4,7 +4,7 @@
{
"name": "MRP extension for quality control (OCA)",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Quality control",
"license": "AGPL-3",
"author": "OdooMRP team, "

View File

@@ -27,10 +27,11 @@ class QcInspection(models.Model):
@api.depends("object_id")
def _compute_product_id(self):
"""Overriden for getting the product from a manufacturing order."""
res = super()._compute_product_id()
for inspection in self:
super()._compute_product_id()
if inspection.object_id and inspection.object_id._name == "mrp.production":
inspection.product_id = inspection.object_id.product_id
return res
def object_selection_values(self):
objects = super().object_selection_values()

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -369,7 +368,7 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b443f8480964e8dfd7d279284bb7bf75e74b7a10f63c943321af023ef0efd8d4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/manufacture/tree/14.0/quality_control_mrp_oca"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-quality_control_mrp_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/manufacture&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/manufacture/tree/16.0/quality_control_mrp_oca"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-quality_control_mrp_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/manufacture&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module defines a trigger that creates quality control inspections when a
production order is finished.</p>
<p>It also adds the shortcuts related to these inspections on production orders.</p>
@@ -390,7 +389,7 @@ production order is finished.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/manufacture/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20quality_control_mrp_oca%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20quality_control_mrp_oca%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -423,7 +422,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/14.0/quality_control_mrp_oca">OCA/manufacture</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/16.0/quality_control_mrp_oca">OCA/manufacture</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -2,57 +2,48 @@
# Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests.common import Form, TransactionCase
from odoo.tests.common import Form
from odoo.addons.quality_control_oca.tests.test_quality_control import (
TestQualityControlOcaBase,
)
class TestQualityControlMrp(TransactionCase):
def setUp(self):
super().setUp()
self.inspection_model = self.env["qc.inspection"]
self.qc_trigger_model = self.env["qc.trigger"]
self.test = self.env.ref("quality_control_oca.qc_test_1")
self.trigger = self.env.ref("quality_control_mrp_oca.qc_trigger_mrp")
# Category
category_form = Form(self.env["product.category"])
category_form.name = "Test category"
self.category = category_form.save()
# Product
product_form = Form(self.env["product.template"])
product_form.name = "Test Product"
product_form.type = "product"
self.product = product_form.save()
class TestQualityControlMrp(TestQualityControlOcaBase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.trigger = cls.env.ref("quality_control_mrp_oca.qc_trigger_mrp")
# Materials
product_form = Form(self.env["product.product"])
product_form = Form(cls.env["product.product"])
product_form.name = "Part 1 Product"
product_form.type = "product"
self.mat1 = product_form.save()
product_form = Form(self.env["product.product"])
cls.mat1 = product_form.save()
product_form = Form(cls.env["product.product"])
product_form.name = "Part 2 Product"
product_form.type = "product"
self.mat2 = product_form.save()
cls.mat2 = product_form.save()
# Bom
bom_form = Form(self.env["mrp.bom"])
bom_form.product_tmpl_id = self.product
bom_form = Form(cls.env["mrp.bom"])
bom_form.product_tmpl_id = cls.product.product_tmpl_id
bom_form.product_qty = 1.0
bom_form.type = "normal"
with bom_form.bom_line_ids.new() as material_form:
material_form.product_id = self.mat1
material_form.product_id = cls.mat1
material_form.product_qty = 1
with bom_form.bom_line_ids.new() as material_form:
material_form.product_id = self.mat2
material_form.product_id = cls.mat2
material_form.product_qty = 1
self.bom = bom_form.save()
cls.bom = bom_form.save()
# Production
production_form = Form(self.env["mrp.production"])
production_form.product_id = self.product.product_variant_id
production_form.bom_id = self.bom
production_form = Form(cls.env["mrp.production"])
production_form.product_id = cls.product.product_variant_id
production_form.bom_id = cls.bom
production_form.product_qty = 2.0
self.production1 = production_form.save()
self.production1.action_confirm()
self.production1.action_assign()
cls.production1 = production_form.save()
cls.production1.action_confirm()
cls.production1.action_assign()
# Inspection
inspection_lines = self.inspection_model._prepare_inspection_lines(self.test)
self.inspection1 = self.inspection_model.create(
inspection_lines = cls.inspection_model._prepare_inspection_lines(cls.test)
cls.inspection1 = cls.inspection_model.create(
{"name": "Test Inspection", "inspection_lines": inspection_lines}
)

View File

@@ -15,10 +15,6 @@
<field name="name">mrp.production.form.qc</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view" />
<field
name="groups_id"
eval="[(4, ref('quality_control_oca.group_quality_control_user'))]"
/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button
@@ -26,6 +22,7 @@
type="action"
name="%(action_qc_inspection_per_production)d"
icon="fa-bookmark-o"
groups="quality_control_oca.group_quality_control_user"
>
<field
name="created_inspections"

View File

@@ -6,10 +6,9 @@
<field name="name">qc.inspection.form.view.production</field>
<field name="model">qc.inspection</field>
<field name="inherit_id" ref="quality_control_oca.qc_inspection_form_view" />
<field name="groups_id" eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="production_id" />
<field name="production_id" groups="mrp.group_mrp_user" />
</field>
</field>
</record>
@@ -17,10 +16,9 @@
<field name="name">qc.inspection.tree.view.production</field>
<field name="model">qc.inspection</field>
<field name="inherit_id" ref="quality_control_oca.qc_inspection_tree_view" />
<field name="groups_id" eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="production_id" />
<field name="production_id" groups="mrp.group_mrp_user" />
</field>
</field>
</record>
@@ -28,10 +26,9 @@
<field name="name">qc.inspection.search.view.production</field>
<field name="model">qc.inspection</field>
<field name="inherit_id" ref="quality_control_oca.qc_inspection_search_view" />
<field name="groups_id" eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="production_id" />
<field name="production_id" groups="mrp.group_mrp_user" />
</field>
<group expand="0" position="inside">
<filter
@@ -39,6 +36,7 @@
name="groupby_productions"
domain="[]"
context="{'group_by': 'production_id'}"
groups="mrp.group_mrp_user"
/>
</group>
</field>
@@ -50,10 +48,9 @@
name="inherit_id"
ref="quality_control_oca.qc_inspection_line_tree_view"
/>
<field name="groups_id" eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="production_id" />
<field name="production_id" groups="mrp.group_mrp_user" />
</field>
</field>
</record>
@@ -64,10 +61,9 @@
name="inherit_id"
ref="quality_control_oca.qc_inspection_line_search_view"
/>
<field name="groups_id" eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="production_id" />
<field name="production_id" groups="mrp.group_mrp_user" />
</field>
<group expand="0" position="inside">
<filter
@@ -75,6 +71,7 @@
name="groupby_productions"
domain="[]"
context="{'group_by': 'production_id'}"
groups="mrp.group_mrp_user"
/>
</group>
</field>