This question has been flagged
1 Reply
3713 Views

hello ,


# -*- coding: utf-8 -*-

from openerp.osv import osv, fields

class account_line(osv.osv):

_inherit = 'account.invoice.line'

_columns = {

'rem1': fields.float(string='Remise1'),

'rem2': fields.float(string='Remise2'),

'rem3': fields.float(string='Remise3'),

'gratuite_qte': fields.float(string='Gratuite_Qte'),

}


i want to herite a fonction from account.invoice.line module and change the column (price_subtotal = taxes['total'] + rem1) . this is fonction's code :

def _compute_price(self):

price = self.price_unit * (1 - (self.discount or 0.0) / 100.0)

print 'Prix : ',price

taxes = self.invoice_line_tax_id.compute_all(price, self.quantity, product=self.product_id, partner=self.invoice_id.partner_id)

print taxes['total']

self.price_subtotal = taxes['total']

if self.invoice_id:

self.price_subtotal = self.invoice_id.currency_id.round(self.price_subtotal)

Avatar
Discard
Best Answer

You need to redefine all the function fields that uses _compute_price in your module.  You may want to use super() call instead of re-writing the whole thing again.  Also, be very careful with how you change compute_price.  It may affect taxation calculation.

Avatar
Discard