From 1cfab4e21d67478a4ae8ae67466069a94dbb23ff Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 11 Apr 2013 09:36:20 +0530 Subject: [PATCH 1/5] [patch] [fix] --- patches/april_2013/p05_fixes_in_reverse_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/april_2013/p05_fixes_in_reverse_modules.py b/patches/april_2013/p05_fixes_in_reverse_modules.py index 8f5b2f773ec..41e2e5ef2f9 100644 --- a/patches/april_2013/p05_fixes_in_reverse_modules.py +++ b/patches/april_2013/p05_fixes_in_reverse_modules.py @@ -4,7 +4,7 @@ import webnotes.utils def execute(): modules = webnotes.get_config().modules - ml = json.loads(webnotes.conn.get_global("hidden_modules")) + ml = json.loads(webnotes.conn.get_global("hidden_modules") or "[]") if len(ml) == len(modules.keys()): webnotes.conn.set_global("hidden_modules", json.dumps([])) \ No newline at end of file From d246de84179e395f52fb7d642ea74f8205468755 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 Apr 2013 15:31:41 +0530 Subject: [PATCH 2/5] [fixes][account][packing slip] --- accounts/doctype/account/account.py | 12 +++++++----- stock/doctype/packing_slip/packing_slip.js | 14 ++++++++++++++ stock/doctype/packing_slip/packing_slip.py | 4 +--- .../packing_slip_item/packing_slip_item.txt | 11 ++++++----- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/accounts/doctype/account/account.py b/accounts/doctype/account/account.py index 410994fed20..eb65604e026 100644 --- a/accounts/doctype/account/account.py +++ b/accounts/doctype/account/account.py @@ -69,11 +69,13 @@ class DocType: raise_exception=1) def validate_duplicate_account(self): - if (self.doc.fields.get('__islocal') or not self.doc.name) and \ - sql("""select name from tabAccount where account_name=%s and company=%s""", - (self.doc.account_name, self.doc.company)): - msgprint("Account Name: %s already exists, please rename" - % self.doc.account_name, raise_exception=1) + + if self.doc.fields.get('__islocal') or not self.doc.name: + company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr") + if sql("""select name from tabAccount where name=%s""", + (self.doc.account_name + " - " + company_abbr)): + msgprint("Account Name: %s already exists, please rename" + % self.doc.account_name, raise_exception=1) def validate_root_details(self): #does not exists parent diff --git a/stock/doctype/packing_slip/packing_slip.js b/stock/doctype/packing_slip/packing_slip.js index 4c20289af9b..5ece164c688 100644 --- a/stock/doctype/packing_slip/packing_slip.js +++ b/stock/doctype/packing_slip/packing_slip.js @@ -138,3 +138,17 @@ cur_frm.cscript.calc_net_total_pkg = function(doc, ps_detail) { refresh_many(['net_weight_pkg', 'net_weight_uom', 'gross_weight_uom', 'gross_weight_pkg']); } +var make_row = function(title,val,bold){ + var bstart = ''; var bend = ''; + return ''+(bold?bstart:'')+title+(bold?bend:'')+'' + +''+ val +'' + +'' +} + +cur_frm.pformat.net_weight_pkg= function(doc){ + return '' + make_row('Net Weight', doc.net_weight_pkg) + '
' +} + +cur_frm.pformat.gross_weight_pkg= function(doc){ + return '' + make_row('Gross Weight', doc.gross_weight_pkg) + '
' +} \ No newline at end of file diff --git a/stock/doctype/packing_slip/packing_slip.py b/stock/doctype/packing_slip/packing_slip.py index fb2fd533923..161c9bd911e 100644 --- a/stock/doctype/packing_slip/packing_slip.py +++ b/stock/doctype/packing_slip/packing_slip.py @@ -94,12 +94,10 @@ class DocType: * Item Quantity dict of current packing slip doc * No. of Cases of this packing slip """ - item_codes = ", ".join([('"' + d.item_code + '"') for d in - self.doclist]) items = [d.item_code for d in self.doclist.get({"parentfield": "item_details"})] - if not item_codes: webnotes.msgprint("No Items to Pack", + if not items: webnotes.msgprint("No Items to Pack", raise_exception=1) # gets item code, qty per item code, latest packed qty per item code and stock uom diff --git a/stock/doctype/packing_slip_item/packing_slip_item.txt b/stock/doctype/packing_slip_item/packing_slip_item.txt index a9d2fdf2fa2..b186f40c5fb 100644 --- a/stock/doctype/packing_slip_item/packing_slip_item.txt +++ b/stock/doctype/packing_slip_item/packing_slip_item.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-07 11:42:59", + "creation": "2013-04-08 13:10:16", "docstatus": 0, - "modified": "2013-04-05 16:06:40", + "modified": "2013-04-11 15:06:05", "modified_by": "Administrator", "owner": "Administrator" }, @@ -70,7 +70,7 @@ "fieldtype": "Float", "label": "Net Weight", "print_width": "100px", - "read_only": 1, + "read_only": 0, "width": "100px" }, { @@ -80,7 +80,7 @@ "label": "Weight UOM", "options": "UOM", "print_width": "100px", - "read_only": 1, + "read_only": 0, "width": "100px" }, { @@ -95,6 +95,7 @@ "fieldname": "dn_detail", "fieldtype": "Data", "hidden": 1, - "label": "DN Detail" + "label": "DN Detail", + "read_only": 0 } ] \ No newline at end of file From 4147f026594272622917d307b54e291f56cf9eab Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 Apr 2013 16:02:06 +0530 Subject: [PATCH 3/5] fixe sin patch --- patches/march_2013/p08_create_aii_accounts.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/march_2013/p08_create_aii_accounts.py b/patches/march_2013/p08_create_aii_accounts.py index ac563b52fae..00230d8c666 100644 --- a/patches/march_2013/p08_create_aii_accounts.py +++ b/patches/march_2013/p08_create_aii_accounts.py @@ -61,7 +61,8 @@ def add_accounts(accounts_to_add, check_fn=None): continue for account_name, parent_account_name, group_or_ledger, account_type in accounts_to_add: - if not webnotes.conn.exists("Account", "%s - %s" % (account_name, abbr)): + if not webnotes.conn.sql("""select name from `tabAccount` where account_name = %s + and company = %s""", (account_name, company)): parent_account = "%s - %s" % (parent_account_name, abbr) if check_fn: parent_account = check_fn(parent_account, company) @@ -77,7 +78,8 @@ def add_accounts(accounts_to_add, check_fn=None): def add_aii_cost_center(): for company, abbr in webnotes.conn.sql("""select name, abbr from `tabCompany`"""): - if not webnotes.conn.exists("Cost Center", "Auto Inventory Accounting - %s" % abbr): + if not webnotes.conn.sql("""select name from `tabCost Center` where cost_center_name = + 'Auto Inventory Accounting' and company_name = %s""", company): parent_cost_center = webnotes.conn.get_value("Cost Center", {"parent_cost_center['']": '', "company_name": company}) From bab018b759106e611de67b96bda16c2391036e78 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 Apr 2013 16:36:26 +0530 Subject: [PATCH 4/5] fixes in item --- stock/doctype/item/item.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index 55a0ae75ab5..2b2dbfe815e 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -239,8 +239,8 @@ class DocType(DocListController): vals = webnotes.conn.get_value("Item", self.doc.name, ["has_serial_no", "is_stock_item", "valuation_method"], as_dict=True) - if vals and (vals.has_serial_no != self.doc.has_serial_no or - vals.is_stock_item != self.doc.is_stock_item or + if vals and ((self.doc.is_stock_item == "No" and vals.is_stock_item == "Yes") or + vals.has_serial_no != self.doc.has_serial_no or vals.valuation_method != self.doc.valuation_method): if self.check_if_sle_exists(): webnotes.msgprint(_("As there are existing stock transactions for this \ From 6ce8af3b6734edb092e7726294cc14b8d050c8ac Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 Apr 2013 16:57:01 +0530 Subject: [PATCH 5/5] item search by item_name by default --- public/js/queries.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/public/js/queries.js b/public/js/queries.js index e15e6867b4a..9809cd980d0 100644 --- a/public/js/queries.js +++ b/public/js/queries.js @@ -133,10 +133,8 @@ erpnext.queries.item = function(opts) { WHERE tabItem.docstatus!=2 \ AND (ifnull(`tabItem`.`end_of_life`,"") in ("", "0000-00-00") \ OR `tabItem`.`end_of_life` > NOW()) \ - AND tabItem.%(key)s LIKE "%s" ' + (conditions - ? (" AND " + conditions.join(" AND ")) - : "") - + " LIMIT 50" + AND (tabItem.%(key)s LIKE \"%s\" OR tabItem.item_name LIKE \"%%%s\")' + + (conditions ? (" AND " + conditions.join(" AND ")) : "") + " LIMIT 50" } erpnext.queries.item_std = function() {