Merge pull request #1227 from akhileshdarjee/hotfix
[fix] [minor] update item price on change of item details
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index 8dbfef7..4ebf9c4 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -49,6 +49,7 @@
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 @@
WebsiteGenerator.on_update(self)
+ def update_item_price(self):
+ webnotes.conn.sql("""update `tabItem Price` set item_name=%s,
+ item_description=%s, modified=NOW() 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
diff --git a/stock/doctype/price_list/price_list.py b/stock/doctype/price_list/price_list.py
index 226b9da..d0e5d2b 100644
--- a/stock/doctype/price_list/price_list.py
+++ b/stock/doctype/price_list/price_list.py
@@ -44,5 +44,5 @@
def update_item_price(self):
webnotes.conn.sql("""update `tabItem Price` set currency=%s,
- buying_or_selling=%s where price_list=%s""",
+ buying_or_selling=%s, modified=NOW() where price_list=%s""",
(self.doc.currency, self.doc.buying_or_selling, self.doc.name))
\ No newline at end of file