From 9ce5bc4749790fa2c35908cf85255a7ac015b9d8 Mon Sep 17 00:00:00 2001
From: angelmoya
Date: Wed, 7 Jun 2023 11:16:54 +0000
Subject: [PATCH] [MIG] quality_control_stock_oca: Migration to 16.0
---
quality_control_stock_oca/README.rst | 12 +--
quality_control_stock_oca/__manifest__.py | 3 +-
.../i18n/quality_control_stock_oca.pot | 2 +-
.../models/qc_inspection.py | 27 ++-----
.../models/stock_picking.py | 2 +-
.../models/stock_production_lot.py | 2 +-
.../static/description/index.html | 8 +-
.../tests/test_quality_control_stock.py | 79 ++++++++++++-------
.../views/qc_trigger_view.xml | 13 +++
.../views/stock_picking_view.xml | 14 ++--
.../views/stock_production_lot_view.xml | 18 +++--
11 files changed, 105 insertions(+), 75 deletions(-)
create mode 100644 quality_control_stock_oca/views/qc_trigger_view.xml
diff --git a/quality_control_stock_oca/README.rst b/quality_control_stock_oca/README.rst
index 8dd18bdec..8da328bf3 100644
--- a/quality_control_stock_oca/README.rst
+++ b/quality_control_stock_oca/README.rst
@@ -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 `_.
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 `_.
+`feedback `_.
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 `_ project on GitHub.
+This module is part of the `OCA/manufacture `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/quality_control_stock_oca/__manifest__.py b/quality_control_stock_oca/__manifest__.py
index 0756c7d37..dc089df62 100644
--- a/quality_control_stock_oca/__manifest__.py
+++ b/quality_control_stock_oca/__manifest__.py
@@ -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,
diff --git a/quality_control_stock_oca/i18n/quality_control_stock_oca.pot b/quality_control_stock_oca/i18n/quality_control_stock_oca.pot
index 6450c915a..64ae11599 100644
--- a/quality_control_stock_oca/i18n/quality_control_stock_oca.pot
+++ b/quality_control_stock_oca/i18n/quality_control_stock_oca.pot
@@ -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"
diff --git a/quality_control_stock_oca/models/qc_inspection.py b/quality_control_stock_oca/models/qc_inspection.py
index 39a96d59a..5e85afd3e 100644
--- a/quality_control_stock_oca/models/qc_inspection.py
+++ b/quality_control_stock_oca/models/qc_inspection.py
@@ -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
)
diff --git a/quality_control_stock_oca/models/stock_picking.py b/quality_control_stock_oca/models/stock_picking.py
index 59cf813ea..e99a0d8d6 100644
--- a/quality_control_stock_oca/models/stock_picking.py
+++ b/quality_control_stock_oca/models/stock_picking.py
@@ -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",
diff --git a/quality_control_stock_oca/models/stock_production_lot.py b/quality_control_stock_oca/models/stock_production_lot.py
index e1c83a9d3..654e6c5b4 100644
--- a/quality_control_stock_oca/models/stock_production_lot.py
+++ b/quality_control_stock_oca/models/stock_production_lot.py
@@ -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",
diff --git a/quality_control_stock_oca/static/description/index.html b/quality_control_stock_oca/static/description/index.html
index 70d977666..6291209f8 100644
--- a/quality_control_stock_oca/static/description/index.html
+++ b/quality_control_stock_oca/static/description/index.html
@@ -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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module defines triggers that creates inspections when stock moves are done.
It also adds some shortcuts on picking and lots to these inspections.
Table of contents
@@ -396,7 +396,7 @@ ul.auto-toc {
Bugs are tracked on GitHub 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.
Do not contact contributors directly about support or help with technical issues.
@@ -432,7 +432,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
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 project on GitHub.
+
This module is part of the OCA/manufacture project on GitHub.