Hi, can someone point me towards how to enable batch wise pricing for items. Basically in Pharmaceuticals, different batches for same items have different prices.
Essentially I want that when i sell an item, it picks up prices of that particular batch and not the item price.
I’ve looked at the batchwise inventory management, but that doesn’t have prices.
I think that i have to edit the get_item_details.py file in “stock”. but i dont know how to handle pricelists, somehow link batch, and make pricelist batchwise instead of item wise.
Im trying to customise the software for batchwise pricing and im a little stuck, can anyone help me out.
I added a field in Item Price Doctype, called batch_id which is linked to Batch doctype.
I added validation in item_price.py as follows
def check_duplicates(self):
conditions = “where item_code=%(item_code)s and price_list=%(price_list)s and batch_id=%(batch_id)s and name != %(name)s”
for field in ['uom', 'valid_from',
'valid_upto', 'packing_unit', 'customer', 'supplier']:
if self.get(field):
conditions += " and {0} = %({1})s".format(field, field)
price_list_rate = frappe.db.sql("""
SELECT price_list_rate
FROM `tabItem Price`
{conditions} """.format(conditions=conditions), self.as_dict())
if price_list_rate :
frappe.throw(_("Item Price appears multiple times based on Price List, Supplier/Customer, Currency, Item, UOM, Qty and Dates."), ItemPriceDuplicateItem)
Now I am trying to edit the get_item_price function in get_item_price.py (in “stock” folder) to automatically get price based on batch number and i am unable to do so.
I think the simplest thing for you to do would be to add a custom field in the Batch DocType and plug in the Price for the Batch into this currency field. Then with some scripting, you’d be able to fetch the price automatically every time you make a Delivery Note or an Invoice cum Delivery Note.
Hi sir,
I am doing the same thing I need to fetch the Item price in the batch and i able to do that but how can i fetch the same rate in delivery note item with same batch