[IMP] product: add related field to uom_id and display it along with cost price

This commit is contained in:
Jamin Shah
2015-03-31 14:17:06 +02:00
committed by Richard Mathot
parent 68f5187fec
commit 3a3b1979d1
3 changed files with 14 additions and 4 deletions
+1
View File
@@ -530,6 +530,7 @@ class product_template(osv.osv):
('end','End of Lifecycle'),
('obsolete','Obsolete')], 'Status'),
'uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True, help="Default Unit of Measure used for all stock operation."),
'uom_rel_id': fields.related('uom_id', type="many2one", relation="product.uom", readonly=True, string='Default UoM'),
'uom_po_id': fields.many2one('product.uom', 'Purchase Unit of Measure', required=True, help="Default Unit of Measure used for purchase orders. It must be in the same category than the default unit of measure."),
'uos_id' : fields.many2one('product.uom', 'Unit of Sale',
help='Specify a unit of measure here if invoicing is made in another unit of measure than inventory. Keep empty to use the default unit of measure.'),
+8 -1
View File
@@ -88,7 +88,14 @@
<page string="Procurements" name="procurements" groups="base.group_user">
<group name="procurement">
<group name="general" col="4">
<field name="standard_price"/>
<group name="standard_price">
<label for="standard_price"/>
<div>
<field name="standard_price" class="oe_inline"/>
<label string="/" class="oe_inline" groups="product.group_uom"/>
<field name="uom_rel_id" class="oe_inline" groups="product.group_uom"/>
</div>
</group>
<field name="uom_po_id" groups="product.group_uom"/>
</group>
</group>
+5 -3
View File
@@ -25,16 +25,18 @@
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<field name="standard_price" position="replace">
<xpath expr="//group[@name='standard_price']" position="replace">
<field name="cost_method" groups="stock_account.group_inventory_valuation" attrs="{'invisible': [('type','=','service')]}"/>
<label string="Cost Price" for="standard_price" align="1.0" groups="base.group_user"/>
<div groups="base.group_user">
<field name="standard_price" attrs="{'readonly':['&amp;', ('valuation','=','real_time'), ('cost_method', 'in', ['standard', 'average'])]}" nolabel="1"/>
<field name="standard_price" attrs="{'readonly':['&amp;', ('valuation','=','real_time'), ('cost_method', 'in', ['standard', 'average'])]}" class="oe_inline" nolabel="1"/>
<label string="/" class="oe_inline" groups="product.group_uom"/>
<field name="uom_rel_id" class="oe_inline" groups="product.group_uom"/>
<button name="%(action_view_change_standard_price)d" string="- update"
type="action" attrs="{'invisible':['|', ('valuation','!=', 'real_time'), ('cost_method', 'not in', ['standard', 'average'])]}"
class="oe_link" groups="stock_account.group_inventory_valuation"/>
</div>
</field>
</xpath>
<xpath expr="//group[@name='properties']" position="before">
<group groups="stock_account.group_inventory_valuation" attrs="{'invisible': [('type','=','service')]}">
<separator string="Inventory Valuation" colspan="4"/>