[IMP] cm,kg with height,length,widthand wigth

bzr revid: shp@tinyerp.com-20121122090731-ozrp4wudie5e2row
This commit is contained in:
pankita shah (Open ERP) 2012-11-22 14:37:31 +05:30
parent 9fd2734274
commit 991f538fb1
4 changed files with 13 additions and 28 deletions

View File

@ -248,7 +248,7 @@
<field name="weight_net" groups="base.group_no_one"/>
</group>
<group>
<field name="uom_id" nolabel="1"/>
<field name="product_uom_weight" nolabel="1"/>
</group>
</field>
</field>

View File

@ -66,7 +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),
'product_uom_weight': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of Measure (Unit of Measure) is the unit of measurement for Duration",),
}
def _prepare_shipping_invoice_line(self, cr, uid, picking, invoice, context=None):
@ -134,16 +134,8 @@ 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,
'product_uom_weight': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('kg'))], context=c)[0],
}
stock_picking()

View File

@ -784,9 +784,9 @@ class product_packaging(osv.osv):
'height': fields.float('Height', help='The height of the package'),
'width': fields.float('Width', help='The width of the package'),
'length': fields.float('Length', help='The length of the package'),
'uom_id': fields.related('uom_id', 'product_id', type='many2one', relation='product.uom', string='UoM', readonly=True),
'uom_id1': fields.related('uom_id', 'product_id', type='many2one', relation='product.uom', string='UoM', readonly=True),
'uom_id2': fields.related('uom_id', 'product_id', type='many2one', relation='product.uom', string='UoM', readonly=True),
'product_uom_width': fields.many2one('product.uom', 'Unit of Measure',readonly="1", required=True, help="Unit of Measure (Unit of Measure) is the unit of measurement for Duration",),
'product_uom_length': fields.many2one('product.uom', 'Unit of Measure', readonly="1",required=True, help="Unit of Measure (Unit of Measure) is the unit of measurement for Duration",),
'product_uom_height': fields.many2one('product.uom', 'Unit of Measure',readonly="1", required=True, help="Unit of Measure (Unit of Measure) is the unit of measurement for Duration",),
}
@ -812,21 +812,14 @@ class product_packaging(osv.osv):
res = cr.fetchone()
return (res and res[0]) or False
def _get_uom(self, cr, uid, context=None):
try:
product = self.pool.get('ir.model.data').get_object(cr, uid, 'product', 'product_uom_cm')
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 = {
'rows' : lambda *a : 3,
'sequence' : lambda *a : 1,
'ul' : _get_1st_ul,
'uom_id': _get_uom,
'uom_id1': _get_uom,
'uom_id2': _get_uom,
'product_uom_width': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('cm'))], context=c)[0],
'product_uom_length': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('cm'))], context=c)[0],
'product_uom_height': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('cm'))], context=c)[0]
}
def checksum(ean):

View File

@ -564,11 +564,11 @@
<field name="weight"/>
<separator colspan="6" string="Pallet Dimension"/>
<field name="height"/>
<field name="uom_id" nolabel="1"/>
<field name="product_uom_height" nolabel="1"/>
<field name="width"/>
<field name="uom_id2" nolabel="1"/>
<field name="product_uom_width" nolabel="1"/>
<field name="length"/>
<field name="uom_id1" nolabel="1"/>
<field name="product_uom_length" nolabel="1"/>
<newline/>
<separator colspan="6" string="Other Info"/>
<field colspan="4" name="name"/>