Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from openerp.osv import fields, osv
- import openerp.addons.decimal_precision as dp
- class product_dim_price(osv.osv):
- _inherit = "product.product"
- def _get_dim_price(self, cr, uid, ids, field_name=None, arg=False, context=None):
- res = {}
- for prod in self.browse(cr, uid, ids, context=context):
- res[prod.id] = prod.length * prod.width
- return res
- _columns = {
- 'dim_price': function(_get_dim_price, digits_compute=dp.get_precision('Product Unit of Measure'),
- type='float', string='Dimension Price'),
- }
- product_dim_price()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement