|
|
for donation in self:
total = tax_receipt_total = 0.0
for line in donation.line_ids:
line_total = line.quantity * line.unit_price
total += line_total
if line.tax_receipt_ok:
tax_receipt_total += line_total
date = donation.donation_date or fields.Date.context_today(self)
donation.amount_total = total
donation_currency = donation.currency_id
company_currency = donation.company_id.currency_id
total_company_currency = donation_currency._convert(
total, company_currency, donation.company_id, date
)
tax_receipt_total_cc = donation_currency._convert(
tax_receipt_total,
company_currency,
donation.company_id,
date,
)
donation.amount_total_company_currency = total_company_currency
donation.tax_receipt_total = tax_receipt_total_cc
|
|