To reproduce the issue:
1. In Settings, enable "Multi-Step Routes"
2. Edit the route "Dropship Subcontractor on Order":
- Open the Buy rule:
- Propagation of Procurement Group: Leave Empty
3. Create three products P1, P2, P_comp:
- Storable
- With a vendor (V1, V2, V_comp)
- P_comp's routes:
- Dropship Subcontractor on Order
4. Create a BoM:
- Product: P1
- Type: Subcontracting
- Subcontractors: V1
- Components: 1 x P_comp
5. Repeat step 4 with P2 and V2
6. Create and confirm a PO:
- Vendor: V1
- Products: 1 x P1
7. Repeat step 6 with V2 and P2
8. Open the purchase orders list
Error: There is only one PO with V_comp. It contains 2 x P_comp and
the dropship address is P1. This is incorrect. There should be two
PO, one for P1 and another one for P2
When confirming the PO, a MO is created (subcontracted) and then the
system creates and processes a procurement for the component.
Because of the component's routes, it leads to the `_run_buy` method.
It will check whether a PO already exists or has to be created. To do
so, it creates a domain based on few criteria, such as the value of
`dest_address_id`:
https://github.com/odoo/odoo/blob/6d28c9c2e5ea3e9a3b8a872627a411bbfe2f2a59/addons/mrp_subcontracting_dropshipping/models/stock_rule.py#L17-L21
But here is the issue: `partner_id` is not defined.
OPW-3370648
closesodoo/odoo#128791
X-original-commit: 094e45d120c525d8b65bca7c0d10d10dbb6383cd
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>