odoo/odoo#170414
Created by fw-bot
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team on discord for help.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:saas-17.1-17.0-opw-3940786-Buy_MTO_variant_sensitive-lase-Idm1-fw
- head
- 4c4761a92c55917bf58d5f5bd1d163a64b25c9b2
- merged
- 2 years ago by Bugfix, Lancelot Semal (lase)
| odoo/odoo | |
|---|---|
| 17.0 | #166970 |
| saas-17.1 | #170414 |
| saas-17.2 | #170441 |
| saas-17.3 | #170498 |
| 18.0 | |
| saas-18.2 | |
| saas-18.3 | |
| saas-18.4 | |
| 19.0 | |
| saas-19.1 | |
| saas-19.2 | |
| master | #170525 |
[FW][FIX] product: assign seller depending on variant value
Steps to reproduce:
- Enable multi-step routes in the settings
- Go to Invertory > Configuration > Warehouse Management > Routes
- Unarchive MTO
- Create a product: - Routes: MTO + Buy route - Variants: Color > Black, White
- In the purchase tab of the product create two lines with: - Vendor 1 sells the Black variant - Vendor 2 sells the White variant
- Create and confirm a sale order with 2 lines: - 1 x Black variant - 1 x White variant
Expected behavior:
Two purchase order should be created:
- 1 x Black variant sold by Vendor 1
- 1 x White variant sold by Vendor 2
Current behavior:
Only one purchase order is created so that Vendor 1 as the seller of both procurements even thought vendor 2 is the only real potential seller of the white variant.
Cause of the issue:
Running the procurements of both lines of the Sale order will trigger the _run_buy method which will determine the seller by "default": https://github.com/odoo/odoo/blob/3383d5bd68bfc13b7881f72e5adbb7c27a6df30e/addons/purchase_stock/models/stock_rule.py#L70-L72 using the _prepare_sellers method. However, it relies solely on the seller_ids field of the product.template model https://github.com/odoo/odoo/blob/3383d5bd68bfc13b7881f72e5adbb7c27a6df30e/addons/product/models/product_product.py#L633-L634 Since both variants have the same template they will therefore both be associated with the same default seller.
opw-3940786
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #166970