Advertisement
rht_odoo

x_studio_loan_remaining_balance

Jan 3rd, 2025 (edited)
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. # Done by RHT on the 03/01/2024
  2. # Task : https://www.odoo.com/odoo/project/17172/tasks/4269898
  3. # Pastebin : https://pastebin.com/Fy9sXta1
  4. # Need : Know how much is to be paid off in the loan
  5. for loan in self:
  6.     invoices = loan.invoice_ids.filtered(lambda inv: inv.state == 'posted')
  7.     paid = 0
  8.     for invoice in invoices:
  9.         paid += invoice.amount_total
  10.     loan['x_studio_paid_amount'] = paid
  11.     loan['x_studio_loan_remaining_balance'] = loan.x_studio_loan_total - loan.x_studio_loanpro_paid_amount - paid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement