fix: get correct Buying Price (according Item Price and Price List) on Purchase Order from "Get Items From Material Request" button
close: #32038
Before :
https://user-images.githubusercontent.com/1050053/187699062-a0c8a3f7-6212-4a28-b4d4-8b83f9a8b3bf.mp4
After :
https://user-images.githubusercontent.com/1050053/188278602-b354666c-c5e2-47a3-a9bb-39947269f0e4.mp4
Note to reviewer: I try to manage it on server side with erpnext.stock.doctype.material_request.material_request.make_purchase_order_based_on_supplier but honestly apply_price_list is not a server method, every where I dig it was done on client side, to replicate on server side the JS code done by transaction(.js).apply_price_list will give a huge change PR. I also wonder if we should let user the choice to apply price list (a check box in frappe.ui.form.MultiSelectDialog) but to me get item line into Purchase Order and get a different rate as if you add it manually (with Add line button on Item table) is not coherent
@rohitwaghchaure @s-aga-r Do not hesitate to tell me if something is wrong with this PR, I'm open to all comment. The fact is the bug is here, I want to gentle contribute to solve it. Note: on github with firefox (only browser I try) if video do aren't loaded at first display just reload the page.
@FHenry The current implementation is incorrect, this will override user entered rates in Material Request when pulled in Purchase Order.
The sales order already has a button to create a Purchase Order from a Sales Order, there the item rate is correctly fetched as per price list and supplier price list as well, you can replicate the same workflow for Material Request, it server side so API friendly as well.
@deepeshgarg007 Hi, I understand you'r workflow, but what happening here is:
Sales Teams Users input Sales Order, and create Materials Requests (buying type) for each Items that are not already in stock. They are doing that for many Sales Order for many different customer. They don't have to know the buying price, they only know the selling price.
The Purchase Manager don't know what is going on in Sales part. Once a week, he only know Suppliers that have to make Purchase Order for. So he will to group all Material Request Item (with the same default supplier) into one Purchase Order (as there is supplier minimum orders quantity). He didn't know the selling price, only the buying price is his concern.
Basically the Purchase Manager should not know the Materiel Request, he only deals with Purchase Order.
How do you explain to a ERPNext User the fact that an Item from Material Request have a selling price into Purchase Order, and if you add manually the same Item, the buying price is different (as it comes correctly from Item Price List) ?
If I follow your workflow, I should have to put the good buying price from at the Material Request Level (by overriding the validate method) ?
@deepeshgarg007 Hi, I understand you'r workflow, but what happening here is:
Sales Teams Users input Sales Order, and create Materials Requests (buying type) for each Items that are not already in stock. They are doing that for many Sales Order for many different customer. They don't have to know the buying price, they only know the selling price.
The Purchase Manager don't know what is going on in Sales part. Once a week, he only know Suppliers that have to make Purchase Order for. So he will to group all Material Request Item (with the same default supplier) into one Purchase Order (as there is supplier minimum orders quantity). He didn't know the selling price, only the buying price is his concern.
Basically the Purchase Manager should not know the Materiel Request, he only deals with Purchase Order.
How do you explain to a ERPNext User the fact that an Item from Material Request have a selling price into Purchase Order, and if you add manually the same Item, the buying price is different (as it comes correctly from Item Price List) ?
If I follow your workflow, I should have to put the good buying price from at the Material Request Level (by overriding the validate method) ?
@FHenry The scenario you are mentioning can be handled via Perm Levels but from Material Request to Purchase Order same rate should be populated
@deepeshgarg007 yes for one material request to one purchase order, but I would like to make one purchase order from multiple material request. But I've got an idea that I'll implement for you to try. On the dialog "get item from open material order", where you choose the material request, a checkbox "Apply price list rate rather than material request rate", and only if checked do the apply price list
@deepeshgarg007 yes for one material request to one purchase order, but I world like to make one purchase order from multiple material request. But I've got an idea that I'll implement for you to try. On the dialog "get item from open material order", where you choose the material request, a checkbox "Apply price list rate rather than material request rate", and only if checked do the apply price list
@FHenry This complicates things unnecessarily, that dialog box is not easy to manipulate. Since the rate in Material Request anyways doesn't matter why not add the price list rate in Material Request itself, the rate PO guys will see will be of purchase and you won't have the issue to hide them
@deepeshgarg007 Hi, It can be done.
https://user-images.githubusercontent.com/1050053/193789395-085a47f3-65ac-4ddc-9418-cc1cc2deab9e.mp4
What do you think ?
@deepeshgarg007 yes for one material request to one purchase order, but I world like to make one purchase order from multiple material request. But I've got an idea that I'll implement for you to try. On the dialog "get item from open material order", where you choose the material request, a checkbox "Apply price list rate rather than material request rate", and only if checked do the apply price list
@FHenry This complicates things unnecessarily, that dialog box is not easy to manipulate. Since the rate in Material Request anyways doesn't matter why not add the price list rate in Material Request itself, the rate PO guys will see will be of purchase and you won't have the issue to hide them
That's another way of doing the job. Do you suggest, if I implement buying price list in material request (for purchase type) (from re-order or sales order) it can be accepted?
@deepeshgarg007 yes for one material request to one purchase order, but I world like to make one purchase order from multiple material request. But I've got an idea that I'll implement for you to try. On the dialog "get item from open material order", where you choose the material request, a checkbox "Apply price list rate rather than material request rate", and only if checked do the apply price list
@FHenry This complicates things unnecessarily, that dialog box is not easy to manipulate. Since the rate in Material Request anyways doesn't matter why not add the price list rate in Material Request itself, the rate PO guys will see will be of purchase and you won't have the issue to hide them
That's another way of doing the job. Do you suggest, if I implement buying price list in material request (for purchase type) (from re-order or sales order) it can be accepted?
Yes then it can be accepted, make sure its only on load and the user should be able to change it later
@FHenry Waiting for changes requested, closing this until then