mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP] quality_control_mrp: take product from manufacturing order
This commit is contained in:
@@ -8,15 +8,24 @@ from openerp import models, fields, api
|
|||||||
class QcInspection(models.Model):
|
class QcInspection(models.Model):
|
||||||
_inherit = 'qc.inspection'
|
_inherit = 'qc.inspection'
|
||||||
|
|
||||||
@api.one
|
|
||||||
@api.depends('object_id')
|
@api.depends('object_id')
|
||||||
def get_production(self):
|
def get_production(self):
|
||||||
self.production = False
|
for inspection in self:
|
||||||
if self.object_id:
|
inspection.production = False
|
||||||
if self.object_id._name == 'stock.move':
|
if inspection.object_id:
|
||||||
self.production = self.object_id.production_id
|
if inspection.object_id._name == 'stock.move':
|
||||||
elif self.object_id._name == 'mrp.production':
|
inspection.production = inspection.object_id.production_id
|
||||||
self.production = self.object_id
|
elif self.object_id._name == 'mrp.production':
|
||||||
|
inspection.production = inspection.object_id
|
||||||
|
|
||||||
|
@api.depends('object_id')
|
||||||
|
def _get_product(self):
|
||||||
|
"""Overriden for getting the product from a manufacturing order."""
|
||||||
|
for inspection in self:
|
||||||
|
super(QcInspection, inspection)._get_product()
|
||||||
|
if inspection.object_id and\
|
||||||
|
inspection.object_id._name == 'mrp.production':
|
||||||
|
inspection.product = inspection.object_id.product_id
|
||||||
|
|
||||||
production = fields.Many2one(
|
production = fields.Many2one(
|
||||||
comodel_name="mrp.production", compute="get_production", store=True)
|
comodel_name="mrp.production", compute="get_production", store=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user