Buying Price on Purchase Order From Material Request (How do you do ?)

Hello,

I have a use case and I think that ERPNext is not logic, but “Change My mind” or “Vote for PR” :

Sales Teams input Sales Order, and create Materials Requests (buying type) for each Items (that are not already in stock but whatever). They are doing that for many Sales Order for many different Customer (so different suppliers also but they don’t care, it’s not their jobs). They don’t to know the Supplier or what come after they only sells item.

The Purchase Team don’t know what is going on in Sales Team. But once a week, they check a report that display all Supplier that are concern as they are the default Supplier on each Items into open Material Request.
So they will to group all Material Request Item (with the same default supplier) into one Purchase Order, with the button “Get Items from Open Material Requests”. They didn’t know the selling price, only the buying price is his concern.

But in this case the buying price that come into Purchase Order is the Selling price…

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) ?

  • How do you manage this use case ?
    or
  • Should it be different in ERPNext ?

In Data way :

Supplier
Name: Supplier 1

Customer
Name: Customer 1

Item
Name : Item 1
Default Supplier for the only Company = Supplier 1

Item Price
Item : Item 1
Price List: Selling Standard
Rate : 150

Item : Item 1
Price List: Buying Standard
Rate : 50

Item : Item 1
Price List: Buying Standard
Supplier : Supplier 1
Rate : 20

Sales Order
Customer : Customer 1
Item table :
Item 1 , rate =150 => OK

Create a Material Request from this Sales Order
Material Request
Item table :
Item 1 , rate =150 => Why not

Go To the Supplier 1
Create a Purchase Order
Use “Get Items from Open Material Requests” button, select the Material Request
Purchase Order
Item table :
Item 1 , rate = 150 => No, it should be 20 according Item price settings

Add Item 1 manually into the Item table the price is 20…

There is a PR ongoing, but according to your point of view, I will try do make it in another way as it seems to be not OK like that

@FHenry Is the ‘Pricing Rule’ for that specific item and specific supplier will help you? I think, pricing rule will fetch expected buying rate in the PO.

Thank you very much for your reply.

It could be one way, I didn’t check if pricing rule are executed on “Get Item from Open Material Request”.

I’ll do that, and if it’s ok, I will transfert all Item Price (for buying) to Pricing Rule

So… what’s your result?
is the pricing rule executed on “Get Item from Open Material Request” ?

Hello,

I didn’t try. I wanted to persist with my feature, but after a long debate on the PR, it wasn’t accepted by Frappe team.

So I just continue, my way with a custom app that set the buying price on the MR items on MR validation, so on Purchase order that’s the buying price set on MR validation.

Can you tell us how you do that? and what is the logic behind it?

1 Like

Hello @maulana,

Can you tell us how you do that?

With a custom app, I’ve put in hook.py

doc_events = {
"Material Request": {
         "on_submit": "myapp.material_request_price.set_default_supplier_price_validate"
    },
}

and in myapp/material_request_price.py

def set_default_buying_price(doc = None):
 # here the code that  Find all material request lines that same price list product with a default supplier that match price list buying supplier with finally something like 
 ma_line = frappe.get_doc('Material Request Item', row.ma_item_name)
 ma_line.db_set('rate', row.price_list_rate)
 ma_line.db_set('amount', row.price_list_rate * ma_line.qty)

Is it the kind of answer you request ?

1 Like