I'm trying to override the _amount_line
function in sale.order.line
model in order to add custum logic.
Here is my code:
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
def _amount_line(self):
tax_obj = self.env['account.tax']
cur_obj = self.env['res.currency']
res = {}
for line in self:
print line.tax_id
price = self._calc_line_base_price(line)
qty = self._calc_line_quantity(line)
print" price:{} & quantity: {}".format(price,qty)
taxes = tax_obj.compute_all(line.tax_id, price, qty,
line.product_id,
line.order_id.partner_id)
cur = line.order_id.pricelist_id.currency_id
res[line.id] = cur_obj.round(cur, taxes['total'])
return res
remise_palier = fields.Float('Remise palier (%)')
remise_total = fields.Float('Remise totale (%)')
price_subtotal = fields.Float(compute='_amount_line', string='Subtotal')
When i run Odoo, i get that error: