Created
July 10, 2015 06:00
-
-
Save aek/2a6966c05b01083364cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment