[IMP]delivery:set kg as UoM with weight field in Internal Moves
bzr revid: ssu@tinyerp.com-20121112133321-qkksfl7lg7423d1j
This commit is contained in:
parent
9cb1b65cc7
commit
50fa72389b
|
@ -243,8 +243,13 @@
|
|||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="before">
|
||||
<field name="weight"/>
|
||||
<field name="weight_net" groups="base.group_no_one"/>
|
||||
<group>
|
||||
<field name="weight"/>
|
||||
<field name="weight_net" groups="base.group_no_one"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="uom_id" nolabel="1"/>
|
||||
</group>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -66,6 +66,7 @@ class stock_picking(osv.osv):
|
|||
}),
|
||||
'carrier_tracking_ref': fields.char('Carrier Tracking Ref', size=32),
|
||||
'number_of_packages': fields.integer('Number of Packages'),
|
||||
'uom_id': fields.related('uom_id', 'product_id', type='many2one', relation='product.uom', string='UoM', readonly=True),
|
||||
}
|
||||
|
||||
def _prepare_shipping_invoice_line(self, cr, uid, picking, invoice, context=None):
|
||||
|
@ -133,6 +134,18 @@ class stock_picking(osv.osv):
|
|||
invoice_obj.button_compute(cr, uid, [invoice.id], context=context)
|
||||
return result
|
||||
|
||||
def _get_uom(self, cr, uid, context=None):
|
||||
try:
|
||||
product = self.pool.get('ir.model.data').get_object(cr, uid, 'product', 'product_uom_kgm')
|
||||
except ValueError:
|
||||
# a ValueError is returned if the xml id given is not found in the table ir_model_data
|
||||
return False
|
||||
return product.id
|
||||
|
||||
_defaults = {
|
||||
'uom_id': _get_uom,
|
||||
}
|
||||
|
||||
stock_picking()
|
||||
|
||||
class stock_move(osv.osv):
|
||||
|
|
Loading…
Reference in New Issue