diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 40f9842a12beb..8cf5fd99a7f16 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -31,7 +31,10 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l 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'] @@ -88,15 +91,15 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l 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.create_date[:10] <= 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.create_date[:10] <= 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({ @@ -140,15 +143,15 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l 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.create_date[:10] <= 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.create_date[:10] <= 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 diff --git a/addons/account_asset/views/account_asset_views.xml b/addons/account_asset/views/account_asset_views.xml index f569a6b60b1b9..6689500c0ac91 100644 --- a/addons/account_asset/views/account_asset_views.xml +++ b/addons/account_asset/views/account_asset_views.xml @@ -28,18 +28,18 @@