diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-11-15 20:39:10 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-11-15 20:39:10 +0100 |
| commit | 15f686eef60e716869f6a07069dc0d8f9a3c4f08 (patch) | |
| tree | 13452a9c11e4fd6835619beb52eccfd4360d9af5 /addons/account/report | |
| parent | f1e999d33ebfb249eb0bbfa9e99f903a18842278 (diff) | |
| parent | 468dab6748ad43865567444380abe52fb4c7a56d (diff) | |
[MERGE] forward port branch 11.0 up to 468dab6748a
Diffstat (limited to 'addons/account/report')
| -rw-r--r-- | addons/account/report/account_aged_partner_balance.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 010d79be851..38d93740912 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -42,7 +42,10 @@ class ReportAgedPartnerBalance(models.AbstractModel): res = [] total = [] cr = self.env.cr - company_ids = self.env.context.get('company_ids', (self.env.user.company_id.id,)) + user_company = self.env.user.company_id + user_currency = user_company.currency_id + ResCurrency = self.env['res.currency'].with_context(date=date_from) + company_ids = self._context.get('company_ids') or [user_company.id] move_state = ['draft', 'posted'] if target_move == 'posted': move_state = ['posted'] @@ -99,15 +102,15 @@ class ReportAgedPartnerBalance(models.AbstractModel): partner_id = line.partner_id.id or False if partner_id not in undue_amounts: undue_amounts[partner_id] = 0.0 - line_amount = line.balance - if line.balance == 0: + line_amount = ResCurrency._compute(line.company_id.currency_id, user_currency, line.balance) + if user_currency.is_zero(line_amount): continue for partial_line in line.matched_debit_ids: if partial_line.max_date <= date_from: - line_amount += partial_line.amount + line_amount += ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount) for partial_line in line.matched_credit_ids: if partial_line.max_date <= date_from: - line_amount -= partial_line.amount + line_amount -= ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount) if not self.env.user.company_id.currency_id.is_zero(line_amount): undue_amounts[partner_id] += line_amount lines[partner_id].append({ @@ -151,15 +154,15 @@ class ReportAgedPartnerBalance(models.AbstractModel): partner_id = line.partner_id.id or False if partner_id not in partners_amount: partners_amount[partner_id] = 0.0 - line_amount = line.balance - if line.balance == 0: + line_amount = ResCurrency._compute(line.company_id.currency_id, user_currency, line.balance) + if user_currency.is_zero(line_amount): continue for partial_line in line.matched_debit_ids: if partial_line.max_date <= date_from: - line_amount += partial_line.amount + line_amount += ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount) for partial_line in line.matched_credit_ids: if partial_line.max_date <= date_from: - line_amount -= partial_line.amount + line_amount -= ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount) if not self.env.user.company_id.currency_id.is_zero(line_amount): partners_amount[partner_id] += line_amount |
