mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[9.0] mrp_repair_refurbish: travis and comments.
This commit is contained in:
@@ -7,11 +7,16 @@ from openerp import api, fields, models
|
||||
|
||||
|
||||
class mrp_repair(orm.Model):
|
||||
"""To inherit using old api is needed here in order to be able to modify
|
||||
the onchange method for `product_id`.
|
||||
NOTE: This should be moved to new api in v10, when the standard is also
|
||||
migrated.
|
||||
"""
|
||||
_inherit = 'mrp.repair'
|
||||
|
||||
def onchange_product_id(self, cr, uid, ids, product_id=None):
|
||||
res = super(mrp_repair, self).onchange_product_id(cr, uid, ids,
|
||||
product_id=product_id)
|
||||
res = super(mrp_repair, self).onchange_product_id(
|
||||
cr, uid, ids, product_id=product_id)
|
||||
product = self.pool['product.product'].browse(cr, uid, product_id)
|
||||
res['value']['to_refurbish'] = True if \
|
||||
product.refurbish_product_id else False
|
||||
@@ -66,6 +71,11 @@ class MrpRepair(models.Model):
|
||||
|
||||
|
||||
class mrp_repair_line(orm.Model):
|
||||
"""To inherit using old api is needed here in order to be able to modify
|
||||
the onchange method for `type`.
|
||||
NOTE: This should be moved to new api in v10, when the standard is also
|
||||
migrated.
|
||||
"""
|
||||
_inherit = 'mrp.repair.line'
|
||||
|
||||
def onchange_operation_type(self, cr, uid, ids, type, guarantee_limit,
|
||||
@@ -74,8 +84,8 @@ class mrp_repair_line(orm.Model):
|
||||
cr, uid, ids, type, guarantee_limit, company_id=company_id,
|
||||
context=context)
|
||||
|
||||
if (type == 'add' and 'to_refurbish' in context
|
||||
and context['to_refurbish']):
|
||||
if (type == 'add' and 'to_refurbish' in context and
|
||||
context['to_refurbish']):
|
||||
res['value']['location_dest_id'] = context[
|
||||
'refurbish_location_dest_id']
|
||||
return res
|
||||
|
||||
@@ -9,6 +9,6 @@ from openerp import fields, models
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
refurbish_product_id = fields.Many2one(comodel_name='product.product',
|
||||
string='Refurbished Product',
|
||||
domain="[('type', '=', 'product')]")
|
||||
refurbish_product_id = fields.Many2one(
|
||||
comodel_name='product.product', string='Refurbished Product',
|
||||
domain="[('type', '=', 'product')]")
|
||||
|
||||
@@ -1,56 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
<record id="view_repair_order_tree" model="ir.ui.view">
|
||||
<field name="name">mrp.repair.tree</field>
|
||||
<field name="model">mrp.repair</field>
|
||||
<field name="inherit_id" ref="mrp_repair.view_repair_order_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="refurbish_product_id"/>
|
||||
</field>
|
||||
<record id="view_repair_order_tree" model="ir.ui.view">
|
||||
<field name="name">mrp.repair.tree</field>
|
||||
<field name="model">mrp.repair</field>
|
||||
<field name="inherit_id" ref="mrp_repair.view_repair_order_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="refurbish_product_id"/>
|
||||
</field>
|
||||
</record>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_repair_order_form" model="ir.ui.view">
|
||||
<field name="name">mrp.repair.form</field>
|
||||
<field name="model">mrp.repair</field>
|
||||
<field name="inherit_id" ref="mrp_repair.view_repair_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[1]" position="inside">
|
||||
<group>
|
||||
<field name="to_refurbish"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('to_refurbish', '=', False)]}">
|
||||
<field name="refurbish_product_id"
|
||||
attrs="{'required': [('to_refurbish', '=', True)]}"/>
|
||||
<field name="refurbish_lot_id"
|
||||
domain="[('product_id', '=', refurbish_product_id)]"
|
||||
context="{'default_product_id': refurbish_product_id}"
|
||||
groups="stock.group_production_lot"/>
|
||||
<field name="refurbish_location_dest_id"
|
||||
attrs="{'required': [('to_refurbish', '=', True)]}"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<field name="operations"
|
||||
position='attributes'>
|
||||
<attribute name='context'>{'default_product_uom_qty': product_qty, 'to_refurbish': to_refurbish, 'refurbish_location_dest_id': location_dest_id}</attribute>
|
||||
</field>
|
||||
<record id="view_repair_order_form" model="ir.ui.view">
|
||||
<field name="name">mrp.repair.form</field>
|
||||
<field name="model">mrp.repair</field>
|
||||
<field name="inherit_id" ref="mrp_repair.view_repair_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[1]" position="inside">
|
||||
<group>
|
||||
<field name="to_refurbish"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('to_refurbish', '=', False)]}">
|
||||
<field name="refurbish_product_id"
|
||||
attrs="{'required': [('to_refurbish', '=', True)]}"/>
|
||||
<field name="refurbish_lot_id"
|
||||
domain="[('product_id', '=', refurbish_product_id)]"
|
||||
context="{'default_product_id': refurbish_product_id}"
|
||||
groups="stock.group_production_lot"/>
|
||||
<field name="refurbish_location_dest_id"
|
||||
attrs="{'required': [('to_refurbish', '=', True)]}"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<field name="operations"
|
||||
position='attributes'>
|
||||
<attribute name='context'>{'default_product_uom_qty': product_qty, 'to_refurbish': to_refurbish, 'refurbish_location_dest_id': location_dest_id}</attribute>
|
||||
</field>
|
||||
</record>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_repair_order_form_filter" model="ir.ui.view">
|
||||
<field name="name">mrp.repair.select</field>
|
||||
<field name="model">mrp.repair</field>
|
||||
<field name="inherit_id" ref="mrp_repair.view_repair_order_form_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="to_refurbish"/>
|
||||
<field name="refurbish_product_id"/>
|
||||
</field>
|
||||
<record id="view_repair_order_form_filter" model="ir.ui.view">
|
||||
<field name="name">mrp.repair.select</field>
|
||||
<field name="model">mrp.repair</field>
|
||||
<field name="inherit_id" ref="mrp_repair.view_repair_order_form_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="to_refurbish"/>
|
||||
<field name="refurbish_product_id"/>
|
||||
</field>
|
||||
</record>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="product_normal_form_view" model="ir.ui.view">
|
||||
<field name="name">product.product.form</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="mode">primary</field>
|
||||
<field eval="7" name="priority"/>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="inventory" position="after">
|
||||
<group name="refurbish" string="Refurbish">
|
||||
<field name="refurbish_product_id"/>
|
||||
</group>
|
||||
<odoo>
|
||||
|
||||
<record id="product_normal_form_view" model="ir.ui.view">
|
||||
<field name="name">product.product.form</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="mode">primary</field>
|
||||
<field eval="7" name="priority"/>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="inventory" position="after">
|
||||
<group name="refurbish" string="Refurbish">
|
||||
<field name="refurbish_product_id"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,35 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
<record id="product_template_only_form_view" model="ir.ui.view">
|
||||
<field name="name">product.template.product.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="mode">primary</field>
|
||||
<field name="priority" eval="8" />
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="inventory" position="after">
|
||||
<group name="refurbish" string="Refurbish" attrs="{'invisible':[('product_variant_count', '>', 1)]}">
|
||||
<field name="refurbish_product_id"/>
|
||||
</group>
|
||||
<record id="product_template_only_form_view" model="ir.ui.view">
|
||||
<field name="name">product.template.product.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="mode">primary</field>
|
||||
<field name="priority" eval="8" />
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="inventory" position="after">
|
||||
<group name="refurbish" string="Refurbish" attrs="{'invisible':[('product_variant_count', '>', 1)]}">
|
||||
<field name="refurbish_product_id"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_template_property_form" model="ir.ui.view">
|
||||
<field name="name">product.template.stock.property.form.inherit</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.view_template_property_form"/>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
<field name="property_stock_production"
|
||||
position="after">
|
||||
<field name="property_stock_refurbish"
|
||||
domain="[('usage','=','production')]"/>
|
||||
</field>
|
||||
</record>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_template_property_form" model="ir.ui.view">
|
||||
<field name="name">product.template.stock.property.form.inherit</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.view_template_property_form"/>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
<field name="property_stock_production"
|
||||
position="after">
|
||||
<field name="property_stock_refurbish"
|
||||
domain="[('usage','=','production')]"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user