odoo/odoo#193378

Created by fw-bot
Merged at 4759c5f1649b2a9bd3378b6e29cd2b806e86ea37

Statuses:

label
odoo-dev:master-17.0-opw-4347134-vendor_price_po-gute-oq7_-fw
head
4d52ed06dbf100ce91a553b308723c71caf3efe5
merged
9 months ago by Logistics, William Henrotin (whe)
odoo/odoo
17.0 #189272
saas-17.2 #192871
saas-17.4 #192889
18.0 #192918
saas-18.1 #193361
saas-18.2
saas-18.3
saas-18.4
19.0
master #193378

[FW][FIX] purchase: set_vendor_price_po_company

The issue:
When a vendor has multiple prices for two companies (A and B), and the purchase order's company is set to B (while the user's main company is A), the price incorrectly defaults to the main company A's price.

How to reproduce the issue:
1) Create a new product with 2 vendor pricelist records that have different "Unit Prices" under the "Purchase" tab of the product -> each pricelist record should belong to a different company

2) Create an RFQ for this product with both of these companies active

3) Change the "Company" on the PO under the "Other Information" tab to the company that is NOT shown in the top right-hand corner, but is still selected

4) Add the product to the RFQ order line
- The "Unit Price" will be pulled from the main company shown in the top-right hand corner, thereby ignoring the "Company" selected for the PO.

After this commit, the price from the purchase order's company (B) is prioritized over the main company (A).

opw-4347134


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #192918
Forward-Port-Of: #189272