diff options
| author | IEL <iel@odoo.com> | 2020-11-02 11:12:39 +0000 |
|---|---|---|
| committer | IEL <iel@odoo.com> | 2020-11-02 15:19:44 +0000 |
| commit | 8a93bdb4af6089e4645c96f23cbc916cc38d5763 (patch) | |
| tree | 8777dc1dfae57c2debcbca563269dfce456e0ad4 | |
| parent | 4217a90548686f1360df39da210981daab301897 (diff) | |
[FIX] pad: make it work in multi-company environment
STEPS:
* install pad
* switch to a company different from res.users::company_id (Default Company for
user)
* set credentials for that company
* Open a form with pad, e.g. project.task
BEFORE: it doesn't work, pad_generate_url returns empty values
AFTER: it works
WHY: Since Odoo 13.0, current company is computed by context values provided by
company swither, while user.company_id is default value
https://github.com/odoo/odoo/blob/d6d26ea8ac0c160b1fa12f86083965a087aedc75/odoo/addons/base/models/res_users.py#L245-L246
https://github.com/odoo/odoo/blob/5c79992f1f0f1b5a8ac4c1f464347abc10a6d8d8/odoo/api.py#L555-L562
---
bug is founding during work on
opw-2369677
closes odoo/odoo#61185
X-original-commit: cbf6fd596dd87b3ad453e76957cd4c6ea8d57d80
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
| -rw-r--r-- | addons/pad/models/pad.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/pad/models/pad.py b/addons/pad/models/pad.py index c6b4825ae4e..73d94e69d11 100644 --- a/addons/pad/models/pad.py +++ b/addons/pad/models/pad.py @@ -26,7 +26,7 @@ class PadCommon(models.AbstractModel): @api.model def pad_generate_url(self): - company = self.env.user.sudo().company_id + company = self.env.company.sudo() pad = { "server": company.pad_server, @@ -75,7 +75,7 @@ class PadCommon(models.AbstractModel): @api.model def pad_get_content(self, url): - company = self.env.user.sudo().company_id + company = self.env.company.sudo() myPad = EtherpadLiteClient(company.pad_key, (company.pad_server or '') + '/api') content = '' if url: |
