Create Purchase Order PO0001 for Supplier 1 with Item 1, Qty 1 => Item Rate 0.30 € OK
Create Sales Order SAL0001 for Customer 1 with Item 1, Qty 1 => Item Rate 500 € OK
Create Material Request MAT0001 from SAL0001
Create Purchase Order PO0002 from MAT0001 (select Supplier 1 on popup) => Item Rate 500 € KO, should be 0.30
Create Purchase Order PO0003 for Supplier 1
Use "Get Item from Open Material request", Check MAT0001 => Item Rate 500 € KO, should be 0.30
Item 1 rate is 0.50 instead of 1000€
I've track it until what I can, erpnext/stock/get_item_details.py method get_item_details received the Customer 1 in args and get_price_list_rate make bad sql request
select name, price_list_rate, uom
from tabItem Price where item_code=%(item_code)s
and price_list=%(price_list)s
and coalesce(uom, '') in ('', %(uom)s) and customer=%(customer)s and %(transaction_date)s between
coalesce(valid_from, '2000-01-01') and coalesce(valid_upto, '2500-12-31')
order by valid_from desc, uom desc
{'item_code': 'Item 1', 'price_list': 'Buying Standard', 'customer': 'Customer 1', 'supplier': 'Supplier 1', 'uom': 'Unit', 'transaction_date': '2021-08-05'}
Standard selling price list Item 1 / Rate : 500 €
Standard buying price list Item 1 / Rate : 0.50 € Item 1 / Supplier 1 / Rate : 0.30 €
Create Purchase Order PO0001 for Supplier 1 with Item 1, Qty 1 => Item Rate 0.30 € OK
Create Sales Order SAL0001 for Customer 1 with Item 1, Qty 1 => Item Rate 500 € OK Create Material Request MAT0001 from SAL0001 Create Purchase Order PO0002 from MAT0001 (select Supplier 1 on popup) => Item Rate 500 € KO, should be 0.30
Create Purchase Order PO0003 for Supplier 1 Use "Get Item from Open Material request", Check MAT0001 => Item Rate 500 € KO, should be 0.30
Item 1 rate is 0.50 instead of 1000€
I've track it until what I can, erpnext/stock/get_item_details.py method get_item_details received the Customer 1 in args and get_price_list_rate make bad sql request select name, price_list_rate, uom from
tabItem Price
where item_code=%(item_code)s and price_list=%(price_list)s and coalesce(uom, '') in ('', %(uom)s) and customer=%(customer)s and %(transaction_date)s between coalesce(valid_from, '2000-01-01') and coalesce(valid_upto, '2500-12-31') order by valid_from desc, uom desc {'item_code': 'Item 1', 'price_list': 'Buying Standard', 'customer': 'Customer 1', 'supplier': 'Supplier 1', 'uom': 'Unit', 'transaction_date': '2021-08-05'}Test customer instead of supplier
Related to #2964 close in 2015 ?
https://discuss.erpnext.com/t/sales-order-material-request-purchase-order-no-price-rate-picked-up-from-price-list/72109/2