From af30c3fdfde8e0a4bfb7d207d515111de49427e2 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Mon, 23 Dec 2013 16:13:42 +0530 Subject: [PATCH] [fix] [minor] update item price on change of item details --- stock/doctype/item/item.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index 8dbfef7bac..ca2a6132d7 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -49,6 +49,7 @@ class DocType(DocListController, WebsiteGenerator): def on_update(self): self.validate_name_with_item_group() self.update_website() + self.update_item_price() def check_warehouse_is_set_for_stock_item(self): if self.doc.is_stock_item=="Yes" and not self.doc.default_warehouse: @@ -210,6 +211,11 @@ class DocType(DocListController, WebsiteGenerator): WebsiteGenerator.on_update(self) + def update_item_price(self): + webnotes.conn.sql("""update `tabItem Price` set item_name=%s, + item_description=%s where item_code=%s""", + (self.doc.item_name, self.doc.description, self.doc.name)) + def get_page_title(self): if self.doc.name==self.doc.item_name: page_name_from = self.doc.name