Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. from openerp.osv import fields, osv
  2. import openerp.addons.decimal_precision as dp
  3.  
  4. class product_dim_price(osv.osv):
  5. _inherit = "product.product"
  6.  
  7. def _get_dim_price(self, cr, uid, ids, field_name=None, arg=False, context=None):
  8. res = {}
  9. for prod in self.browse(cr, uid, ids, context=context):
  10. res[prod.id] = prod.length * prod.width
  11. return res
  12.  
  13. _columns = {
  14. 'dim_price': function(_get_dim_price, digits_compute=dp.get_precision('Product Unit of Measure'),
  15. type='float', string='Dimension Price'),
  16. }
  17. product_dim_price()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement