@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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
1
Trả lời
2863
Lượt xem
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.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký