Skip to content

Commit

Permalink
[FIX] account_invoice_inter_company: Check the product with proper co…
Browse files Browse the repository at this point in the history
…mpany context

Not passing through context the corresponding force_company and
allowed_company_ids keys, the check is not done properly in all
scenarios.

Steps to reproduce the problem:

- Have `product_multi_company` installed.
- Create a product with no company_ids filled.
- Create a customer invoice from one company to another.
- Try to validate.

Result: The message saying that the product is not multi-company
appears.

TT45745
  • Loading branch information
pedrobaeza committed Oct 31, 2023
1 parent aa56345 commit aabd788
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion account_invoice_inter_company/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ def _check_intercompany_product(self, dest_company):
try:
line.sudo(False).product_id.product_tmpl_id.with_user(
dest_user
).check_access_rule("read")
).with_context(
force_company=dest_company.id,
allowed_company_ids=dest_company.ids,
).check_access_rule(
"read"
)
except AccessError:
raise UserError(
_(
Expand Down

0 comments on commit aabd788

Please sign in to comment.