-
-
Notifications
You must be signed in to change notification settings - Fork 924
Description
Module
purchase_blanket_order
Describe the bug
When working in a multi-company environment, the method _get_eligible_bo_lines_domain does not filter blanket order lines by company.
As a result, if there is a valid blanket order line in another company, the system may incorrectly select that line. Additionally, if both companies are not active at the same time, an access rights error is raised due to attempting to access records from a company the user does not currently have active.
The issue is caused by the missing company_id filter in the domain returned by the method.
To Reproduce
Multi-company environments (tested in Odoo 16 and 17 with purchase_blanket_order module installed)
Steps to reproduce the behavior:
Create two companies (Company A and Company B).
In both companies, create blanket orders with the same product and valid remaining quantities.
In Company A, create a purchase order line that triggers _get_eligible_bo_lines_domain.
Ensure only Company A is active in the user’s allowed companies.
Expected behavior
The system should only consider blanket order lines belonging to the same company as the purchase order.
The domain returned by _get_eligible_bo_lines_domain should include a filter on company_id to prevent cross-company record selection and avoid access rights errors.
Additional context
- Multi-company environment
- Standard Odoo access rules enabled
- The issue occurs because the current domain:
[
("product_id", "=", self.product_id.id),
("remaining_qty", ">=", base_qty),
("currency_id", "=", self.order_id.currency_id.id),
("order_id.state", "=", "open"),
]