Files
odoo_source/addons
Levi Siuzdak (sile) 6c736a7795 [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
5537090f1c. 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/odoo#151210

X-original-commit: 572122335a04126385115d892b027371bbabbe7e
Signed-off-by: Levi Siuzdak <sile@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2024-01-26 09:13:06 +00:00
..
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00
2024-01-26 09:13:04 +00:00
2024-01-15 09:30:53 +00:00
2024-01-26 09:13:03 +00:00
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00
2024-01-25 09:46:47 +00:00
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00
2023-10-27 08:36:16 +00:00