diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index c6adeaf2aca..eb1bb9c740a 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -2943,6 +2943,13 @@ msgstr "" msgid "Boolean" msgstr "" +#. module: account +#. odoo-javascript +#: code:addons/account/static/src/components/account_payment_field/account_payment.xml:0 +#, python-format +msgid "Branch:" +msgstr "" + #. module: account #: model:ir.model.fields,field_description:account.field_account_account__include_initial_balance msgid "Bring Accounts Balance Forward" diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index af7387050a3..f88528255d4 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -193,7 +193,8 @@ class account_journal(models.Model): result = {} for journal in self: graph_title, graph_key = journal._graph_title_and_key() - currency = journal.currency_id or journal.company_id.currency_id + # User may have read access on the journal but not on the company + currency = journal.currency_id or self.env['res.currency'].browse(journal.company_id.sudo().currency_id.id) journal_result = query_result[journal.id] color = '#875A7B' if 'e' in version else '#7c7bad' @@ -257,7 +258,8 @@ class account_journal(models.Model): query_results = {r['journal_id']: r for r in self.env.cr.dictfetchall()} result = {} for journal in self: - currency = journal.currency_id or journal.company_id.currency_id + # User may have read access on the journal but not on the company + currency = journal.currency_id or self.env['res.currency'].browse(journal.company_id.sudo().currency_id.id) graph_title, graph_key = journal._graph_title_and_key() sign = 1 if journal.type == 'sale' else -1 journal_data = query_results.get(journal.id) @@ -300,7 +302,7 @@ class account_journal(models.Model): dashboard_data = {} # container that will be filled by functions below for journal in self: dashboard_data[journal.id] = { - 'currency_id': journal.currency_id.id or journal.company_id.currency_id.id, + 'currency_id': journal.currency_id.id or journal.company_id.sudo().currency_id.id, 'company_count': len(self.env.companies), } self._fill_bank_cash_dashboard_data(dashboard_data) @@ -397,7 +399,8 @@ class account_journal(models.Model): } for journal in bank_cash_journals: - currency = journal.currency_id or journal.company_id.currency_id + # User may have read access on the journal but not on the company + currency = journal.currency_id or self.env['res.currency'].browse(journal.company_id.sudo().currency_id.id) has_outstanding, outstanding_pay_account_balance = outstanding_pay_account_balances[journal.id] to_check_balance, number_to_check = to_check.get(journal.id, (0, 0)) misc_balance, number_misc = misc_totals.get(journal.default_account_id, (0, 0)) @@ -457,7 +460,8 @@ class account_journal(models.Model): curr_cache = {} sale_purchase_journals._fill_dashboard_data_count(dashboard_data, 'account.move', 'entries_count', []) for journal in sale_purchase_journals: - currency = journal.currency_id or journal.company_id.currency_id + # User may have read access on the journal but not on the company + currency = journal.currency_id or self.env['res.currency'].browse(journal.company_id.sudo().currency_id.id) (number_waiting, sum_waiting) = self._count_results_and_sum_amounts(query_results_to_pay[journal.id], currency, curr_cache=curr_cache) (number_draft, sum_draft) = self._count_results_and_sum_amounts(query_results_drafts[journal.id], currency, curr_cache=curr_cache) (number_late, sum_late) = self._count_results_and_sum_amounts(late_query_results[journal.id], currency, curr_cache=curr_cache) @@ -613,7 +617,8 @@ class account_journal(models.Model): result = {} curr_cache = {} for journal in self: - currency = journal.currency_id or journal.company_id.currency_id + # User may have read access on the journal but not on the company + currency = journal.currency_id or self.env['res.currency'].browse(journal.company_id.sudo().currency_id.id) result[journal.id] = self._count_results_and_sum_amounts(query_result[journal.id], currency, curr_cache) return result diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 1c9bf7bc945..d54c13f436e 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1202,6 +1202,7 @@ class AccountMove(models.Model): reconciled_vals.append({ 'name': counterpart_line.name, 'journal_name': counterpart_line.journal_id.name, + 'company_name': counterpart_line.journal_id.company_id.name if counterpart_line.journal_id.company_id != move.company_id else None, 'amount': reconciled_partial['amount'], 'currency_id': move.company_id.currency_id.id if reconciled_partial['is_exchange'] else reconciled_partial['currency'].id, 'date': counterpart_line.date, diff --git a/addons/account/static/src/components/account_payment_field/account_payment.xml b/addons/account/static/src/components/account_payment_field/account_payment.xml index d0947e08da7..344a24c9038 100644 --- a/addons/account/static/src/components/account_payment_field/account_payment.xml +++ b/addons/account/static/src/components/account_payment_field/account_payment.xml @@ -92,6 +92,10 @@ Journal: () + + Branch: + + diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 9bf8187449d..0a834efe3ff 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -946,7 +946,7 @@