Tax receipt subtotal now includes donations in foreign currencies

'Account' decimal precision doesn't exist in v10 -> use currency precision
Add Eligible tax receipt amount in donation report
14.0
Alexis de Lattre 8 years ago
parent 998f220649
commit d9989b2836

@ -4,7 +4,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api
import odoo.addons.decimal_precision as dp
class DonationTaxReceipt(models.Model):
@ -19,8 +18,7 @@ class DonationTaxReceipt(models.Model):
index=True)
donation_date = fields.Date(string='Donation Date')
amount = fields.Monetary(
string='Amount', digits=dp.get_precision('Account'),
currency_field='currency_id')
string='Amount', currency_field='currency_id')
currency_id = fields.Many2one(
'res.currency', string='Currency', required=True, ondelete='restrict',
default=lambda self: self.env.user.company_id.currency_id.id)
@ -49,6 +47,7 @@ class DonationTaxReceipt(models.Model):
@api.model
def update_tax_receipt_annual_dict(
self, tax_receipt_annual_dict, start_date, end_date, precision):
self, tax_receipt_annual_dict, start_date, end_date,
precision_rounding):
'''This method is inherited in donation and donation_sale
It is called by the tax.receipt.annual.create wizard'''

@ -45,10 +45,10 @@ class TaxReceiptAnnualCreate(models.TransientModel):
self.ensure_one()
dtro = self.env['donation.tax.receipt']
tax_receipt_annual_dict = {}
precision = self.env['decimal.precision'].precision_get('Account')
precision_rounding = self.env.user.company_id.currency_id.rounding
self.env['donation.tax.receipt'].update_tax_receipt_annual_dict(
tax_receipt_annual_dict, self.start_date, self.end_date,
precision)
precision_rounding)
# {commercial_partner: {
# 'amount': amount,
# 'extra_vals': {donation_ids': [donation1_id, donation2_id]}}}

Loading…
Cancel
Save