@api.model
def write(self, values):
invoice_paid_amount = 0
res = super(AccountMove, self).write(values)
if 'state' in values and values['state'] == 'posted':
invoice_id = self.env['account.move'].search([('name', '=', self.ref)])
if invoice_id.type == 'out_invoice':
invoice_paid_amount += abs(invoice_id.amount_total - invoice_id.amount_residual)
print("invoice_paid_amount", invoice_paid_amount)
else:
print("error")
return res
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
2264
Views
invoice_paid_amount = 0
for line in invoice_id._get_reconciled_info_JSON_values():
invoice_paid_amount += line['amount']
print("invoice_paid_amount", invoice_paid_amount)
Useful! Thanks for sharing.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up