mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[FIX] quality_control_stock_oca: Avoid singleton error
A compute must be multi-record aware
This commit is contained in:
committed by
Enrique Martín
parent
1848fc4c35
commit
d192db9443
@@ -5,7 +5,7 @@
|
||||
|
||||
{
|
||||
"name": "Quality control - Stock (OCA)",
|
||||
"version": "13.0.1.0.0",
|
||||
"version": "13.0.1.0.1",
|
||||
"category": "Quality control",
|
||||
"license": "AGPL-3",
|
||||
"author": "OdooMRP team, AvanzOSC, Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
|
||||
@@ -63,15 +63,14 @@ class QcInspection(models.Model):
|
||||
@api.depends("object_id")
|
||||
def _compute_product_id(self):
|
||||
"""Overriden for getting the product from a stock move."""
|
||||
self.ensure_one()
|
||||
super()._compute_product_id()
|
||||
if self.object_id:
|
||||
if self.object_id._name == "stock.move":
|
||||
self.product_id = self.object_id.product_id
|
||||
elif self.object_id._name == "stock.move.line":
|
||||
self.product_id = self.object_id.product_id
|
||||
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 self.object_id._name == "stock.production.lot":
|
||||
self.product_id = self.object_id.product_id
|
||||
inspection.product_id = inspection.object_id.product_id
|
||||
|
||||
@api.onchange("object_id")
|
||||
def onchange_object_id(self):
|
||||
|
||||
Reference in New Issue
Block a user