diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index a39df410cc..7722c98a07 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -522,13 +522,13 @@ class DocType(BuyingController): def update_raw_material_cost(self): if self.sub_contracted_items: for d in self.doclist.get({"parentfield": "entries"}): - rm_cost = webnotes.conn.sql(""" select raw_material_cost / quantity - from `tabBOM` where item = %s and is_default = 1 and docstatus = 1 - and is_active = 1 """, (d.item_code,)) - rm_cost = rm_cost and flt(rm_cost[0][0]) or 0 - - d.conversion_factor = d.conversion_factor or webnotes.conn.get_value( - "UOM Conversion Detail", {"parent": d.item_code, "uom": d.uom}, - "conversion_factor") or 1 - - d.rm_supp_cost = rm_cost * flt(d.qty) * flt(d.conversion_factor) + rm_cost = webnotes.conn.sql(""" select raw_material_cost / quantity + from `tabBOM` where item = %s and is_default = 1 and docstatus = 1 + and is_active = 1 """, (d.item_code,)) + rm_cost = rm_cost and flt(rm_cost[0][0]) or 0 + + d.conversion_factor = d.conversion_factor or webnotes.conn.get_value( + "UOM Conversion Detail", {"parent": d.item_code, "uom": d.uom}, + "conversion_factor") or 1 + + d.rm_supp_cost = rm_cost * flt(d.qty) * flt(d.conversion_factor) \ No newline at end of file diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index 6ca804e7bc..47e3195d71 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -929,7 +929,7 @@ def send_notification(new_rv): """Notify concerned persons about recurring invoice generation""" subject = "Invoice : " + new_rv.doc.name - com = new_rv.doc.company # webnotes.conn.get_value('Control Panel', '', 'letter_head') + com = new_rv.doc.company hd = '''

%s

Invoice: %s

diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.py b/accounts/page/voucher_import_tool/voucher_import_tool.py index 0a2178acc6..6648ee6f8e 100644 --- a/accounts/page/voucher_import_tool/voucher_import_tool.py +++ b/accounts/page/voucher_import_tool/voucher_import_tool.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals import webnotes from webnotes import _ from webnotes.utils import flt, comma_and +import webnotes.defaults @webnotes.whitelist() def get_template(): @@ -35,7 +36,7 @@ def get_template(): %(columns)s ''' % { "template_type": template_type, - "user_fmt": webnotes.conn.get_value('Control Panel', None, 'date_format'), + "user_fmt": webnotes.defaults.get_global_default('date_format'), "default_company": webnotes.conn.get_default("company"), "naming_options": naming_options.replace("\n", ", "), "voucher_type": voucher_type.replace("\n", ", "), diff --git a/patches/march_2013/p02_get_global_default.py b/patches/march_2013/p02_get_global_default.py new file mode 100644 index 0000000000..33983b5c41 --- /dev/null +++ b/patches/march_2013/p02_get_global_default.py @@ -0,0 +1,11 @@ +import webnotes +import webnotes.defaults + +def execute(): + # sesison expiry missing + if not webnotes.defaults.get_global_default("session_expiry"): + gd = webnotes.bean("Global Defaults", "Global Defaults") + gd.doc.session_expiry = webnotes.conn.get_value('Control Panel', None, 'session_expiry') \ + or '06:00' + gd.save() + \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 6c7c5e01a2..d6b8f183bb 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -207,4 +207,5 @@ patch_list = [ "patches.march_2013.p01_c_form", "execute:webnotes.conn.sql('update tabDocPerm set `submit`=1, `cancel`=1, `amend`=1 where parent=\"Time Log\"')", "execute:webnotes.delete_doc('DocType', 'Attendance Control Panel')", + "patches.march_2013.p02_get_global_default", ] \ No newline at end of file diff --git a/utilities/doctype/sms_control/sms_control.py b/utilities/doctype/sms_control/sms_control.py index 653eb77e14..f4d90b8926 100644 --- a/utilities/doctype/sms_control/sms_control.py +++ b/utilities/doctype/sms_control/sms_control.py @@ -75,11 +75,11 @@ class DocType: def send_sms(self, receiver_list, msg, sender_name = ''): receiver_list = self.validate_receiver_nos(receiver_list) - arg = { 'account_name' : webnotes.conn.get_value('Control Panel',None,'account_id'), - 'receiver_list' : receiver_list, - 'message' : msg, - 'sender_name' : sender_name or self.get_sender_name() - } + arg = { + 'receiver_list' : receiver_list, + 'message' : msg, + 'sender_name' : sender_name or self.get_sender_name() + } if webnotes.conn.get_value('SMS Settings', None, 'sms_gateway_url'): ret = self.send_via_gateway(arg)