[IMP] quality_control_stock: if lot in reference, get its info

quality_control_mrp: tests extended

[IMP] quality_control_mrp: removed not required code
This commit is contained in:
oihane
2016-05-11 12:03:30 +02:00
committed by Simone Rubino
parent 914e02e13e
commit b9d2b0650c
3 changed files with 19 additions and 0 deletions

View File

@@ -29,6 +29,8 @@ class QcInspection(models.Model):
self.lot = self.object_id.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
@api.one
@api.depends('object_id')
@@ -40,6 +42,8 @@ class QcInspection(models.Model):
self.product = self.object_id.product_id
elif self.object_id._name == 'stock.pack.operation':
self.product = self.object_id.product_id
elif self.object_id._name == 'stock.production.lot':
self.product = self.object_id.product_id
@api.onchange('object_id')
def onchange_object_id(self):

View File

@@ -237,3 +237,14 @@ class TestQualityControl(TransactionCase):
self.picking1.move_lines[:1].product_id)
self.assertEquals(self.inspection1.qty,
self.picking1.move_lines[:1].product_qty)
def test_qc_inspection_lot(self):
self.inspection1.write({
'object_id': '%s,%d' % (self.lot._model,
self.lot.id),
})
self.inspection1.onchange_object_id()
self.assertEquals(self.inspection1.lot,
self.lot)
self.assertEquals(self.inspection1.product,
self.lot.product_id)

View File

@@ -31,6 +31,10 @@
<field name="model">qc.inspection</field>
<field name="inherit_id" ref="quality_control.qc_inspection_search_view" />
<field name="arch" type="xml">
<field name="product" position="after">
<field name="picking" />
<field name="lot" groups="stock.group_production_lot" />
</field>
<filter string="Product" position="after">
<filter string="Picking"
domain="[]"