diff --git a/erpnext/patches/may_2012/reload_sales_invoice_pf.py b/erpnext/patches/may_2012/reload_sales_invoice_pf.py new file mode 100644 index 00000000000..63acbedef13 --- /dev/null +++ b/erpnext/patches/may_2012/reload_sales_invoice_pf.py @@ -0,0 +1,16 @@ +def execute(): + import webnotes + import webnotes.modules + res = webnotes.conn.sql("""\ + select module, name, standard from `tabPrint Format` + where name like 'Sales Invoice%'""", as_dict=1) + for r in res: + if r.get('standard')=='Yes' and \ + r.get('name') in [ + 'Sales Invoice Classic', + 'Sales Invoice Spartan', + 'Sales Invoice Modern' + ]: + print r.get('name') + webnotes.modules.reload_doc(r.get('module'), 'Print Format', r.get('name')) + \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 444be4984bc..9da373a4c0a 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -352,4 +352,10 @@ patch_list = [ 'patch_file': 'page_role_series_fix', 'description': 'reset series of page role at max' }, + { + 'patch_module': 'patches.may_2012', + 'patch_file': 'reload_sales_invoice_pf', + 'description': 'Reload sales invoice print formats' + }, + ] diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 5413b666433..57567107799 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -83,7 +83,7 @@ class DocType(TransactionBase): if doc.fields.get('item_code'): arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'), 'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')}; - ret = obj.get_item_defaults(arg, self) + ret = obj.get_item_defaults(arg) for r in ret: if not doc.fields.get(r): doc.fields[r] = ret[r] diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index c26da90485d..9e7632748d3 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -100,7 +100,7 @@ class DocType(TransactionBase): if doc.fields.get('item_code'): arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'), 'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')}; - ret = obj.get_item_defaults(arg, self) + ret = obj.get_item_defaults(arg) for r in ret: if not doc.fields.get(r): doc.fields[r] = ret[r] diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 4e667196c3f..fa4144b8391 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -117,7 +117,7 @@ class DocType(TransactionBase): if doc.fields.get('item_code'): arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'), 'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')}; - ret = obj.get_item_defaults(arg, self) + ret = obj.get_item_defaults(arg) for r in ret: if not doc.fields.get(r): doc.fields[r] = ret[r] diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index b5d9e60e7c4..dd6588a1664 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -49,7 +49,8 @@ class DocType(TransactionBase): # get item details # ---------------- def get_item_details(self, arg): - arg, actual_qty, in_rate = eval(arg), 0, 0 + import json + arg, actual_qty, in_rate = json.loads(arg), 0, 0 item = sql("select stock_uom, description, item_name from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00' or end_of_life > now())", (arg.get('item_code')), as_dict = 1) if not item: diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py index 86a384fb749..0cb4b96c3e6 100644 --- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py +++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py @@ -97,7 +97,7 @@ class DocType: msgprint("Serial no is mandatory for item: "+ d.item_code, raise_exception = 1) # validate rejected serial nos - if fname == 'purchase_receipt_details' and d.rejected_qty and ar_required == 'Yes' and not d.rejected_serial_no: + if fname == 'purchase_receipt_details' and flt(d.rejected_qty) > 0 and ar_required == 'Yes' and not d.rejected_serial_no: msgprint("Rejected serial no is mandatory for rejected qty of item: "+ d.item_code, raise_exception = 1)