I was hoping someone might be able to help me; I’m new to erpnext! I’m also using a frappe hosted account so don’t have direct access to the code/database.
Copy all prices from the Standard Buying Price List to the Standard Selling Price List, with a standard margin. Maintaining multiple price lists is a high admin burden and pricing rules don’t seem to be effective to achieve what’s needed.
- Create Server Script
- Delete existing records from Selling Price List, using SQL statement
- Copy all items and prices (with standard markup) from Buying Price List, using SQL statement
- I get this error message: ‘You do not have enough permissions to access this resource. Please contact your manager to get access.’ (Note: I have added server_script_enabled to site config).
- Is there a better way to achieve what I’m trying to do?
- How can I resolve my permissions issues?
The script I’m trying to test/run is:
frappe.db.sql( """DELETE * FROM `tabItem Price` where price_list=%s""", "Standard Selling", ) frappe.db.sql( """update `tabItem Price` set price_list_rate=p.new_price, modified=NOW() where price_list="Standard Selling" AND item_code=p.item_code FROM (SELECT * FROM `tabItem Price`)p""" )