Files
odoo_source/addons
Julien Van Roy 992532e9ef [FIX] account_edi[_ubl_cii]: company_id when searching retrieve_partner
Bug:

1. Have at least 2 companies ("A" and "B")
2. Export an xml (Bis 3 for instance) for an invoice with customer
"Azure Interior"
3. Set a company on "Azure Interior" (say: A)
4. Import the xml in multicompany mode, with current company = B The
partner "Azure Interior" should be retrieved, but when writing it on the
invoice, it will throw a UserError "odoo.exceptions.UserError:
Incompatible companies on records: 'Draft Invoice (* 63)
(INV/2024/00006)' belongs to company 'B' and 'Partner'
(partner_id: 'Azure Interior') belongs to another company."

Cause:

We try to write a partner on an invoice belonging to another company. It
only occors when we have several companies selected because there is the
global rule `base.res_partner_rule` that will add `('company_id', 'in',
company_ids + [False])` to any search domain on the partner
(`company_ids` is replaced by `env.companies.ids`, see `_eval_context`).

Fix:

Ensure any search domain contains `env.company.id`: the `company_id` of
the move being created.

opw-3829223

closes odoo/odoo#162019

X-original-commit: 18119d446bdca9c04b7085bd1a1bd2f0e0b94ff3
Related: odoo/enterprise#60816
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Julien Van Roy (juvr) <juvr@odoo.com>
2024-04-16 17:38:12 +00:00
..
2024-04-16 07:02:57 +00:00
2024-04-09 19:35:41 +00:00