[FIX] account: workaround for mixed currencies on invoice report

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) <wan@odoo.com>
Signed-off-by: Sven Führ (svfu) <svfu@odoo.com>
This commit is contained in:
Sven Fuehr
2023-11-30 11:44:53 +00:00
parent c1d1721b5d
commit 1f4cc0f57a
2 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -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 ""
@@ -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