mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[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:
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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="[]"
|
||||
|
||||
Reference in New Issue
Block a user