mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] quality_control_stock_oca: Migration to 16.0
This commit is contained in:
committed by
Antoni Marroig Campomar
parent
ff95bdd3cb
commit
9ce5bc4749
@@ -7,7 +7,7 @@ Quality control - Stock (OCA)
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:6a7081017d1705e47f1c601056c9db6f3dd3368a22519f03457e7f239cf92505
|
||||
!! source digest: sha256:7430252681826a0a0f9a869194458e38ac20900898f0f8ff40422f13702695ee
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
@@ -17,13 +17,13 @@ Quality control - Stock (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/15.0/quality_control_stock_oca
|
||||
:target: https://github.com/OCA/manufacture/tree/16.0/quality_control_stock_oca
|
||||
:alt: OCA/manufacture
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-quality_control_stock_oca
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-quality_control_stock_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=15.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|
|
||||
@@ -48,7 +48,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_stock_oca%0Aversion:%2015.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_stock_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.
|
||||
|
||||
@@ -89,6 +89,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/15.0/quality_control_stock_oca>`_ project on GitHub.
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/16.0/quality_control_stock_oca>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
{
|
||||
"name": "Quality control - Stock (OCA)",
|
||||
"version": "15.0.1.0.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"category": "Quality control",
|
||||
"license": "AGPL-3",
|
||||
"author": "OdooMRP team, AvanzOSC, Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
@@ -16,6 +16,7 @@
|
||||
"views/qc_inspection_view.xml",
|
||||
"views/stock_picking_view.xml",
|
||||
"views/stock_production_lot_view.xml",
|
||||
"views/qc_trigger_view.xml",
|
||||
],
|
||||
"post_init_hook": "post_init_hook",
|
||||
"installable": True,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 15.0\n"
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
||||
@@ -13,7 +13,7 @@ class QcInspection(models.Model):
|
||||
comodel_name="stock.picking", compute="_compute_picking", store=True
|
||||
)
|
||||
lot_id = fields.Many2one(
|
||||
comodel_name="stock.production.lot", compute="_compute_lot", store=True
|
||||
comodel_name="stock.lot", compute="_compute_lot", store=True
|
||||
)
|
||||
|
||||
def object_selection_values(self):
|
||||
@@ -22,7 +22,7 @@ class QcInspection(models.Model):
|
||||
[
|
||||
("stock.picking", "Picking List"),
|
||||
("stock.move", "Stock Move"),
|
||||
("stock.production.lot", "Lot/Serial Number"),
|
||||
("stock.lot", "Lot/Serial Number"),
|
||||
]
|
||||
)
|
||||
return result
|
||||
@@ -35,8 +35,6 @@ class QcInspection(models.Model):
|
||||
inspection.picking_id = inspection.object_id.picking_id
|
||||
elif inspection.object_id._name == "stock.picking":
|
||||
inspection.picking_id = inspection.object_id
|
||||
elif inspection.object_id._name == "stock.move.line":
|
||||
inspection.picking_id = inspection.object_id.picking_id
|
||||
|
||||
@api.depends("object_id")
|
||||
def _compute_lot(self):
|
||||
@@ -49,15 +47,13 @@ class QcInspection(models.Model):
|
||||
|
||||
for inspection in self:
|
||||
if inspection.object_id:
|
||||
if inspection.object_id._name == "stock.move.line":
|
||||
inspection.lot_id = inspection.object_id.lot_id
|
||||
elif inspection.object_id._name == "stock.move":
|
||||
if inspection.object_id._name == "stock.move":
|
||||
inspection.lot_id = first(
|
||||
move_lines.filtered(
|
||||
lambda line: line.move_id == inspection.object_id
|
||||
)
|
||||
).lot_id
|
||||
elif inspection.object_id._name == "stock.production.lot":
|
||||
elif inspection.object_id._name == "stock.lot":
|
||||
inspection.lot_id = inspection.object_id
|
||||
|
||||
@api.depends("object_id")
|
||||
@@ -67,25 +63,18 @@ class QcInspection(models.Model):
|
||||
for inspection in self.filtered("object_id"):
|
||||
if inspection.object_id._name == "stock.move":
|
||||
inspection.product_id = inspection.object_id.product_id
|
||||
elif inspection.object_id._name == "stock.move.line":
|
||||
inspection.product_id = inspection.object_id.product_id
|
||||
elif inspection.object_id._name == "stock.production.lot":
|
||||
elif inspection.object_id._name == "stock.lot":
|
||||
inspection.product_id = inspection.object_id.product_id
|
||||
return res
|
||||
|
||||
@api.onchange("object_id")
|
||||
def onchange_object_id(self):
|
||||
if self.object_id:
|
||||
if self.object_id._name == "stock.move":
|
||||
self.qty = self.object_id.product_qty
|
||||
elif self.object_id._name == "stock.move.line":
|
||||
self.qty = self.object_id.product_qty
|
||||
if self.object_id._name == "stock.move":
|
||||
self.qty = self.object_id.product_qty
|
||||
|
||||
def _prepare_inspection_header(self, object_ref, trigger_line):
|
||||
res = super()._prepare_inspection_header(object_ref, trigger_line)
|
||||
# Fill qty when coming from pack operations
|
||||
if object_ref and object_ref._name == "stock.move.line":
|
||||
res["qty"] = object_ref.product_qty
|
||||
if object_ref and object_ref._name == "stock.move":
|
||||
res["qty"] = object_ref.product_uom_qty
|
||||
return res
|
||||
@@ -98,5 +87,5 @@ class QcInspectionLine(models.Model):
|
||||
comodel_name="stock.picking", related="inspection_id.picking_id", store=True
|
||||
)
|
||||
lot_id = fields.Many2one(
|
||||
comodel_name="stock.production.lot", related="inspection_id.lot_id", store=True
|
||||
comodel_name="stock.lot", related="inspection_id.lot_id", store=True
|
||||
)
|
||||
|
||||
@@ -64,7 +64,7 @@ class StockPicking(models.Model):
|
||||
.sudo()
|
||||
.search([("picking_type_id", "=", self.picking_type_id.id)])
|
||||
)
|
||||
for operation in self.move_lines:
|
||||
for operation in self.move_ids:
|
||||
trigger_lines = set()
|
||||
for model in [
|
||||
"qc.trigger.product_category_line",
|
||||
|
||||
@@ -6,7 +6,7 @@ from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockProductionLot(models.Model):
|
||||
_inherit = "stock.production.lot"
|
||||
_inherit = "stock.lot"
|
||||
|
||||
qc_inspections_ids = fields.One2many(
|
||||
comodel_name="qc.inspection",
|
||||
|
||||
@@ -367,9 +367,9 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:6a7081017d1705e47f1c601056c9db6f3dd3368a22519f03457e7f239cf92505
|
||||
!! source digest: sha256:7430252681826a0a0f9a869194458e38ac20900898f0f8ff40422f13702695ee
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<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/15.0/quality_control_stock_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-15-0/manufacture-15-0-quality_control_stock_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&target_branch=15.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_stock_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_stock_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&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 triggers that creates inspections when stock moves are done.</p>
|
||||
<p>It also adds some shortcuts on picking and lots to these inspections.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
@@ -396,7 +396,7 @@ ul.auto-toc {
|
||||
<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_stock_oca%0Aversion:%2015.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_stock_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">
|
||||
@@ -432,7 +432,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/15.0/quality_control_stock_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_stock_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>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests.common import TransactionCase, new_test_user
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestQualityControl(TransactionCase):
|
||||
@@ -19,6 +19,10 @@ class TestQualityControl(TransactionCase):
|
||||
self.test = self.env.ref("quality_control_oca.qc_test_1")
|
||||
self.picking_type = self.env.ref("stock.picking_type_out")
|
||||
self.location_dest = self.env.ref("stock.stock_location_customers")
|
||||
self.group_stock_user = self.env.ref("stock.group_stock_user")
|
||||
self.group_quality_control_user = self.env.ref(
|
||||
"quality_control_oca.group_quality_control_user"
|
||||
)
|
||||
self.company = self.env.ref("base.main_company")
|
||||
self.sequence = self.env["ir.sequence"].create(
|
||||
{"code": "out", "name": "outgoing_sequence"}
|
||||
@@ -30,19 +34,18 @@ class TestQualityControl(TransactionCase):
|
||||
self.trigger = self.qc_trigger_model.search(
|
||||
[("picking_type_id", "=", self.picking_type.id)]
|
||||
)
|
||||
self.lot = self.env["stock.production.lot"].create(
|
||||
self.lot = self.env["stock.lot"].create(
|
||||
{
|
||||
"name": "Lot for tests",
|
||||
"product_id": self.product.id,
|
||||
"company_id": self.company.id,
|
||||
}
|
||||
)
|
||||
self.user1_id = new_test_user(
|
||||
self.env,
|
||||
login="user_1",
|
||||
groups="stock.group_stock_user,quality_control_oca.group_quality_control_user",
|
||||
company_id=self.company.id,
|
||||
).id
|
||||
self.user1_id = self._create_user(
|
||||
"user_1",
|
||||
[self.group_stock_user, self.group_quality_control_user],
|
||||
self.company,
|
||||
)
|
||||
move_vals = {
|
||||
"name": self.product.name,
|
||||
"product_id": self.product.id,
|
||||
@@ -50,7 +53,6 @@ class TestQualityControl(TransactionCase):
|
||||
"product_uom_qty": 2.0,
|
||||
"location_id": self.picking_type.default_location_src_id.id,
|
||||
"location_dest_id": self.location_dest.id,
|
||||
"quantity_done": 1.0,
|
||||
}
|
||||
self.picking1 = (
|
||||
self.picking_model.with_user(self.user1_id)
|
||||
@@ -59,14 +61,14 @@ class TestQualityControl(TransactionCase):
|
||||
{
|
||||
"partner_id": self.partner1.id,
|
||||
"picking_type_id": self.picking_type.id,
|
||||
"move_lines": [(0, 0, move_vals)],
|
||||
"move_ids": [(0, 0, move_vals)],
|
||||
"location_dest_id": self.location_dest.id,
|
||||
}
|
||||
)
|
||||
)
|
||||
self.picking1.action_confirm()
|
||||
sequence = 10
|
||||
for line in self.picking1.move_lines.filtered(
|
||||
for line in self.picking1.move_ids.filtered(
|
||||
lambda r: r.product_id == self.product
|
||||
):
|
||||
line.write(
|
||||
@@ -77,7 +79,6 @@ class TestQualityControl(TransactionCase):
|
||||
0,
|
||||
{
|
||||
"lot_id": self.lot.id,
|
||||
"product_uom_qty": 1.0,
|
||||
"qty_done": 1.0,
|
||||
"product_uom_id": line.product_uom.id,
|
||||
"product_id": line.product_id.id,
|
||||
@@ -91,29 +92,45 @@ class TestQualityControl(TransactionCase):
|
||||
)
|
||||
sequence += 10
|
||||
|
||||
def _create_user(self, login, groups, company):
|
||||
"""Create a user."""
|
||||
group_ids = [group.id for group in groups]
|
||||
user = self.users_model.with_context(no_reset_password=True).create(
|
||||
{
|
||||
"name": "Sale User",
|
||||
"login": login,
|
||||
"password": "test",
|
||||
"email": "test@yourcompany.com",
|
||||
"company_id": company.id,
|
||||
"company_ids": [(4, company.id)],
|
||||
"groups_id": [(6, 0, group_ids)],
|
||||
}
|
||||
)
|
||||
return user.id
|
||||
|
||||
def test_inspection_create_for_product(self):
|
||||
self.product.qc_triggers = [
|
||||
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 1, "Only one inspection must be created"
|
||||
)
|
||||
inspection = self.picking1.qc_inspections_ids[:1]
|
||||
self.assertEqual(inspection.qty, 2.0)
|
||||
self.assertEqual(inspection.qty, self.picking1.move_ids.product_uom_qty)
|
||||
self.assertEqual(
|
||||
inspection.test, self.test, "Wrong test picked when creating inspection."
|
||||
)
|
||||
# Try in this context if onchange with an stock.pack.operation works
|
||||
inspection.qty = 5
|
||||
inspection.onchange_object_id()
|
||||
self.assertEqual(inspection.qty, 2.0)
|
||||
self.assertEqual(inspection.qty, self.picking1.move_ids.product_uom_qty)
|
||||
|
||||
def test_inspection_create_for_template(self):
|
||||
self.product.product_tmpl_id.qc_triggers = [
|
||||
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 1, "Only one inspection must be created"
|
||||
)
|
||||
@@ -127,7 +144,7 @@ class TestQualityControl(TransactionCase):
|
||||
self.product.categ_id.qc_triggers = [
|
||||
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 1, "Only one inspection must be created"
|
||||
)
|
||||
@@ -149,7 +166,7 @@ class TestQualityControl(TransactionCase):
|
||||
},
|
||||
)
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 1, "Only one inspection must be created"
|
||||
)
|
||||
@@ -171,7 +188,7 @@ class TestQualityControl(TransactionCase):
|
||||
},
|
||||
)
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 1, "Only one inspection must be created"
|
||||
)
|
||||
@@ -193,7 +210,7 @@ class TestQualityControl(TransactionCase):
|
||||
},
|
||||
)
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 1, "Only one inspection must be created"
|
||||
)
|
||||
@@ -215,7 +232,7 @@ class TestQualityControl(TransactionCase):
|
||||
},
|
||||
)
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 0, "No inspection must be created"
|
||||
)
|
||||
@@ -232,7 +249,7 @@ class TestQualityControl(TransactionCase):
|
||||
},
|
||||
)
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 0, "No inspection must be created"
|
||||
)
|
||||
@@ -249,7 +266,7 @@ class TestQualityControl(TransactionCase):
|
||||
},
|
||||
)
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 0, "No inspection must be created"
|
||||
)
|
||||
@@ -261,7 +278,7 @@ class TestQualityControl(TransactionCase):
|
||||
self.product.categ_id.qc_triggers = [
|
||||
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})
|
||||
]
|
||||
self.picking1.button_validate()
|
||||
self.picking1._action_done()
|
||||
self.assertEqual(
|
||||
self.picking1.created_inspections, 1, "Only one inspection must be created"
|
||||
)
|
||||
@@ -307,7 +324,7 @@ class TestQualityControl(TransactionCase):
|
||||
def test_qc_inspection_picking(self):
|
||||
self.inspection1.write(
|
||||
{
|
||||
"name": self.picking1.move_lines[:1]._name + "inspection",
|
||||
"name": self.picking1.move_ids[:1]._name + "inspection",
|
||||
"object_id": "%s,%d" % (self.picking1._name, self.picking1.id),
|
||||
}
|
||||
)
|
||||
@@ -316,23 +333,25 @@ class TestQualityControl(TransactionCase):
|
||||
def test_qc_inspection_stock_move(self):
|
||||
self.inspection1.write(
|
||||
{
|
||||
"name": self.picking1.move_lines[:1]._name + "inspection",
|
||||
"name": self.picking1.move_ids[:1]._name + "inspection",
|
||||
"object_id": "%s,%d"
|
||||
% (self.picking1.move_lines[:1]._name, self.picking1.move_lines[:1].id),
|
||||
% (self.picking1.move_ids[:1]._name, self.picking1.move_ids[:1].id),
|
||||
}
|
||||
)
|
||||
self.inspection1.onchange_object_id()
|
||||
self.assertEqual(self.inspection1.picking_id, self.picking1)
|
||||
self.assertEqual(self.inspection1.lot_id, self.lot)
|
||||
self.assertEqual(
|
||||
self.inspection1.product_id, self.picking1.move_lines[:1].product_id
|
||||
self.inspection1.product_id, self.picking1.move_ids[:1].product_id
|
||||
)
|
||||
self.assertEqual(
|
||||
self.inspection1.qty, self.picking1.move_ids[:1].product_uom_qty
|
||||
)
|
||||
self.assertEqual(self.inspection1.qty, self.picking1.move_lines[:1].product_qty)
|
||||
|
||||
def test_qc_inspection_lot(self):
|
||||
self.inspection1.write(
|
||||
{
|
||||
"name": self.picking1.move_lines[:1]._name + "inspection",
|
||||
"name": self.picking1.move_ids[:1]._name + "inspection",
|
||||
"object_id": "%s,%d" % (self.lot._name, self.lot.id),
|
||||
}
|
||||
)
|
||||
|
||||
13
quality_control_stock_oca/views/qc_trigger_view.xml
Normal file
13
quality_control_stock_oca/views/qc_trigger_view.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="qc_trigger_form_view">
|
||||
<field name="name">qc.trigger.form</field>
|
||||
<field name="model">qc.trigger</field>
|
||||
<field name='inherit_id' ref='quality_control_oca.qc_trigger_form_view' />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_selectable']" position="after">
|
||||
<field name="picking_type_id" readonly="1" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -36,10 +36,6 @@
|
||||
<field name="name">stock.picking.qc.view</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form" />
|
||||
<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
|
||||
@@ -47,6 +43,7 @@
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_picking)d"
|
||||
icon="fa-list"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
>
|
||||
<field
|
||||
name="created_inspections"
|
||||
@@ -59,6 +56,7 @@
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_picking_done)d"
|
||||
icon="fa-pencil"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
>
|
||||
<field name="done_inspections" widget="statinfo" />
|
||||
</button>
|
||||
@@ -67,6 +65,7 @@
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_picking_passed)d"
|
||||
icon="fa-thumbs-o-up"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
>
|
||||
<field name="passed_inspections" widget="statinfo" />
|
||||
</button>
|
||||
@@ -75,8 +74,13 @@
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_picking_failed)d"
|
||||
icon="fa-thumbs-o-down"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
>
|
||||
<field name="failed_inspections" widget="statinfo" />
|
||||
<field
|
||||
name="failed_inspections"
|
||||
widget="statinfo"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
|
||||
@@ -33,13 +33,9 @@
|
||||
>[('lot_id', '=', active_id), ('state', '=', 'failed')]</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="stock_lot_qc_view">
|
||||
<field name="name">stock.production.lot.qc.view</field>
|
||||
<field name="model">stock.production.lot</field>
|
||||
<field name="name">stock.lot.qc.view</field>
|
||||
<field name="model">stock.lot</field>
|
||||
<field name="inherit_id" ref="stock.view_production_lot_form" />
|
||||
<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
|
||||
@@ -47,6 +43,7 @@
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_lot)d"
|
||||
icon="fa-list"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
>
|
||||
<field
|
||||
name="created_inspections"
|
||||
@@ -59,6 +56,7 @@
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_lot_done)d"
|
||||
icon="fa-pencil"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
>
|
||||
<field name="done_inspections" widget="statinfo" />
|
||||
</button>
|
||||
@@ -67,6 +65,7 @@
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_lot_passed)d"
|
||||
icon="fa-thumbs-o-up"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
>
|
||||
<field name="passed_inspections" widget="statinfo" />
|
||||
</button>
|
||||
@@ -75,8 +74,13 @@
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_lot_failed)d"
|
||||
icon="fa-thumbs-o-down"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
>
|
||||
<field name="failed_inspections" widget="statinfo" />
|
||||
<field
|
||||
name="failed_inspections"
|
||||
widget="statinfo"
|
||||
groups="quality_control_oca.group_quality_control_user"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user