diff --git a/setup/doctype/item_price/item_price.py b/setup/doctype/item_price/item_price.py index ddde87e98a..be235de27c 100644 --- a/setup/doctype/item_price/item_price.py +++ b/setup/doctype/item_price/item_price.py @@ -13,23 +13,18 @@ class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl - def on_update(self): + def validate(self): + self.check_duplicate_item() self.update_price_list_details() self.update_item_details() - self.check_duplicate_item() def update_price_list_details(self): - self.doc.buying_or_selling = webnotes.conn.get_value("Price List", self.doc.price_list, - "buying_or_selling") - - self.doc.currency = webnotes.conn.get_value("Price List", self.doc.price_list, - "currency") + self.doc.buying_or_selling, self.doc.currency = webnotes.conn.get_value("Price List", + self.doc.price_list, ["buying_or_selling", "currency"]) def update_item_details(self): - self.doc.item_name = webnotes.conn.get_value("Item", self.doc.item_code, "item_name") - - self.doc.item_description = webnotes.conn.get_value("Item", self.doc.item_code, - "description") + self.doc.item_name, self.doc.item_description = webnotes.conn.get_value("Item", + self.doc.item_code, ["item_name", "description"]) def check_duplicate_item(self): if webnotes.conn.sql("""select name from `tabItem Price`