I had edit the funtion of compute_amount everything is okay the problem now is when I pay the invoice I'm still getting the old amount before any change so for that I had edit the residual_amount but still the old amount is shown as a debit on the account_move_line has anyone work on this???
This is my new functions:
@api.one
@api.depends('invoice_line.price_subtotal', 'tax_line.amount','timbre','partner_id')
def _compute_amount(self):
if self.type == 'out_invoice':
if self.partner_id.rs == True:
print'rs',self.partner_id.rs
self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line)
self.amount_tax = sum(line.amount for line in self.tax_line)
self.amount_rs = (self.amount_untaxed + self.amount_tax) * 0.01
self.amount_total = self.amount_untaxed + self.amount_tax + self.amount_rs + self.timbre
else :
self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line)
self.amount_tax = sum(line.amount for line in self.tax_line)
self.amount_total = self.amount_untaxed + self.amount_tax + self.timbre
else :
self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line)
self.amount_tax = sum(line.amount for line in self.tax_line)
self.amount_total = self.amount_untaxed + self.amount_tax
def invoice_validate(self, cr, uid, ids, context=None):
res = super(snc_invoice, self).invoice_validate(cr, uid, ids, context=context)
for inv in self.browse(cr, uid, ids, context=context):
if inv.type == 'out_invoice':
inv.write({'residual':inv.amount_total})
return res