From 807e4788d5a2745d11fe7814bc92af90c32a8b9f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 14:31:14 +0530 Subject: [PATCH] fixes in patches --- patches/march_2013/p07_update_valuation_rate.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/patches/march_2013/p07_update_valuation_rate.py b/patches/march_2013/p07_update_valuation_rate.py index 885fad6a359..eaeeac1990f 100644 --- a/patches/march_2013/p07_update_valuation_rate.py +++ b/patches/march_2013/p07_update_valuation_rate.py @@ -2,13 +2,18 @@ import webnotes def execute(): webnotes.reload_doc("accounts", "doctype", "purchase_invoice_item") - + webnotes.conn.auto_commit_on_many_writes = True for purchase_invoice in webnotes.conn.sql_list("""select distinct parent from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(valuation_rate, 0)=0"""): pi = webnotes.get_obj("Purchase Invoice", purchase_invoice) - pi.calculate_taxes_and_totals() + try: + pi.calculate_taxes_and_totals() + except: + pass pi.update_raw_material_cost() pi.update_valuation_rate("entries") for item in pi.doclist.get({"parentfield": "entries"}): webnotes.conn.sql("""update `tabPurchase Invoice Item` set valuation_rate = %s where name = %s""", (item.valuation_rate, item.name)) + + webnotes.conn.auto_commit_on_many_writes = False \ No newline at end of file