Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] product: improve variant-template consistency in supplierinfo
Versions -------- 15.0+ Steps ----- 1. Go to Purchase; 2. create a Vendor Pricelist; 3. select a Product, a Product Variant & a Unit Price; 4. empty the Product field & save; 5. create a RFQ; 6. add the Product Variant from the Vendor Pricelist. Issue ----- The product's price remains 0. Cause ----- The `seller_ids` field in `product.template` creates one-to-many relation with `product.supplierinfo`'s `product_tmpl_id` field. While it is possible to select a specific product variant and have the product field empty, this renders the Vendor Pricelist unavailable for Purchase Orders. Solution -------- Add a `_sanitize_vals` method to `product.supplierinfo` to be used on create/write, which ensures that if there's a `product_id`, the record's `product_tmpl_id` is consistent with it. This allows for record imports to be usable & consistent when only a variant is specified. Also backport a modified `onchange` method added in 5537090. Originally it only reset `product_id` if `product_tmpl_id` was changed to a different non-falsy value. Modified, it also resets `product_id` if `product_tmpl_id` is changed to a falsy value, as it would otherwise just re-add the removed value on create/write after this commit. opw-3664524 closes odoo#151210 X-original-commit: 5721223 Signed-off-by: Levi Siuzdak <sile@odoo.com> Signed-off-by: William Henrotin (whe) <whe@odoo.com>
- Loading branch information