From 00be94860b5f30f2c15cb9c559bb7d028c0eabc4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 9 Sep 2011 13:13:06 +0530 Subject: [PATCH] some file checked out from master --- accounts/doctype/fiscal_year/fiscal_year.py | 4 ++-- patches/patch.py | 4 +++- selling/doctype/quotation/quotation.js | 9 +++++---- setup/doctype/manage_account/manage_account.py | 2 +- .../sales_browser_control/sales_browser_control.py | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/accounts/doctype/fiscal_year/fiscal_year.py b/accounts/doctype/fiscal_year/fiscal_year.py index 6b2dfdedec..48d7d91cde 100644 --- a/accounts/doctype/fiscal_year/fiscal_year.py +++ b/accounts/doctype/fiscal_year/fiscal_year.py @@ -133,8 +133,8 @@ class DocType: # build dict p = { - 'debit': flt(entry[2]) - ,'credit':flt(entry[3]) + 'debit': entry[4]=='No' and flt(entry[2]) or 0 + ,'credit': entry[4]=='No' and flt(entry[3]) or 0 ,'opening': entry[4]=='Yes' and diff or 0 # end date conditino only if it is not opening diff --git a/patches/patch.py b/patches/patch.py index 748296a887..3a297beb80 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 355 +last_patch = 356 #------------------------------------------- @@ -298,3 +298,5 @@ def execute(patch_no): reload_doc('stock', 'doctype', 'delivery_note_detail') elif patch_no == 355: sql("update `tabDocField` set print_hide =1 where fieldname in ('pack_no', 'pack_gross_wt', 'weight_uom', 'pack_nett_wt') and parent = 'Delivery Note Detail'") + elif patch_no == 356: + sql("update `tabDocField` set print_hide =1 where fieldname = 'print_packing_slip' and parent = 'Delivery Note'") diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index b3dcde681a..0732e45dc6 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -312,10 +312,11 @@ cur_frm.cscript.validate = function(doc,cdt,cdn){ //================ Last Quoted Price and Last Sold Price suggestion ====================== cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= function(doc, cdt, cdn) { var d = locals[cdt][cdn]; + var cond = (doc.order_type == 'Maintenance')? " and tabItem.is_service_item = 'Yes'" : " and tabItem.is_sales_item = 'Yes'" if(doc.customer) return repl("SELECT i.name,i.item_code,concat('Last quoted at - ',cast(quote_rate as char)) as quote_rate,concat('Last sold at - ',cast(sales_rate as char)) as sales_rate FROM\ (\ - select item_code,name from tabItem where tabItem.%(key)s like '%s'\ + select item_code,name from tabItem where tabItem.%(key)s like '%s' %(cond)s\ )i\ left join\ (\ @@ -336,7 +337,7 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= (\ select rd.item_code,max(voucher_date) as voucher_date from `tabRV Detail` rd, `tabReceivable Voucher` r where r.name=rd.parent and r.docstatus=1 and customer='%(cust)s' group by rd.item_code\ )m where r.item_code=m.item_code and r.voucher_date=m.voucher_date\ - )s on i.item_code=s.item_code ORDER BY item_code LIMIT 50",{cust:doc.customer}); + )s on i.item_code=s.item_code ORDER BY item_code LIMIT 50",{cust:doc.customer, cond:cond}); else - return "SELECT name, item_code FROM tabItem WHERE `tabItem`.%(key)s LIKE '%s' ORDER BY tabItem.item_code DESC LIMIT 50"; -} \ No newline at end of file + return repl("SELECT name, item_code FROM tabItem WHERE `tabItem`.%(key)s LIKE '%s' %(cond)s ORDER BY tabItem.item_code DESC LIMIT 50", {cond:cond}); +} diff --git a/setup/doctype/manage_account/manage_account.py b/setup/doctype/manage_account/manage_account.py index a0ed2fadd2..651794fa16 100644 --- a/setup/doctype/manage_account/manage_account.py +++ b/setup/doctype/manage_account/manage_account.py @@ -29,7 +29,7 @@ class DocType: set_default(defkey, defvalue) if defkey == 'fiscal_year': - ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", defvalue) + ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", cstr(defvalue)) ysd = ysd and ysd[0][0] or '' if ysd: set_default('year_start_date', ysd.strftime('%Y-%m-%d')) diff --git a/setup/doctype/sales_browser_control/sales_browser_control.py b/setup/doctype/sales_browser_control/sales_browser_control.py index d4c4a1316b..e9f8242450 100644 --- a/setup/doctype/sales_browser_control/sales_browser_control.py +++ b/setup/doctype/sales_browser_control/sales_browser_control.py @@ -131,7 +131,7 @@ class DocType: r = eval(args) - if r['lft'] == 0: + if r['lft'] == 0 and r['action'] != 'Create': n = sql("select lft,rgt from `tab%s` where name = '%s'"%(r['node_title'],r['nm'])) r['lft'] = n[0][0] r['rgt'] = n[0][1] @@ -212,4 +212,4 @@ class DocType: if res: msgprint("'%s' record is already exist."%(r['nm'])) return 'true' - return 'false' \ No newline at end of file + return 'false'