[MIG] quality_control_mrp_oca: Migration to 14.0

This commit is contained in:
Tu Nombre
2021-11-12 11:07:24 +01:00
committed by Oihane Crucelaegui
parent 9f1cd8511c
commit fc3b6cc4b8
6 changed files with 27 additions and 56 deletions

View File

@@ -14,13 +14,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/13.0/quality_control_mrp_oca
:target: https://github.com/OCA/manufacture/tree/14.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-13-0/manufacture-13-0-quality_control_mrp_oca
:target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-quality_control_mrp_oca
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/129/13.0
:target: https://runbot.odoo-community.org/runbot/129/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -41,7 +41,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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20quality_control_mrp_oca%0Aversion:%2013.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:%2014.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.
@@ -79,6 +79,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/13.0/quality_control_mrp_oca>`_ project on GitHub.
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/14.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": "13.0.1.0.0",
"version": "14.0.1.0.0",
"category": "Quality control",
"license": "AGPL-3",
"author": "OdooMRP team, "

View File

@@ -26,11 +26,11 @@ class MrpProduction(models.Model):
compute="_compute_created_inspections", string="Created inspections"
)
def post_inventory(self):
def _post_inventory(self, cancel_backorder=False):
done_moves = self.mapped("move_finished_ids").filtered(
lambda r: r.state == "done"
)
res = super().post_inventory()
res = super()._post_inventory(cancel_backorder=cancel_backorder)
inspection_model = self.env["qc.inspection"]
new_done_moves = (
self.mapped("move_finished_ids").filtered(lambda r: r.state == "done")

View File

@@ -60,14 +60,8 @@ class TestQualityControlMrp(TransactionCase):
self.product.product_variant_id.qc_triggers = [
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})
]
produce_wizard = Form(
self.env["mrp.product.produce"].with_context(
{"active_id": self.production1.id, "active_ids": self.production1.ids}
)
)
produce_wizard.qty_producing = self.production1.product_qty
produce_wizard.save().do_produce()
self.production1.post_inventory()
self.production1.qty_producing = self.production1.product_qty
self.production1._post_inventory()
self.assertEqual(
self.production1.created_inspections,
1,
@@ -78,14 +72,8 @@ class TestQualityControlMrp(TransactionCase):
self.product.qc_triggers = [
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})
]
produce_wizard = Form(
self.env["mrp.product.produce"].with_context(
{"active_id": self.production1.id, "active_ids": self.production1.ids}
)
)
produce_wizard.qty_producing = self.production1.product_qty
produce_wizard.save().do_produce()
self.production1.post_inventory()
self.production1.qty_producing = self.production1.product_qty
self.production1._post_inventory()
self.assertEqual(
self.production1.created_inspections,
1,
@@ -96,14 +84,8 @@ class TestQualityControlMrp(TransactionCase):
self.product.categ_id.qc_triggers = [
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})
]
produce_wizard = Form(
self.env["mrp.product.produce"].with_context(
{"active_id": self.production1.id, "active_ids": self.production1.ids}
)
)
produce_wizard.qty_producing = self.production1.product_qty
produce_wizard.save().do_produce()
self.production1.post_inventory()
self.production1.qty_producing = self.production1.product_qty
self.production1._post_inventory()
self.assertEqual(
self.production1.created_inspections,
1,
@@ -117,14 +99,8 @@ class TestQualityControlMrp(TransactionCase):
self.product.categ_id.qc_triggers = [
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})
]
produce_wizard = Form(
self.env["mrp.product.produce"].with_context(
{"active_id": self.production1.id, "active_ids": self.production1.ids}
)
)
produce_wizard.qty_producing = self.production1.product_qty
produce_wizard.save().do_produce()
self.production1.post_inventory()
self.production1.qty_producing = self.production1.product_qty
self.production1._post_inventory()
self.assertEqual(
self.production1.created_inspections,
1,
@@ -135,27 +111,15 @@ class TestQualityControlMrp(TransactionCase):
self.product.qc_triggers = [
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})
]
produce_wizard = Form(
self.env["mrp.product.produce"].with_context(
{"active_id": self.production1.id, "active_ids": self.production1.ids}
)
)
produce_wizard.qty_producing = 1.0
produce_wizard.save().do_produce()
self.production1.post_inventory()
self.production1.qty_producing = 1.0
self.production1._post_inventory()
self.assertEqual(
self.production1.created_inspections,
1,
"Only one inspection must be created.",
)
produce_wizard = Form(
self.env["mrp.product.produce"].with_context(
{"active_id": self.production1.id, "active_ids": self.production1.ids}
)
)
produce_wizard.qty_producing = 1.0
produce_wizard.save().do_produce()
self.production1.post_inventory()
self.production1.qty_producing = self.production1.product_qty
self.production1._post_inventory()
self.assertEqual(
self.production1.created_inspections, 2, "There must be only 2 inspections."
)

View File

@@ -0,0 +1 @@
../../../../quality_control_mrp_oca

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)