[FIX] purchase: revert revision 7677 to set a default unit of measure to 'Unit'
This allows to field a purchase.order without showing the units of measure if not product is selected Revision 7677 was integrated to fix lp:958897 (no change of uom when selecting a product whose uom is in the category 'Units'). This fix did not solve it properly (only for initial value) and introduced another problem. A better fix will be done on the onchange product. bzr revid: mat@openerp.com-20131129143522-i85e4hvf0p4h3ynn
This commit is contained in:
parent
5c3dbb8aa8
commit
556c7f03f0
|
@ -853,6 +853,14 @@ class purchase_order_line(osv.osv):
|
|||
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
|
||||
return res
|
||||
|
||||
def _get_uom_id(self, cr, uid, context=None):
|
||||
try:
|
||||
proxy = self.pool.get('ir.model.data')
|
||||
result = proxy.get_object_reference(cr, uid, 'product', 'product_uom_unit')
|
||||
return result[1]
|
||||
except Exception, ex:
|
||||
return False
|
||||
|
||||
_columns = {
|
||||
'name': fields.text('Description', required=True),
|
||||
'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), required=True),
|
||||
|
@ -879,6 +887,7 @@ class purchase_order_line(osv.osv):
|
|||
|
||||
}
|
||||
_defaults = {
|
||||
'product_uom' : _get_uom_id,
|
||||
'product_qty': lambda *a: 1.0,
|
||||
'state': lambda *args: 'draft',
|
||||
'invoiced': lambda *a: 0,
|
||||
|
|
Loading…
Reference in New Issue