[FIX][quality_control_stock] get_lot and get_picking should be able to manage recordsets

This commit is contained in:
Simone Rubino
2018-07-30 16:18:49 +02:00
committed by Ignacio Ales
parent 2be12814b3
commit 9dd0f8c8e2
2 changed files with 20 additions and 19 deletions

View File

@@ -6,7 +6,7 @@
{
"name": "Quality control - Stock",
"version": "10.0.1.0.0",
"version": "10.0.1.0.1",
"category": "Quality control",
"license": "AGPL-3",
"author": "OdooMRP team, "

View File

@@ -12,28 +12,29 @@ class QcInspection(models.Model):
@api.multi
@api.depends('object_id')
def get_picking(self):
self.ensure_one()
self.picking = False
if self.object_id:
if self.object_id._name == 'stock.move':
self.picking = self.object_id.picking_id
elif self.object_id._name == 'stock.picking':
self.picking = self.object_id
elif self.object_id._name == 'stock.pack.operation':
self.picking = self.object_id.picking_id
for inspection in self:
inspection.picking = False
if inspection.object_id:
if inspection.object_id._name == 'stock.move':
inspection.picking = inspection.object_id.picking_id
elif inspection.object_id._name == 'stock.picking':
inspection.picking = inspection.object_id
elif inspection.object_id._name == 'stock.pack.operation':
inspection.picking = inspection.object_id.picking_id
@api.multi
@api.depends('object_id')
def get_lot(self):
self.ensure_one()
self.lot = False
if self.object_id:
if self.object_id._name == 'stock.pack.operation':
self.lot = self.object_id.pack_lot_ids[:1].lot_id
elif self.object_id._name == 'stock.move':
self.lot = self.object_id.lot_ids[:1]
elif self.object_id._name == 'stock.production.lot':
self.lot = self.object_id
for inspection in self:
inspection.lot = False
if inspection.object_id:
if inspection.object_id._name == 'stock.pack.operation':
inspection.lot = \
inspection.object_id.pack_lot_ids[:1].lot_id
elif inspection.object_id._name == 'stock.move':
inspection.lot = inspection.object_id.lot_ids[:1]
elif inspection.object_id._name == 'stock.production.lot':
inspection.lot = inspection.object_id
@api.multi
@api.depends('object_id')