From 1f4cc0f57acb2642e4032c96f6c03f1ae5b05727 Mon Sep 17 00:00:00 2001 From: Sven Fuehr Date: Mon, 27 Nov 2023 15:11:40 +0100 Subject: [PATCH] [FIX] account: workaround for mixed currencies on invoice report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The values in the "Total" measure are all displayed in the move currency. Due to this amounts in different currencies are added together. As a workaround we introduce the possibility to group by move currency. Thus the user can choose to seperate the values by currency. The "Total" column was renamed to "Total in Currency" to avoid confusion There is a remaining problem. The totals of the individual groups are still added up to form a total. Previously it was tried to convert the values from the move currency to the move company currency and then to the active company currency. The problem is that there is no efficient way to do it correctly. task-3613358 closes odoo/odoo#144065 X-original-commit: 6d7d86cd0d8335f192112129ee92077f1f25e55b Signed-off-by: William André (wan) Signed-off-by: Sven Führ (svfu) --- addons/account/i18n/account.pot | 3 ++- addons/account/report/account_invoice_report.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index f5aea3f85f1..845e6b290a1 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -4600,6 +4600,7 @@ msgstr "" #: model:ir.model,name:account.model_res_currency #: model:ir.model.fields,field_description:account.field_account_automatic_entry_wizard__company_currency_id #: model:ir.model.fields,field_description:account.field_account_bank_statement__currency_id +#: model:ir.model.fields,field_description:account.field_account_invoice_report__currency_id #: model:ir.model.fields,field_description:account.field_account_journal__currency_id #: model:ir.model.fields,field_description:account.field_account_move__currency_id #: model:ir.model.fields,field_description:account.field_account_move_line__currency_id @@ -14472,7 +14473,6 @@ msgstr "" #. odoo-javascript #: code:addons/account/static/src/components/tax_totals/tax_totals.xml:0 #: model:ir.model.fields,field_description:account.field_account_bank_statement_line__amount_total -#: model:ir.model.fields,field_description:account.field_account_invoice_report__price_total #: model:ir.model.fields,field_description:account.field_account_move__amount_total #: model:ir.model.fields,field_description:account.field_account_move_line__price_total #: model:ir.model.fields,field_description:account.field_account_payment__amount_total @@ -14619,6 +14619,7 @@ msgid "Total amount you have to pay to this vendor." msgstr "" #. module: account +#: model:ir.model.fields,field_description:account.field_account_invoice_report__price_total #: model_terms:ir.ui.view,arch_db:account.view_invoice_tree msgid "Total in Currency" msgstr "" diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index a4f5ee9ba3a..c76b60856fc 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -45,8 +45,9 @@ class AccountInvoiceReport(models.Model): invoice_date_due = fields.Date(string='Due Date', readonly=True) account_id = fields.Many2one('account.account', string='Revenue/Expense Account', readonly=True, domain=[('deprecated', '=', False)]) price_subtotal = fields.Float(string='Untaxed Total', readonly=True) - price_total = fields.Float(string='Total', readonly=True) + price_total = fields.Float(string='Total in Currency', readonly=True) price_average = fields.Float(string='Average Price', readonly=True, group_operator="avg") + currency_id = fields.Many2one('res.currency', string='Currency', readonly=True) _depends = { 'account.move': [ @@ -103,7 +104,8 @@ class AccountInvoiceReport(models.Model): -- convert to template uom * (NULLIF(COALESCE(uom_line.factor, 1), 0.0) / NULLIF(COALESCE(uom_template.factor, 1), 0.0)), 0.0) * currency_table.rate AS price_average, - COALESCE(partner.country_id, commercial_partner.country_id) AS country_id + COALESCE(partner.country_id, commercial_partner.country_id) AS country_id, + line.currency_id AS currency_id ''' @api.model