Merge pull request #125 from oihane/8.0-quality_mrp_product

[IMP] quality_control_mrp: take product from manufacturing order + extended search view (*_stock)
This commit is contained in:
Pedro M. Baeza
2016-05-20 09:39:45 +02:00
3 changed files with 22 additions and 7 deletions

View File

@@ -8,15 +8,23 @@ from openerp import models, fields, api
class QcInspection(models.Model):
_inherit = 'qc.inspection'
@api.one
@api.depends('object_id')
def get_production(self):
self.production = False
if self.object_id:
if self.object_id._name == 'stock.move':
self.production = self.object_id.production_id
elif self.object_id._name == 'mrp.production':
self.production = self.object_id
for inspection in self:
if inspection.object_id:
if inspection.object_id._name == 'stock.move':
inspection.production = inspection.object_id.production_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(
comodel_name="mrp.production", compute="get_production", store=True)

View File

@@ -35,6 +35,9 @@
<field name="groups_id"
eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product" position="after">
<field name="production" />
</field>
<filter string="Product" position="after">
<filter string="Production" domain="[]"
context="{'group_by': 'production'}" />

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="[]"