35
36
class account_invoice_line(osv.osv):
36
_name = "account.invoice.line"
37
_inherit = "account.invoice.line"
39
'cost_price': fields.float('Cost Price', digits=(16, 2)),
41
def write(self, cr, uid, ids, vals, context={}):
42
if 'product_id' in vals:
43
res=self.pool.get('product.product').read(cr, uid, [vals['product_id']], ['standard_price'])
44
vals['cost_price']=res[0]['standard_price']
45
return super(account_invoice_line, self).write(cr, uid, ids, vals, context)
37
_name = "account.invoice.line"
38
_inherit = "account.invoice.line"
40
'cost_price': fields.float('Cost Price', digits=(16, 2)),
42
def write(self, cr, uid, ids, vals, context={}):
43
if vals.get('product_id' , False):
44
res=self.pool.get('product.product').read(cr, uid, [vals['product_id']], ['standard_price'])
45
vals['cost_price']=res[0]['standard_price']
46
return super(account_invoice_line, self).write(cr, uid, ids, vals, context)
47
def create(self, cr, uid, vals, context={}):
48
if 'product_id' in vals:
49
res=self.pool.get('product.product').read(cr, uid, [vals['product_id']], ['standard_price'])
50
vals['cost_price']=res[0]['standard_price']
51
return super(account_invoice_line, self).create(cr, uid, vals, context)
48
def create(self, cr, uid, vals, context={}):
49
if vals.get('product_id',False):
50
res=self.pool.get('product.product').read(cr, uid, [vals['product_id']], ['standard_price'])
51
vals['cost_price']=res[0]['standard_price']
52
return super(account_invoice_line, self).create(cr, uid, vals, context)
52
53
account_invoice_line()
56
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: