diff options
| author | Goffin Simon <sig@odoo.com> | 2021-04-13 14:44:16 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2021-04-22 14:10:39 +0000 |
| commit | 2279d84b4aefc8e488ccc33c30b816e988867589 (patch) | |
| tree | 29a51686ab10211a1b21776678d9ae4d4e39a2d7 /addons | |
| parent | 45c839deaa45225b3613805aebf88e167535bc71 (diff) | |
[FIX] account: Access error in multi companies
Steps to reproduce the bug:
- Let's consider two companies C1, C2 and a partner P in C2
- Let's consider an customner invoice I in C1 with P as customer
- Go to Accounting > Accounting > Partner Ledger and select I
- Click on Reconcie
Bug:
An access error was raised due to the ir.rule res.partner company
opw:2446242
closes odoo/odoo#69190
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_move.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index a6a9c7d4358..5da7aed781f 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2827,7 +2827,8 @@ class AccountMove(models.Model): } for line in preview_vals['items_vals']: if 'partner_id' in line[2]: - line[2]['partner_id'] = self.env['res.partner'].browse(line[2]['partner_id']).display_name + # sudo is needed to compute display_name in a multi companies environment + line[2]['partner_id'] = self.env['res.partner'].browse(line[2]['partner_id']).sudo().display_name line[2]['account_id'] = self.env['account.account'].browse(line[2]['account_id']).display_name or _('Destination Account') line[2]['debit'] = currency_id and formatLang(self.env, line[2]['debit'], currency_obj=currency_id) or line[2]['debit'] line[2]['credit'] = currency_id and formatLang(self.env, line[2]['credit'], currency_obj=currency_id) or line[2]['debit'] |
