From e31ed38843cb2c1e80a870f4a3c8f148ff6c6812 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 15 Sep 2011 14:40:04 +0530 Subject: [PATCH 01/30] opening balance fixes in general ledger --- .../general_ledger/general_ledger.py | 64 ++++++++++++------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/accounts/search_criteria/general_ledger/general_ledger.py b/accounts/search_criteria/general_ledger/general_ledger.py index 6cba6e44bc..8c855cfa52 100644 --- a/accounts/search_criteria/general_ledger/general_ledger.py +++ b/accounts/search_criteria/general_ledger/general_ledger.py @@ -1,9 +1,11 @@ #get company letter head +#--------------------------------------------------------------------- l_head = sql("select content from `tabLetter Head` where ifnull(is_default, 0) = 1 and ifnull(disabled, 0) = 0") l_head = l_head and l_head[0][0] or '' + # Posting date, fiscal year and year start date -#----------------------------------------------- +#--------------------------------------------------------------------- if not filter_values.get('posting_date') or not filter_values.get('posting_date1'): msgprint("Please enter From Date and To Date") raise Exception @@ -11,11 +13,16 @@ else: from_date = filter_values['posting_date'] to_date = filter_values['posting_date1'] -from_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",from_date)[0][0] +from_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",from_date) +if not from_date_year: + msgprint("From Date is out of range. Please check.", raise_exception=1) +else: + from_date_year = from_date_year[0][0] #to_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",to_date)[0][0] + # define columns -#--------------- +#--------------------------------------------------------------------- col = [] col.append(['Date','Date','80px','']) col.append(['Detail','Text','475px','']) @@ -30,9 +37,9 @@ for c in col: col_idx[c[0]] = len(colnames) -total_debit, total_credit, total_opening, total_diff = 0,0,0,0 - #total query +#--------------------------------------------------------------------- +total_debit, total_credit, total_opening, total_diff = 0,0,0,0 q = query.split('WHERE')[1].split('LIMIT') if len(q) > 2: query_where_clause = 'LIMIT'.join(q[:-1]) @@ -47,27 +54,32 @@ for t in tot: total_diff = total_debit - total_credit -# opening -account = filter_values.get('account') -if not account: - msgprint('Select an account to proceed',raise_exception=0,small=1) - - -acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account) - -opening_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, from_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2] -closing_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, to_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2] -if acc_det[0][0] == 'Credit': - closing_bal = -1*closing_bal - opening_bal = -1*opening_bal - out = [] -t_row = ['' for i in range(len(colnames))] -t_row[1] = 'Opening as on '+formatdate(from_date) -t_row[col_idx['Debit']-1] = opening_bal -out.append(t_row) +# If account mentioned, show opening and closing +#--------------------------------------------------------------------- +account = filter_values.get('account') + +if account and (total_debit != 0 or total_credit != 0): + acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account) + + opening_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, add_days(from_date, -1), acc_det[0][0], acc_det[0][2], acc_det[0][3])[2] + closing_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, to_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2] + + if acc_det[0][0] == 'Credit': + closing_bal = -1*closing_bal + opening_bal = -1*opening_bal + + # add opening row + t_row = ['' for i in range(len(colnames))] + t_row[1] = 'Opening as on '+formatdate(from_date) + t_row[col_idx['Debit']-1] = opening_bal + out.append(t_row) + + +# table output +#--------------------------------------------------------------------- count = 0 for r in res: count +=1 @@ -79,6 +91,9 @@ for r in res: r[1] = a out.append(r) + +# Total, Difference and closing balance +#--------------------------------------------------------------------- if total_debit != 0 or total_credit != 0: # Total debit/credit t_row = ['' for i in range(len(colnames))] @@ -87,7 +102,6 @@ if total_debit != 0 or total_credit != 0: t_row[col_idx['Credit']-1] = total_credit out.append(t_row) - # diffrence (dr-cr) t_row = ['' for i in range(len(colnames))] t_row[1] = 'Total(Dr-Cr)' @@ -101,7 +115,9 @@ if total_debit != 0 or total_credit != 0: t_row[col_idx['Debit']-1] = flt(closing_bal) out.append(t_row) + # Print Format +#--------------------------------------------------------------------- myheader = """
"""+l_head+"""
From c526a8db47d13bf1ec28b96670e33cbaca6faeec Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 15 Sep 2011 15:38:57 +0530 Subject: [PATCH 02/30] check serial nos bin qty only if serial no entered into the document --- stock/doctype/bin/bin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stock/doctype/bin/bin.py b/stock/doctype/bin/bin.py index 65b86867b6..3b71bd0034 100644 --- a/stock/doctype/bin/bin.py +++ b/stock/doctype/bin/bin.py @@ -40,7 +40,7 @@ class DocType: # update valuation for post dated entry - if actual_qty: + if actual_qty and serial_no: # check actual qty with total number of serial no self.check_qty_with_serial_no() From 11b2c0305c6c433e22c4e6fc91b7a4594cf2ab8d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 15 Sep 2011 18:27:37 +0530 Subject: [PATCH 03/30] trend analyzer issue fixed --- analysis/search_criteria/trend_analyzer/trend_analyzer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/analysis/search_criteria/trend_analyzer/trend_analyzer.js b/analysis/search_criteria/trend_analyzer/trend_analyzer.js index 72334df1b4..9a87abbd11 100644 --- a/analysis/search_criteria/trend_analyzer/trend_analyzer.js +++ b/analysis/search_criteria/trend_analyzer/trend_analyzer.js @@ -13,8 +13,8 @@ report.customize_filters = function() { this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Profile'}); - this.set_filter_properties('Profile','Fiscal Year',{filter_hide:0, in_first_page:1, report_default: sys_defaults.fiscal_year}); - this.get_filter('Profile', 'Fiscal Year').set_as_single(); + this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile', in_first_page:1}); + // Add Filters this.add_filter({fieldname:'item', label:'Item', fieldtype:'Link', options:'Item', ignore : 1, parent:'Profile'}); @@ -118,4 +118,4 @@ report.get_query = function() { return q; } -} \ No newline at end of file +} From 0ad3235c1fc56c96af3602c494f82dcbccdde7f0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 16 Sep 2011 11:28:56 +0530 Subject: [PATCH 04/30] removed make_feed() function --- home/doctype/widget_control/widget_control.py | 9 --------- hr/doctype/it_checklist/it_checklist.py | 6 ------ selling/doctype/enquiry/enquiry.py | 8 -------- 3 files changed, 23 deletions(-) diff --git a/home/doctype/widget_control/widget_control.py b/home/doctype/widget_control/widget_control.py index fa41cc9db2..d6bb9d1c45 100644 --- a/home/doctype/widget_control/widget_control.py +++ b/home/doctype/widget_control/widget_control.py @@ -27,11 +27,6 @@ class DocType: cmt.comment_date = nowdate() cmt.comment_time = time.strftime('%H:%M') cmt.save(1) - - try: - get_obj('Feed Control').upate_comment_in_feed(args['comment_doctype'], args['comment_docname']) - except: - pass else: raise Exception @@ -39,7 +34,3 @@ class DocType: def remove_comment(self, args): args = json.loads(args) sql("delete from `tabComment Widget Record` where name=%s",args['id']) - - try: - get_obj('Feed Control').upate_comment_in_feed(args['dt'], args['dn']) - except: pass diff --git a/hr/doctype/it_checklist/it_checklist.py b/hr/doctype/it_checklist/it_checklist.py index abed301573..182e171746 100644 --- a/hr/doctype/it_checklist/it_checklist.py +++ b/hr/doctype/it_checklist/it_checklist.py @@ -411,9 +411,3 @@ class DocType: new_tot_income = cint(self.doc.tax_tot_income) + cint(self.doc.edu_cess) - (cint(ret_income_tax[0][0]) or 0) self.doc.tax_per_month = new_tot_income/cint(self.doc.rem_months) - - # on update - def on_update(self): - obj = get_obj('Feed Control', 'Feed Control') - - obj.make_feed(self.doc) \ No newline at end of file diff --git a/selling/doctype/enquiry/enquiry.py b/selling/doctype/enquiry/enquiry.py index 12597022bd..4ad1b0ac30 100644 --- a/selling/doctype/enquiry/enquiry.py +++ b/selling/doctype/enquiry/enquiry.py @@ -115,12 +115,6 @@ class DocType(TransactionBase): ch = addchild(ev, 'event_individuals', 'Event User', 0) ch.person = d ch.save(1) - - #user_list = ['Sales Manager', 'Sales User'] - #for d in user_list: - # ch = addchild(ev, 'event_individuals', 'Event User', 0) - # ch.person = d - # ch.save() #--------------Validation For Last Contact Date----------------- # ==================================================================================================================== @@ -171,8 +165,6 @@ class DocType(TransactionBase): raise Exception else: set(self.doc, 'status', 'Cancelled') - - get_obj('Feed Control').make_feed(self.doc, 'cancelled') # declare as enquiry lost #--------------------------- From 7c96a101768c0cebdbbc1d1fefca50590e943b06 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 16 Sep 2011 12:48:31 +0530 Subject: [PATCH 05/30] Error fixed in bin --- stock/doctype/bin/bin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stock/doctype/bin/bin.py b/stock/doctype/bin/bin.py index 3b71bd0034..cf9509a332 100644 --- a/stock/doctype/bin/bin.py +++ b/stock/doctype/bin/bin.py @@ -40,9 +40,10 @@ class DocType: # update valuation for post dated entry - if actual_qty and serial_no: + if actual_qty: # check actual qty with total number of serial no - self.check_qty_with_serial_no() + if serial_no: + self.check_qty_with_serial_no() prev_sle = self.get_prev_sle(dt, posting_time, sle_id) cqty = flt(prev_sle.get('bin_aqat', 0)) From 4f2bd45ec10dee76f9fa0b6eb94610d2c32d0458 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 16 Sep 2011 13:28:01 +0530 Subject: [PATCH 06/30] update valuation and bin_aqat patch --- patches/patch.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index ca289f1672..e930c2e05e 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 365 +last_patch = 366 #------------------------------------------- @@ -340,3 +340,9 @@ def execute(patch_no): elif patch_no == 365: from patches.delivery_billing_status_patch import run_patch run_patch() + elif patch_no == 366: + bin = sql("select name from tabBin") + for b in bin: + bobj = get_obj('Bin',b[0]) + prev_sle = bobj.get_prev_sle(posting_date = '2011-09-15', posting_time = '01:00') + bobj.update_item_valuation(posting_date = '2011-09-15', posting_time = '01:00', prev_sle = prev_sle) From d0da2c22109353a08bbf78cfa138229e4f191579 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 16 Sep 2011 17:32:16 +0530 Subject: [PATCH 07/30] contact address will be fetched in sales invoice onload when come through mapper --- accounts/doctype/receivable_voucher/receivable_voucher.js | 2 +- accounts/doctype/receivable_voucher/receivable_voucher.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/accounts/doctype/receivable_voucher/receivable_voucher.js b/accounts/doctype/receivable_voucher/receivable_voucher.js index e773a95fc8..14a53c416b 100644 --- a/accounts/doctype/receivable_voucher/receivable_voucher.js +++ b/accounts/doctype/receivable_voucher/receivable_voucher.js @@ -33,7 +33,7 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) { 'load_default_accounts','', function(r,rt) { refresh_field('entries'); - refresh_field('debit_to'); + cur_frm.cscript.customer(doc,dt,dn); } ); } diff --git a/accounts/doctype/receivable_voucher/receivable_voucher.py b/accounts/doctype/receivable_voucher/receivable_voucher.py index f26374a382..dba08fe8b9 100644 --- a/accounts/doctype/receivable_voucher/receivable_voucher.py +++ b/accounts/doctype/receivable_voucher/receivable_voucher.py @@ -139,7 +139,6 @@ class DocType(TransactionBase): Loads default accounts from items, customer when called from mapper """ self.get_income_account('entries') - self.doc.debit_to = self.get_customer_account() def get_income_account(self,doctype): for d in getlist(self.doclist, doctype): From fb34564238022b9c129e3d16e4b4f0de4e7a2c2a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Sep 2011 12:20:10 +0530 Subject: [PATCH 08/30] update valuation and bin_aqat patch applicable after 01-09-2009 entries --- patches/patch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index e930c2e05e..788803717e 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 366 +last_patch = 367 #------------------------------------------- @@ -340,9 +340,9 @@ def execute(patch_no): elif patch_no == 365: from patches.delivery_billing_status_patch import run_patch run_patch() - elif patch_no == 366: + elif patch_no == 367: bin = sql("select name from tabBin") for b in bin: bobj = get_obj('Bin',b[0]) - prev_sle = bobj.get_prev_sle(posting_date = '2011-09-15', posting_time = '01:00') - bobj.update_item_valuation(posting_date = '2011-09-15', posting_time = '01:00', prev_sle = prev_sle) + prev_sle = bobj.get_prev_sle(posting_date = '2011-09-01', posting_time = '01:00') + bobj.update_item_valuation(posting_date = '2011-09-01', posting_time = '01:00', prev_sle = prev_sle) From eb89d28a3bac4a43291eea45318243155462a81d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Sep 2011 15:24:03 +0530 Subject: [PATCH 09/30] fixed issue in reseting in opening balance, clear bal only that company --- accounts/doctype/fiscal_year/fiscal_year.py | 32 +++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/accounts/doctype/fiscal_year/fiscal_year.py b/accounts/doctype/fiscal_year/fiscal_year.py index 48d7d91cde..74b90ccbb6 100644 --- a/accounts/doctype/fiscal_year/fiscal_year.py +++ b/accounts/doctype/fiscal_year/fiscal_year.py @@ -21,34 +21,32 @@ class DocType: def __init__(self, d, dl): self.doc, self.doclist = d,dl - def repost(self, account = ''): + def repost(self): if not self.doc.company: msgprint("Please select company", raise_exception=1) if not in_transaction: sql("start transaction") - self.clear_account_balances(account) - self.create_account_balances(account) - self.update_opening(account) - self.post_entries(account) + self.clear_account_balances() + self.create_account_balances() + self.update_opening() + self.post_entries() sql("commit") - msg_cond = account and " and account: " + account or "" - msgprint("Account balance reposted for fiscal year: " + self.doc.name + msg_cond) + msgprint("Account balance reposted for fiscal year: " + self.doc.name) - def clear_account_balances(self, account = ''): + def clear_account_balances(self): # balances clear - `tabAccount Balance` for fiscal year - cond = account and (" and account = '" + account + "'") or '' - sql("update `tabAccount Balance` set opening=0, balance=0, debit=0, credit=0 where fiscal_year=%s %s", (self.doc.name, cond)) + sql("update `tabAccount Balance` t1, tabAccount t2 set t1.opening=0, t1.balance=0, t1.debit=0, t1.credit=0 where t1.fiscal_year=%s and t2.company = %s and t1.account = t2.name", (self.doc.name, self.doc.company)) - def create_account_balances(self, account = ''): + def create_account_balances(self): # get periods period_list = self.get_period_list() cnt = 0 # get accounts - al = account and [[account]] or sql("select name from tabAccount") + al = sql("select name from tabAccount") for a in al: # check @@ -83,14 +81,13 @@ class DocType: return periods # ==================================================================================== - def update_opening(self, account = ''): + def update_opening(self): """ set opening from last year closing """ - cond = account and (" and t2.name = '" + account + "'") or '' - abl = sql("select t1.account, t1.balance from `tabAccount Balance` t1, tabAccount t2 where t1.period= '%s' and t2.company= '%s' and ifnull(t2.is_pl_account, 'No') = 'No' and t1.account = t2.name %s for update" % (self.doc.past_year, self.doc.company, cond)) + abl = sql("select t1.account, t1.balance from `tabAccount Balance` t1, tabAccount t2 where t1.period= '%s' and t2.company= '%s' and ifnull(t2.is_pl_account, 'No') = 'No' and t1.account = t2.name for update" % (self.doc.past_year, self.doc.company)) cnt = 0 for ab in abl: @@ -108,11 +105,10 @@ class DocType: return sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", account)[0] # ==================================================================================== - def post_entries(self, account = ''): + def post_entries(self): sql("LOCK TABLE `tabGL Entry` WRITE") - cond = account and (" and account = '" + account + "'") or '' # post each gl entry (batch or complete) - gle = sql("select name, account, debit, credit, is_opening, posting_date from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled,'No')='No' and company=%s %s", (self.doc.name, self.doc.company, cond)) + gle = sql("select name, account, debit, credit, is_opening, posting_date from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled,'No')='No' and company=%s", (self.doc.name, self.doc.company)) account_details = {} cnt = 0 From 29f998ff21770f8789a3becd5e3798bfd2ee71ec Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Sep 2011 15:25:02 +0530 Subject: [PATCH 10/30] Dont add opening entries in account balance debit, credit column --- accounts/doctype/gl_entry/gl_entry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/gl_entry/gl_entry.py b/accounts/doctype/gl_entry/gl_entry.py index 5d3976056c..c45e1625ac 100644 --- a/accounts/doctype/gl_entry/gl_entry.py +++ b/accounts/doctype/gl_entry/gl_entry.py @@ -146,8 +146,8 @@ class DocType: # build dict p = { - 'debit': flt(debit) - ,'credit':flt(credit) + 'debit': self.doc.is_opening=='No' and flt(debit) or 0 + ,'credit':self.doc.is_opening=='No' and flt(credit) or 0 ,'opening': self.doc.is_opening=='Yes' and amt or 0 # end date condition only if it is not opening ,'end_date_condition':(self.doc.is_opening!='Yes' and ("and ab.end_date >= '"+self.doc.posting_date+"'") or '') From cc9428019a4cc1c2e46be93da93830d055e469b0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Sep 2011 15:26:22 +0530 Subject: [PATCH 11/30] Trial balance opening issue fixed if there is no prev year Opening and Closing splitted into 4 cols as per international standard --- .../trial_balance/trial_balance.py | 88 +++++++++++-------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/accounts/search_criteria/trial_balance/trial_balance.py b/accounts/search_criteria/trial_balance/trial_balance.py index fb168e57af..994a5b8baa 100644 --- a/accounts/search_criteria/trial_balance/trial_balance.py +++ b/accounts/search_criteria/trial_balance/trial_balance.py @@ -1,13 +1,13 @@ # Columns #---------- -cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Is PL Account', 'Data', '100px'], ['Opening','Data', '100px'],['Debit', 'Data', '100px'],['Credit', 'Data', '100px'],['Closing', 'Data', '100px']] +cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Is PL Account', 'Data', '100px'], ['Opening (Dr)','Data', '100px'], ['Opening (Cr)','Data', '100px'],['Debit', 'Data', '100px'],['Credit', 'Data', '100px'],['Closing (Dr)', 'Data', '100px'],['Closing (Cr)', 'Data', '100px']] for c in cl: colnames.append(c[0]) coltypes.append(c[1]) colwidths.append(c[2]) coloptions.append('') col_idx[c[0]] = len(colnames)-1 - + # transaction date # ------------------ if not filter_values.get('transaction_date') or not filter_values.get('transaction_date1'): @@ -23,7 +23,7 @@ if not sql("select name from `tabFiscal Year` where %s between year_start_date a msgprint("From Date and To Date must be within same year") raise Exception -# get year of the from date and to date +# get year of the from date and to date # -------------------------------------- from_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",add_days(from_date, -1)) from_date_year = from_date_year and from_date_year[0][0] or '' @@ -33,11 +33,17 @@ to_date_year = to_date_year and to_date_year[0][0] or '' # if output is more than 500 lines then it will ask to export # ------------------------------------------------------------ -if len(res) > 500 and from_export == 0: +if len(res) > 1000 and from_export == 0: msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet") raise Exception + -total_debit, total_credit = 0,0 +acc_dict = {} +for t in sql("select name, debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where docstatus != 2 and company = %s", filter_values['company']): + acc_dict[t[0]] = [t[1], t[2], t[3], t[4], t[5]] + + +total_debit, total_credit, total_opening_dr, total_opening_cr, total_closing_dr, total_closing_cr = 0, 0, 0, 0, 0, 0 glc = get_obj('GL Control') # Main logic @@ -45,47 +51,55 @@ glc = get_obj('GL Control') for r in res: # Fetch account details acc = r[col_idx['Account']].strip() - acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc) - r.append(acc_det[0][0]) - r.append(acc_det[0][4]) - r.append(acc_det[0][1]) + r.append(acc_dict[acc][0]) + r.append(acc_dict[acc][4]) + r.append(acc_dict[acc][1]) #if shows group and ledger both but without group balance - if filter_values.get('show_group_ledger') == 'Both But Without Group Balance' and acc_det[0][4] == 'Group': + if filter_values.get('show_group_ledger') == 'Both But Without Group Balance' and acc_dict[acc][4] == 'Group': for i in range(4): r.append('') continue - # opening balance - if from_date_year: - debit_on_fromdate, credit_on_fromdate, opening = glc.get_as_on_balance(acc, from_date_year, add_days(from_date, -1), acc_det[0][0], acc_det[0][2], acc_det[0][3]) - else: # if there is no previous year in system - debit_on_fromdate, credit_on_fromdate, opening = 0, 0, 0 + # Opening Balance + #----------------------------- + if from_date_year == to_date_year: + debit_on_fromdate, credit_on_fromdate, opening = glc.get_as_on_balance(acc, from_date_year, add_days(from_date, -1), acc_dict[acc][0], acc_dict[acc][2], acc_dict[acc][3]) # opening = closing of prev_date + elif acc_dict[acc][1] == 'No': # if there is no previous year in system and not pl account + opening = sql("select opening from `tabAccount Balance` where account = %s and period = %s", (acc, to_date_year)) + debit_on_fromdate, credit_on_fromdate, opening = 0, 0, flt(opening[0][0]) + else: # if pl account and there is no previous year in system + debit_on_fromdate, credit_on_fromdate, opening = 0,0,0 # closing balance - debit_on_todate, credit_on_todate, closing = glc.get_as_on_balance(acc, to_date_year, to_date, acc_det[0][0], acc_det[0][2], acc_det[0][3]) + #-------------------------------- + debit_on_todate, credit_on_todate, closing = glc.get_as_on_balance(acc, to_date_year, to_date, acc_dict[acc][0], acc_dict[acc][2], acc_dict[acc][3]) # transaction betn the period - if from_date_year == to_date_year: - debit = flt(debit_on_todate) - flt(debit_on_fromdate) - credit = flt(credit_on_todate) - flt(credit_on_fromdate) - else: # if from date is start date of the year - debit = flt(debit_on_todate) - credit = flt(credit_on_todate) - + #---------------------------------------- + + debit = flt(debit_on_todate) - flt(debit_on_fromdate) + credit = flt(credit_on_todate) - flt(credit_on_fromdate) + + # Debit / Credit + if acc_dict[acc][0] == 'Credit': + opening, closing = -1*opening, -1*closing + + # Totals + total_opening_dr += opening>0 and flt(opening) or 0 + total_opening_cr += opening<0 and -1*flt(opening) or 0 total_debit += debit total_credit += credit - - if acc_det[0][1] == 'Yes' and from_date_year != to_date_year: - opening = 0 - - if acc_det[0][0] == 'Credit': - opening, closing = -1*opening, -1*closing + total_closing_dr += closing>0 and flt(closing) or 0 + total_closing_cr += closing<0 and -1*flt(closing) or 0 - r.append(flt(opening)) + # Append in rows + r.append(flt(opening>0 and opening or 0)) + r.append(flt(opening<0 and -opening or 0)) r.append(flt(debit)) r.append(flt(credit)) - r.append(flt(closing)) + r.append(flt(closing>0 and closing or 0)) + r.append(flt(closing<0 and -closing or 0)) out =[] @@ -94,14 +108,18 @@ for r in res: # ------------------------------------------------------------------ if filter_values.get('show_zero_balance') != 'No': out.append(r) - elif r[col_idx['Opening']] or r[col_idx['Debit']] or r[col_idx['Credit']] or r[col_idx['Closing']] or (r[col_idx['Group/Ledger']] == 'Group' and filter_values.get('show_group_ledger') == 'Both But Without Group Balance'): + elif r[col_idx['Opening (Dr)']] or r[col_idx['Opening (Cr)']] or r[col_idx['Debit']] or r[col_idx['Credit']] or r[col_idx['Closing (Dr)']] or r[col_idx['Closing (Cr)']] or (r[col_idx['Group/Ledger']] == 'Group' and filter_values.get('show_group_ledger') == 'Both But Without Group Balance'): out.append(r) - + # Total Debit / Credit # -------------------------- if filter_values.get('show_group_ledger') in ['Only Ledgers', 'Both But Without Group Balance']: t_row = ['' for i in range(len(colnames))] t_row[col_idx['Account']] = 'Total' - t_row[col_idx['Debit']] = total_debit - t_row[col_idx['Credit']] = total_credit + t_row[col_idx['Opening (Dr)']] = '%.2f' % total_opening_dr + t_row[col_idx['Opening (Cr)']] = '%.2f' % total_opening_cr + t_row[col_idx['Debit']] = '%.2f' % total_debit + t_row[col_idx['Credit']] = '%.2f' % total_credit + t_row[col_idx['Closing (Dr)']] = '%.2f' % total_closing_dr + t_row[col_idx['Closing (Cr)']] = '%.2f' % total_closing_cr out.append(t_row) From 89b98ebca9ee1dc5c8dee57a324c90b8c0e73310 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Sep 2011 17:37:21 +0530 Subject: [PATCH 12/30] rebuild all tree through push_patch --- patches/patch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index 788803717e..cfeddeb427 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 367 +last_patch = 368 #------------------------------------------- @@ -346,3 +346,12 @@ def execute(patch_no): bobj = get_obj('Bin',b[0]) prev_sle = bobj.get_prev_sle(posting_date = '2011-09-01', posting_time = '01:00') bobj.update_item_valuation(posting_date = '2011-09-01', posting_time = '01:00', prev_sle = prev_sle) + elif patch_no == 368: + from webnotes.utils import nestedset + t = [ + ['Account', 'parent_account'], ['Cost Center', 'parent_cost_center'], + ['Item Group', 'parent_item_group'], ['Territory', 'parent_territory'], + ['Customer Group', 'parent_customer_group'], ['Sales Person', 'parent_sales_person'] + ] + for d in t: + nestedset.rebuild_tree(d[0], d[1]) From 8bc34d87acd969ba79e7f01260266535240a2fe8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 22 Sep 2011 11:09:02 +0530 Subject: [PATCH 13/30] Appraisal score allowed to be fraction --- hr/doctype/appraisal/appraisal.js | 237 ++++++++-------- hr/doctype/appraisal/appraisal.py | 255 +++++++++--------- hr/doctype/appraisal/appraisal.txt | 40 +-- .../appraisal_detail/appraisal_detail.txt | 19 +- patches/patch.py | 5 +- 5 files changed, 268 insertions(+), 288 deletions(-) diff --git a/hr/doctype/appraisal/appraisal.js b/hr/doctype/appraisal/appraisal.js index ed53141957..b2683d82de 100644 --- a/hr/doctype/appraisal/appraisal.js +++ b/hr/doctype/appraisal/appraisal.js @@ -1,145 +1,150 @@ cur_frm.add_fetch('employee', 'company', 'company'); cur_frm.cscript.onload = function(doc,cdt,cdn){ - if(!doc.status) set_multiple(dt,dn,{status:'Draft'}); - if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn); - if(doc.amended_from && doc.__islocal) cur_frm.cscript.refresh_appraisal_details(doc, cdt, cdn); + if(!doc.status) set_multiple(dt,dn,{status:'Draft'}); + if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn); + if(doc.amended_from && doc.__islocal) cur_frm.cscript.refresh_appraisal_details(doc, cdt, cdn); } cur_frm.cscript.refresh = function(doc,cdt,cdn){ - if(user == doc.kra_approver && doc.status == 'Submitted') unhide_field(['Update', 'Declare Completed', 'Calculate Total Score']); - else hide_field(['Update', 'Declare Completed', 'Calculate Total Score']); - - if(!doc.docstatus) unhide_field('Fetch Template'); - else hide_field('Fetch Template'); + if(user == doc.kra_approver && doc.status == 'Submitted') unhide_field(['Update', 'Declare Completed', 'Calculate Total Score']); + else hide_field(['Update', 'Declare Completed', 'Calculate Total Score']); + + if(!doc.docstatus) unhide_field('Fetch Template'); + else hide_field('Fetch Template'); } cur_frm.cscript.refresh_appraisal_details = function(doc, cdt, cdn){ - var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype); - for(var i = 0; iYou wont be able to do any changes after declaring this Appraisal as completed. Are you sure, you want to declare it as completed ?'], - ['HTML', 'Response', '
'], - ['HTML', 'Declare Completed', '
'] - ]); - - var declare_completed_btn1 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button'); - declare_completed_btn1.innerHTML = 'Yes'; - declare_completed_btn1.onclick = function(){ declare_completed_dialog.add(); } - - var declare_completed_btn2 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button'); - declare_completed_btn2.innerHTML = 'No'; - $y(declare_completed_btn2,{marginLeft:'4px'}); - declare_completed_btn2.onclick = function(){ declare_completed_dialog.hide();} - - declare_completed_dialog.onshow = function() { - $i('declare_completed_dialog_response').innerHTML = ''; - } - - declare_completed_dialog.refresh_dt = function(){ - cur_frm.cscript.refresh(this.doc, this.cdt, this.cdn); - msgprint("refersh done"); - $c('webnotes.widgets.form.form_header.refresh_labels',this.doc,function(r,rt){}); - } - - declare_completed_dialog.add = function() { - // sending... - $i('declare_completed_dialog_response').innerHTML = 'Processing...'; - var m_arg = user+ '~~' + this.msg_nm_lst; - - $c_obj(make_doclist(this.doc.doctype, this.doc.name),'declare_completed','', function(r,rt){ - - if(r.message.status == 'Completed'){ - $i('declare_completed_dialog_response').innerHTML = 'Done'; - refresh_field('status'); - declare_completed_dialog.refresh_dt(); - hide_field(['Update', 'Declare Completed', 'Calculate Total Score']); - declare_completed_dialog.hide(); - } - else if(r.message.status == 'Incomplete'){ - $i('declare_completed_dialog_response').innerHTML = 'Incomplete Appraisal'; - } - else if(r.message.status == 'No Score'){ - $i('declare_completed_dialog_response').innerHTML = 'Calculate total score'; - } - }); - } - } - - if(!declare_completed_dialog){ - set_declare_completed_dialog(); - } - declare_completed_dialog.doc = doc; - declare_completed_dialog.cdt = cdt; - declare_completed_dialog.cdn = cdn; - declare_completed_dialog.show(); + var declare_completed_dialog; + + set_declare_completed_dialog = function() { + declare_completed_dialog = new Dialog(400, 200, 'Declare Completed'); + declare_completed_dialog.make_body([ + ['HTML', 'Message', '
You wont be able to do any changes after declaring this Appraisal as completed. Are you sure, you want to declare it as completed ?
'], + ['HTML', 'Response', '
'], + ['HTML', 'Declare Completed', '
'] + ]); + + var declare_completed_btn1 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button'); + declare_completed_btn1.innerHTML = 'Yes'; + declare_completed_btn1.onclick = function(){ declare_completed_dialog.add(); } + + var declare_completed_btn2 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button'); + declare_completed_btn2.innerHTML = 'No'; + $y(declare_completed_btn2,{marginLeft:'4px'}); + declare_completed_btn2.onclick = function(){ declare_completed_dialog.hide();} + + declare_completed_dialog.onshow = function() { + $i('declare_completed_dialog_response').innerHTML = ''; + } + + declare_completed_dialog.refresh_dt = function(){ + cur_frm.cscript.refresh(this.doc, this.cdt, this.cdn); + msgprint("refersh done"); + $c('webnotes.widgets.form.form_header.refresh_labels',this.doc,function(r,rt){}); + } + + declare_completed_dialog.add = function() { + // sending... + $i('declare_completed_dialog_response').innerHTML = 'Processing...'; + var m_arg = user+ '~~' + this.msg_nm_lst; + + $c_obj(make_doclist(this.doc.doctype, this.doc.name),'declare_completed','', function(r,rt){ + + if(r.message.status == 'Completed'){ + $i('declare_completed_dialog_response').innerHTML = 'Done'; + refresh_field('status'); + declare_completed_dialog.refresh_dt(); + hide_field(['Update', 'Declare Completed', 'Calculate Total Score']); + declare_completed_dialog.hide(); + } + else if(r.message.status == 'Incomplete'){ + $i('declare_completed_dialog_response').innerHTML = 'Incomplete Appraisal'; + } + else if(r.message.status == 'No Score'){ + $i('declare_completed_dialog_response').innerHTML = 'Calculate total score'; + } + }); + } + } + + if(!declare_completed_dialog){ + set_declare_completed_dialog(); + } + declare_completed_dialog.doc = doc; + declare_completed_dialog.cdt = cdt; + declare_completed_dialog.cdn = cdn; + declare_completed_dialog.show(); } cur_frm.cscript.score = function(doc,cdt,cdn){ - var d = locals[cdt][cdn]; - if (d.score){ - total = flt(d.per_weightage*d.score)/100; - d.score_earned = total.toPrecision(2); - refresh_field('score_earned', d.name, 'appraisal_details'); - } - else{ - d.score_earned = ''; - refresh_field('score_earned', d.name, 'appraisal_details'); - } - cur_frm.cscript.calculate_total(doc,cdt,cdn); + var d = locals[cdt][cdn]; + if (d.score){ + if (flt(d.score) > 5) { + msgprint("Score must be less than or equal to 5"); + d.score = 0; + refresh_field('score', d.name, 'appraisal_details'); + } + total = flt(d.per_weightage*d.score)/100; + d.score_earned = total.toPrecision(2); + refresh_field('score_earned', d.name, 'appraisal_details'); + } + else{ + d.score_earned = ''; + refresh_field('score_earned', d.name, 'appraisal_details'); + } + cur_frm.cscript.calculate_total(doc,cdt,cdn); } cur_frm.cscript.calculate_total = function(doc,cdt,cdn){ - var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype); - var total =0; - for(var i = 0; i getdate(self.doc.end_date): - msgprint("End Date can not be less than Start Date") - raise Exception - - def validate_existing_appraisal(self): - chk = sql("select name from `tabAppraisal` where employee=%s and (status='Submitted' or status='Completed') and ((start_date>=%s and start_date<=%s) or (end_date>=%s and end_date<=%s))",(self.doc.employee,self.doc.start_date,self.doc.end_date,self.doc.start_date,self.doc.end_date)) - if chk: - msgprint("You have already created Appraisal "+cstr(chk[0][0])+" in the current date range for employee "+cstr(self.doc.employee_name)) - raise Exception - - def validate_curr_appraisal(self): - for d in getlist(self.doclist, 'appraisal_details'): - if d.target_achieved or d.score: - if self.doc.status == 'Draft': - msgprint("Target achieved or Score can be added only for submitted Appraisal") - raise Exception - elif self.doc.status == 'Submitted' and session['user'] != self.doc.kra_approver: - msgprint("Target achieved or Score can be added only by Appraisal Approver") - raise Exception - - def validate_fiscal_year(self): - fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year) - ysd=fy and fy[0][0] or "" - yed=add_days(str(ysd),365) - if str(self.doc.start_date) < str(ysd) or str(self.doc.start_date) > str(yed) or str(self.doc.end_date) < str(ysd) or str(self.doc.end_date) > str(yed): - msgprint("Appraisal date range is not within the Fiscal Year selected") - raise Exception - - def validate(self): - self.validate_dates() - self.validate_existing_appraisal() - self.validate_curr_appraisal() - self.validate_fiscal_year() - - def set_approver(self): - ret={} - approver_lst =[] - emp_nm = self.get_employee_name() - approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self) - if approver_lst1: - approver_lst=approver_lst1 - else: - approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")] - ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)} - return ret - - def calculate_total(self): - total = 0 - for d in getlist(self.doclist, 'appraisal_details'): - if d.score: - total = total + flt(d.score_earned) - ret={'total_score':flt(total)} - return ret - - def declare_completed(self): - ret={} - for d in getlist(self.doclist, 'appraisal_details'): - if not d.target_achieved or not d.score or not d.score_earned: - msgprint("Please add 'Target Achieved' and 'Score' for all KPI") - ret = {'status':'Incomplete'} - return ret - - if not self.doc.total_score: - msgprint("Please calculate total score using button 'Calculate Total Score'") - ret = {'status':'No Score'} - return ret - self.update_appraisal() - #set(self.doc, 'status', 'Completed') - ret = {'status':'Completed'} - return ret - - def update_appraisal(self): - for d in getlist(self.doclist, 'appraisal_details'): - if not d.kra or not d.per_weightage: - msgprint("Please remove the extra blank row added") - raise Exception - d.save() - if self.doc.total_score: - set(self.doc,'total_score',self.doc.total_score) - - def on_update(self): - set(self.doc, 'status', 'Draft') - - def validate_total_weightage(self): - total_w = 0 - for d in getlist(self.doclist, 'appraisal_details'): - total_w = flt(total_w) + flt(d.per_weightage) - - if flt(total_w)>100 or flt(total_w)<100: - msgprint("Total of weightage assigned to KPI is "+cstr(total_w)+".It should be 100(%)") - raise Exception - - def validate_appraisal_detail(self): - if not self.doc.kra_approver: - msgprint("Please mention the name of Approver") - raise Exception - - if not getlist(self.doclist, 'appraisal_details'): - msgprint("Please add KRA Details") - raise Exception - - self.validate_total_weightage() - - def on_submit(self): - self.validate_appraisal_detail() - set(self.doc, 'status', 'Submitted') - - def on_cancel(self): - set(self.doc, 'status', 'Cancelled') \ No newline at end of file + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist + + def get_employee_name(self): + emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee) + emp_nm= emp_nm and emp_nm[0][0] or '' + self.doc.employee_name = emp_nm + return emp_nm + + def fetch_kra(self): + if not self.doc.kra_template: + msgprint("Please select KRA Template to be be fetched") + raise Exception + self.doc.clear_table(self.doclist,'appraisal_details') + get_obj('DocType Mapper', 'KRA Template-Appraisal').dt_map('KRA Template', 'Appraisal', self.doc.kra_template, self.doc, self.doclist, "[['KRA Template','Appraisal'],['KRA Sheet', 'Appraisal Detail']]") + + def validate_dates(self): + if getdate(self.doc.start_date) > getdate(self.doc.end_date): + msgprint("End Date can not be less than Start Date") + raise Exception + + def validate_existing_appraisal(self): + chk = sql("select name from `tabAppraisal` where employee=%s and (status='Submitted' or status='Completed') and ((start_date>=%s and start_date<=%s) or (end_date>=%s and end_date<=%s))",(self.doc.employee,self.doc.start_date,self.doc.end_date,self.doc.start_date,self.doc.end_date)) + if chk: + msgprint("You have already created Appraisal "+cstr(chk[0][0])+" in the current date range for employee "+cstr(self.doc.employee_name)) + raise Exception + + def validate_curr_appraisal(self): + for d in getlist(self.doclist, 'appraisal_details'): + if d.target_achieved or d.score: + if self.doc.status == 'Draft': + msgprint("Target achieved or Score can be added only for submitted Appraisal") + raise Exception + elif self.doc.status == 'Submitted' and session['user'] != self.doc.kra_approver: + msgprint("Target achieved or Score can be added only by Appraisal Approver") + raise Exception + + + def validate_fiscal_year(self): + fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year) + ysd=fy and fy[0][0] or "" + yed=add_days(str(ysd),365) + if str(self.doc.start_date) < str(ysd) or str(self.doc.start_date) > str(yed) or str(self.doc.end_date) < str(ysd) or str(self.doc.end_date) > str(yed): + msgprint("Appraisal date range is not within the Fiscal Year selected") + raise Exception + + def validate(self): + self.validate_dates() + self.validate_existing_appraisal() + self.validate_curr_appraisal() + self.validate_fiscal_year() + + def set_approver(self): + ret={} + approver_lst =[] + emp_nm = self.get_employee_name() + approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self) + if approver_lst1: + approver_lst=approver_lst1 + else: + approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")] + ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)} + return ret + + def calculate_total(self): + total = 0 + for d in getlist(self.doclist, 'appraisal_details'): + if d.score: + total = total + flt(d.score_earned) + ret={'total_score':flt(total)} + return ret + + def declare_completed(self): + ret={} + for d in getlist(self.doclist, 'appraisal_details'): + if not d.target_achieved or not d.score or not d.score_earned: + msgprint("Please add 'Target Achieved' and 'Score' for all KPI") + ret = {'status':'Incomplete'} + return ret + + if not self.doc.total_score: + msgprint("Please calculate total score using button 'Calculate Total Score'") + ret = {'status':'No Score'} + return ret + self.update_appraisal() + #set(self.doc, 'status', 'Completed') + ret = {'status':'Completed'} + return ret + + def update_appraisal(self): + for d in getlist(self.doclist, 'appraisal_details'): + if not d.kra or not d.per_weightage: + msgprint("Please remove the extra blank row added") + raise Exception + d.save() + if self.doc.total_score: + set(self.doc,'total_score',self.doc.total_score) + + def on_update(self): + set(self.doc, 'status', 'Draft') + + def validate_total_weightage(self): + total_w = 0 + for d in getlist(self.doclist, 'appraisal_details'): + total_w = flt(total_w) + flt(d.per_weightage) + + if flt(total_w)>100 or flt(total_w)<100: + msgprint("Total of weightage assigned to KPI is "+cstr(total_w)+".It should be 100(%)") + raise Exception + + def validate_appraisal_detail(self): + if not self.doc.kra_approver: + msgprint("Please mention the name of Approver") + raise Exception + + if not getlist(self.doclist, 'appraisal_details'): + msgprint("Please add KRA Details") + raise Exception + + self.validate_total_weightage() + + def on_submit(self): + self.validate_appraisal_detail() + set(self.doc, 'status', 'Submitted') + + def on_cancel(self): + set(self.doc, 'status', 'Cancelled') diff --git a/hr/doctype/appraisal/appraisal.txt b/hr/doctype/appraisal/appraisal.txt index 3521c6f867..b10c43407d 100644 --- a/hr/doctype/appraisal/appraisal.txt +++ b/hr/doctype/appraisal/appraisal.txt @@ -5,16 +5,17 @@ { 'creation': '2010-09-01 15:48:05', 'docstatus': 0, - 'modified': '2011-06-27 14:39:10', + 'modified': '2011-09-22 10:59:43', 'modified_by': 'Administrator', 'owner': 'ashwini@webnotestech.com' }, # These values are common for all DocType { - '_last_update': '1308808105', + '_last_update': '1316075905', 'autoname': 'APRSL.#####', 'colour': 'White:FFF', + 'default_print_format': 'Standard', 'doctype': 'DocType', 'module': 'HR', 'name': '__common__', @@ -22,7 +23,7 @@ 'section_style': 'Simple', 'server_code_error': ' ', 'show_in_menu': 0, - 'version': 160 + 'version': 161 }, # These values are common for all DocField @@ -56,7 +57,6 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 1, 'permlevel': 0, 'role': 'System Manager', 'submit': 1, @@ -66,7 +66,6 @@ # DocPerm { 'doctype': 'DocPerm', - 'idx': 2, 'permlevel': 1, 'role': 'System Manager' }, @@ -77,7 +76,6 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 3, 'permlevel': 0, 'role': 'System Manager', 'submit': 1, @@ -87,7 +85,6 @@ # DocPerm { 'doctype': 'DocPerm', - 'idx': 4, 'permlevel': 1, 'role': 'System Manager' }, @@ -98,7 +95,6 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 5, 'permlevel': 0, 'role': 'HR Manager', 'submit': 1, @@ -111,7 +107,6 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 6, 'permlevel': 0, 'role': 'HR User', 'submit': 1, @@ -121,7 +116,6 @@ # DocPerm { 'doctype': 'DocPerm', - 'idx': 7, 'permlevel': 1, 'role': 'HR Manager' }, @@ -129,7 +123,6 @@ # DocPerm { 'doctype': 'DocPerm', - 'idx': 8, 'permlevel': 1, 'role': 'HR User' }, @@ -138,7 +131,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 1, 'label': 'Employee Details', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -151,9 +143,9 @@ 'doctype': 'DocField', 'fieldname': 'status', 'fieldtype': 'Select', - 'idx': 2, 'in_filter': 1, 'label': 'Status', + 'no_copy': 1, 'oldfieldname': 'status', 'oldfieldtype': 'Select', 'options': '\nDraft\nSubmitted\nCompleted\nCancelled', @@ -168,7 +160,6 @@ 'doctype': 'DocField', 'fieldname': 'employee', 'fieldtype': 'Link', - 'idx': 3, 'in_filter': 1, 'label': 'Employee', 'oldfieldname': 'employee', @@ -185,7 +176,6 @@ 'doctype': 'DocField', 'fieldname': 'employee_name', 'fieldtype': 'Data', - 'idx': 4, 'in_filter': 1, 'label': 'Employee Name', 'oldfieldname': 'employee_name', @@ -198,7 +188,6 @@ 'doctype': 'DocField', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', - 'idx': 5, 'in_filter': 1, 'label': 'Fiscal Year', 'oldfieldname': 'fiscal_year', @@ -213,7 +202,6 @@ 'doctype': 'DocField', 'fieldname': 'company', 'fieldtype': 'Select', - 'idx': 6, 'in_filter': 1, 'label': 'Company', 'oldfieldname': 'company', @@ -227,7 +215,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 7, 'oldfieldtype': 'Column Break', 'permlevel': 0, 'width': '50%' @@ -238,7 +225,6 @@ 'doctype': 'DocField', 'fieldname': 'start_date', 'fieldtype': 'Date', - 'idx': 8, 'in_filter': 1, 'label': 'Start Date', 'oldfieldname': 'start_date', @@ -252,7 +238,6 @@ 'doctype': 'DocField', 'fieldname': 'end_date', 'fieldtype': 'Date', - 'idx': 9, 'in_filter': 1, 'label': 'End Date', 'oldfieldname': 'end_date', @@ -267,7 +252,6 @@ 'doctype': 'DocField', 'fieldname': 'kra_approver', 'fieldtype': 'Select', - 'idx': 10, 'in_filter': 0, 'label': 'Approver', 'oldfieldname': 'kra_approver', @@ -282,7 +266,6 @@ 'fieldname': 'amended_from', 'fieldtype': 'Data', 'hidden': 1, - 'idx': 11, 'label': 'Amended From', 'no_copy': 1, 'oldfieldname': 'amended_from', @@ -299,7 +282,6 @@ 'fieldname': 'amendment_date', 'fieldtype': 'Date', 'hidden': 1, - 'idx': 12, 'label': 'Amendment Date', 'no_copy': 1, 'oldfieldname': 'amendment_date', @@ -316,7 +298,6 @@ 'colour': 'White:FFF', 'doctype': 'DocField', 'fieldtype': 'Button', - 'idx': 13, 'label': 'Declare Completed', 'oldfieldtype': 'Button', 'permlevel': 0, @@ -327,7 +308,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 14, 'oldfieldtype': 'Section Break', 'options': 'Simple', 'permlevel': 0 @@ -340,7 +320,6 @@ 'doctype': 'DocField', 'fieldname': 'kra_template', 'fieldtype': 'Link', - 'idx': 15, 'label': 'KRA Template', 'oldfieldname': 'kra_template', 'oldfieldtype': 'Link', @@ -352,7 +331,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Button', - 'idx': 16, 'label': 'Fetch Template', 'oldfieldtype': 'Button', 'options': 'fetch_kra', @@ -366,7 +344,6 @@ 'doctype': 'DocField', 'fieldtype': 'Button', 'hidden': 1, - 'idx': 17, 'label': 'Update', 'oldfieldtype': 'Button', 'permlevel': 0, @@ -380,7 +357,6 @@ 'doctype': 'DocField', 'fieldname': 'appraisal_details', 'fieldtype': 'Table', - 'idx': 18, 'label': 'Appraisal Details', 'oldfieldname': 'appraisal_details', 'oldfieldtype': 'Table', @@ -393,7 +369,6 @@ 'allow_on_submit': 1, 'doctype': 'DocField', 'fieldtype': 'Button', - 'idx': 19, 'label': 'Calculate Total Score', 'oldfieldtype': 'Button', 'options': 'calculate_total', @@ -405,11 +380,10 @@ 'doctype': 'DocField', 'fieldname': 'total_score', 'fieldtype': 'Currency', - 'idx': 20, - 'label': 'Total Score', + 'label': 'Total Score (Out of 5)', 'no_copy': 1, 'oldfieldname': 'total_score', 'oldfieldtype': 'Currency', 'permlevel': 1 } -] \ No newline at end of file +] diff --git a/hr/doctype/appraisal_detail/appraisal_detail.txt b/hr/doctype/appraisal_detail/appraisal_detail.txt index fa57bef30e..06edc81e1b 100644 --- a/hr/doctype/appraisal_detail/appraisal_detail.txt +++ b/hr/doctype/appraisal_detail/appraisal_detail.txt @@ -5,8 +5,8 @@ { 'creation': '2010-09-01 15:48:05', 'docstatus': 0, - 'modified': '2010-09-20 14:06:57', - 'modified_by': 'rahul@webnotestech.com', + 'modified': '2011-09-22 10:45:37', + 'modified_by': 'Administrator', 'owner': 'ashwini@webnotestech.com' }, @@ -14,13 +14,14 @@ { 'autoname': 'APRSLD.#####', 'colour': 'White:FFF', + 'default_print_format': 'Standard', 'doctype': 'DocType', 'istable': 1, 'module': 'HR', 'name': '__common__', 'section_style': 'Simple', 'server_code_error': ' ', - 'version': 13 + 'version': 15 }, # These values are common for all DocField @@ -45,7 +46,6 @@ 'doctype': 'DocField', 'fieldname': 'kra', 'fieldtype': 'Small Text', - 'idx': 1, 'label': 'KRA', 'oldfieldname': 'kra', 'oldfieldtype': 'Small Text', @@ -58,7 +58,6 @@ 'doctype': 'DocField', 'fieldname': 'per_weightage', 'fieldtype': 'Currency', - 'idx': 2, 'label': 'Weightage (%)', 'oldfieldname': 'per_weightage', 'oldfieldtype': 'Currency', @@ -72,7 +71,6 @@ 'doctype': 'DocField', 'fieldname': 'target_achieved', 'fieldtype': 'Small Text', - 'idx': 3, 'label': 'Target Achieved', 'no_copy': 1, 'oldfieldname': 'target_achieved', @@ -86,15 +84,15 @@ 'colour': 'White:FFF', 'doctype': 'DocField', 'fieldname': 'score', - 'fieldtype': 'Select', - 'idx': 4, + 'fieldtype': 'Currency', 'label': 'Score (0-5)', 'no_copy': 1, 'oldfieldname': 'score', 'oldfieldtype': 'Select', 'options': '\n0\n1\n2\n3\n4\n5', 'permlevel': 0, - 'trigger': 'Client' + 'trigger': 'Client', + 'width': '60px' }, # DocField @@ -102,11 +100,10 @@ 'doctype': 'DocField', 'fieldname': 'score_earned', 'fieldtype': 'Currency', - 'idx': 5, 'label': 'Score Earned', 'no_copy': 1, 'oldfieldname': 'score_earned', 'oldfieldtype': 'Currency', 'permlevel': 1 } -] \ No newline at end of file +] diff --git a/patches/patch.py b/patches/patch.py index cfeddeb427..f8f61a5f98 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 368 +last_patch = 369 #------------------------------------------- @@ -355,3 +355,6 @@ def execute(patch_no): ] for d in t: nestedset.rebuild_tree(d[0], d[1]) + elif patch_no == 369: + reload_doc('hr', 'doctype', 'appraisal') + reload_doc('hr', 'doctype', 'appraisal_detail') From 03456444f794e1a9b5ed6448cdfc41528223330e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Sep 2011 12:52:12 +0530 Subject: [PATCH 14/30] fixed cancelled gl entry issue in period closing voucher --- .../period_closing_voucher/period_closing_voucher.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/accounts/doctype/period_closing_voucher/period_closing_voucher.py index c7e5db6639..895130ea0f 100644 --- a/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -79,8 +79,8 @@ class DocType: # Get account (pl) specific balance #=========================================================== def get_pl_balances(self, d_or_c): - acc_bal = sql("select t1.account, sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where t1.account = t2.name and t2.group_or_ledger = 'Ledger' and ifnull(t2.freeze_account, 'No') = 'No' and t2.is_pl_account = 'Yes' and t2.debit_or_credit = '%s' and t2.docstatus < 2 and t2.company = '%s' and t1.posting_date between '%s' and '%s' group by t1.account " % (d_or_c, self.doc.company, self.year_start_date, self.doc.posting_date)) - return acc_bal + acc_bal = sql("select t1.account, sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where t1.account = t2.name and t2.group_or_ledger = 'Ledger' and ifnull(t2.freeze_account, 'No') = 'No' and ifnull(t2.is_pl_account, 'No') = 'Yes' and ifnull(is_cancelled, 'No') = 'No' and t2.debit_or_credit = '%s' and t2.docstatus < 2 and t2.company = '%s' and t1.posting_date between '%s' and '%s' group by t1.account " % (d_or_c, self.doc.company, self.year_start_date, self.doc.posting_date)) + return acc_bal # Makes GL Entries @@ -185,7 +185,7 @@ class DocType: # ============================================================= def on_cancel(self): # get all submit entries of current closing entry voucher - gl_entries = sql("select account, debit, credit from `tabGL Entry` where voucher_type = 'Period Closing Voucher' and voucher_no = '%s'" % (self.doc.name)) + gl_entries = sql("select account, debit, credit from `tabGL Entry` where voucher_type = 'Period Closing Voucher' and voucher_no = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name)) # Swap Debit & Credit Column and make gl entry for gl in gl_entries: From 8bb4ba46386fe84a611e29155f87761ebc9e8555 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Sep 2011 15:16:06 +0530 Subject: [PATCH 15/30] unhide group/ledger field in cost senter for import purpose --- patches/patch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index f8f61a5f98..5db300a797 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 369 +last_patch = 370 #------------------------------------------- @@ -358,3 +358,5 @@ def execute(patch_no): elif patch_no == 369: reload_doc('hr', 'doctype', 'appraisal') reload_doc('hr', 'doctype', 'appraisal_detail') + elif patch_no == 370: + sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'") From fe02f0602c7783808c64dd831f4147625a5c1ddd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 27 Sep 2011 10:38:41 +0530 Subject: [PATCH 16/30] update_nsm_model in cost center on_trash() --- accounts/doctype/cost_center/cost_center.py | 100 +++++++++++--------- patches/patch.py | 14 +++ 2 files changed, 67 insertions(+), 47 deletions(-) diff --git a/accounts/doctype/cost_center/cost_center.py b/accounts/doctype/cost_center/cost_center.py index 521712b1f9..66d22f017d 100644 --- a/accounts/doctype/cost_center/cost_center.py +++ b/accounts/doctype/cost_center/cost_center.py @@ -18,51 +18,57 @@ convert_to_lists = webnotes.conn.convert_to_lists class DocType: - def __init__(self,d,dl): - self.doc, self.doclist = d,dl - self.nsm_parent_field = 'parent_cost_center' - - def autoname(self): - #company_abbr = sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0] - self.doc.name = self.doc.cost_center_name + ' - ' + self.doc.company_abbr - - def get_abbr(self): - abbr = sql("select abbr from tabCompany where company_name='%s'"%(self.doc.company_name))[0][0] or '' - ret = { - 'company_abbr' : abbr - } - return ret + def __init__(self,d,dl): + self.doc, self.doclist = d,dl + self.nsm_parent_field = 'parent_cost_center' + + def autoname(self): + self.doc.name = self.doc.cost_center_name + ' - ' + self.doc.company_abbr + + #------------------------------------------------------------------------- + def get_abbr(self): + abbr = sql("select abbr from tabCompany where company_name='%s'"%(self.doc.company_name))[0][0] or '' + ret = { + 'company_abbr' : abbr + } + return ret - def validate(self): - # Cost Center name must be unique - # --------------------------- - if (self.doc.__islocal or (not self.doc.name)) and sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)): - msgprint("Cost Center Name already exists, please rename") - raise Exception - - check_acc_list = [] - for d in getlist(self.doclist, 'budget_details'): - if [d.account, d.fiscal_year] in check_acc_list: - msgprint("Account " + cstr(d.account) + "has been entered more than once for fiscal year " + cstr(d.fiscal_year)) - raise Exception - if [d.account, d.fiscal_year] not in check_acc_list: check_acc_list.append([d.account, d.fiscal_year]) - - def on_update(self): - # update Node Set Model - import webnotes - import webnotes.utils.nestedset - # update Node Set Model - webnotes.utils.nestedset.update_nsm(self) - - def check_if_child_exists(self): - return sql("select name from `tabCost Center` where parent_cost_center = %s and docstatus != 2", self.doc.name, debug=0) - - # On Trash - # -------- - def on_trash(self): - if self.check_if_child_exists(): - msgprint("Child exists for this cost center. You can not trash this account.", raise_exception=1) - - # rebuild tree - set(self.doc,'old_parent', '') - self.update_nsm_model() + #------------------------------------------------------------------------- + def validate(self): + """ + Cost Center name must be unique + """ + if (self.doc.__islocal or not self.doc.name) and sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)): + msgprint("Cost Center Name already exists, please rename", raise_exception=1) + + check_acc_list = [] + for d in getlist(self.doclist, 'budget_details'): + if [d.account, d.fiscal_year] in check_acc_list: + msgprint("Account " + cstr(d.account) + "has been entered more than once for fiscal year " + cstr(d.fiscal_year), raise_exception=1) + else: + check_acc_list.append([d.account, d.fiscal_year]) + + #------------------------------------------------------------------------- + def update_nsm_model(self): + """ + update Nested Set Model + """ + import webnotes.utils.nestedset + webnotes.utils.nestedset.update_nsm(self) + + #------------------------------------------------------------------------- + def on_update(self): + self.update_nsm_model() + + def check_if_child_exists(self): + return sql("select name from `tabCost Center` where parent_cost_center = %s and docstatus != 2", self.doc.name) + + # On Trash + #------------------------------------------------------------------------- + def on_trash(self): + if self.check_if_child_exists(): + msgprint("Child exists for this cost center. You can not trash this account.", raise_exception=1) + + # rebuild tree + set(self.doc,'old_parent', '') + self.update_nsm_model() diff --git a/patches/patch.py b/patches/patch.py index 5db300a797..3b2bb3ecc6 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -360,3 +360,17 @@ def execute(patch_no): reload_doc('hr', 'doctype', 'appraisal_detail') elif patch_no == 370: sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'") + elif patch_no == 371: + comp = sql("select name from tabCompany where docstatus!=2") + fy = sql("select name from `tabFiscal Year` order by year_start_date asc") + for c in comp: + prev_fy = '' + for f in fy: + fy_obj = get_obj('Fiscal Year', f[0]) + fy_obj.doc.past_year = prev_fy + fy_obj.doc.company = c[0] + fy_obj.doc.save() + fy_obj.repost() + prev_fy = f[0] + sql("commit") + sql("start transaction") From 22b33b59d011fc2537fbecfebde31ec5985de3ae Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 27 Sep 2011 17:01:11 +0530 Subject: [PATCH 17/30] Error fixed in auth control --- .../authorization_control/authorization_control.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/setup/doctype/authorization_control/authorization_control.py b/setup/doctype/authorization_control/authorization_control.py index d0494301c8..3ddcab41db 100644 --- a/setup/doctype/authorization_control/authorization_control.py +++ b/setup/doctype/authorization_control/authorization_control.py @@ -38,7 +38,7 @@ class DocType(TransactionBase): for d in app_dtl: if(d[0]): appr_users.append(d[0]) if(d[1]): appr_roles.append(d[1]) - + if not has_common(appr_roles, webnotes.user.get_roles()) and not has_common(appr_users, session['user']): msg, add_msg = '','' if max_amount: @@ -117,7 +117,7 @@ class DocType(TransactionBase): # Check for authorization set for individual user based_on = [x[0] for x in sql("select distinct based_on from `tabAuthorization Rule` where transaction = %s and system_user = %s and (company = %s or ifnull(company,'')='') and docstatus != 2", (doctype_name, session['user'], company))] - + for d in based_on: self.bifurcate_based_on_type(doctype_name, total, av_dis, d, doc_obj, 1, company) @@ -128,7 +128,13 @@ class DocType(TransactionBase): # Specific Role # =============== # Check for authorization set on particular roles - based_on = [x[0] for x in sql("select based_on from `tabAuthorization Rule` where transaction = %s and system_role IN (%s) and based_on IN (%s) and (company = %s or ifnull(company,'')='') and docstatus != 2", (doctype_name, "'"+"','".join(webnotes.user.get_roles())+"'", "'"+"','".join(final_based_on)+"'",company))] + based_on = [x[0] for x in sql("""select based_on + from `tabAuthorization Rule` + where transaction = %s and system_role IN (%s) and based_on IN (%s) + and (company = %s or ifnull(company,'')='') + and docstatus != 2 + """ % ('%s', "'"+"','".join(webnotes.user.get_roles())+"'", "'"+"','".join(final_based_on)+"'", '%s'), (doctype_name, company))] + for d in based_on: self.bifurcate_based_on_type(doctype_name, total, av_dis, d, doc_obj, 2, company) From bbca2337db0cc673b6a9a8a4ae694f408503c08e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 30 Sep 2011 17:49:24 +0530 Subject: [PATCH 18/30] get_query modified for item in quotation --- selling/doctype/quotation/quotation.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index 0732e45dc6..21eceb9c61 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -314,9 +314,9 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= 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\ + 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, i.item_name, i.description FROM\ (\ - select item_code,name from tabItem where tabItem.%(key)s like '%s' %(cond)s\ + select item_code,name, item_name, description from tabItem where tabItem.%(key)s like '%s' %(cond)s\ )i\ left join\ (\ @@ -339,5 +339,5 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= )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, cond:cond}); else - 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}); + return repl("SELECT name, item_name, description FROM tabItem WHERE `tabItem`.%(key)s LIKE '%s' %(cond)s ORDER BY tabItem.item_code DESC LIMIT 50", {cond:cond}); } From d4694763f62a2eb601352d938f43177ac9ebf5be Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 30 Sep 2011 17:50:17 +0530 Subject: [PATCH 19/30] get_query modified for item in quotation --- selling/doctype/quotation/quotation.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index 0732e45dc6..21eceb9c61 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -314,9 +314,9 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= 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\ + 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, i.item_name, i.description FROM\ (\ - select item_code,name from tabItem where tabItem.%(key)s like '%s' %(cond)s\ + select item_code,name, item_name, description from tabItem where tabItem.%(key)s like '%s' %(cond)s\ )i\ left join\ (\ @@ -339,5 +339,5 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= )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, cond:cond}); else - 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}); + return repl("SELECT name, item_name, description FROM tabItem WHERE `tabItem`.%(key)s LIKE '%s' %(cond)s ORDER BY tabItem.item_code DESC LIMIT 50", {cond:cond}); } From 2ce051284acb9a93156912cf4ad9f6d5939ed966 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 30 Sep 2011 20:15:39 +0530 Subject: [PATCH 20/30] fieldname changed in features setup and required patch --- patches/patch.py | 17 ++++++- .../doctype/features_setup/features_setup.txt | 45 ++++++++++--------- startup/startup.js | 34 +++++++------- 3 files changed, 56 insertions(+), 40 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index 3b2bb3ecc6..8177e87f7e 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 370 +last_patch = 371 #------------------------------------------- @@ -361,6 +361,21 @@ def execute(patch_no): elif patch_no == 370: sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'") elif patch_no == 371: + reload_doc('setup', 'doctype','features_setup') + flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_serial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] + + for f in flds: + val = sql("select value from tabSingles where field = '%s' and doctype = 'Features Setup'" % f) + val = val and val[0][0] or 0 + sql("update `tabSingles` set value = %s where field = '%s' and doctype = 'Features Setup'" % (val, '__'+f)) + + st = "'"+"', '".join(flds)+"'" + sql("delete from `tabSingles` where field in (%s) and doctype = 'Features Setup'" % st) + sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st) + + get_obj('Features Setup', 'Features Setup').doc.save() + + elif patch_no == 372: comp = sql("select name from tabCompany where docstatus!=2") fy = sql("select name from `tabFiscal Year` order by year_start_date asc") for c in comp: diff --git a/setup/doctype/features_setup/features_setup.txt b/setup/doctype/features_setup/features_setup.txt index 224d175a0b..b43a8eba66 100644 --- a/setup/doctype/features_setup/features_setup.txt +++ b/setup/doctype/features_setup/features_setup.txt @@ -3,17 +3,18 @@ # These values are common in all dictionaries { - 'creation': '2011-08-25 16:53:56', + 'creation': '2011-09-07 11:59:05', 'docstatus': 0, - 'modified': '2011-08-31 15:05:53', + 'modified': '2011-09-30 19:49:12', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1314783102', + '_last_update': '1317365120', 'colour': 'White:FFF', + 'default_print_format': 'Standard', 'doctype': 'DocType', 'issingle': 1, 'module': 'Setup', @@ -21,7 +22,7 @@ 'name_case': 'Title Case', 'section_style': 'Simple', 'show_in_menu': 1, - 'version': 16 + 'version': 19 }, # These values are common for all DocField @@ -77,7 +78,7 @@ 'colour': 'White:FFF', 'description': 'To track item in sales and purchase documents based on their serial nos. This is can also used to track warranty details of the product.', 'doctype': 'DocField', - 'fieldname': 'item_searial_nos', + 'fieldname': '__item_searial_nos', 'fieldtype': 'Check', 'label': 'Item Serial Nos' }, @@ -87,7 +88,7 @@ 'colour': 'White:FFF', 'description': 'To track items in sales and purchase documents with batch nos
Preferred Industry: Chemicals etc', 'doctype': 'DocField', - 'fieldname': 'item_batch_nos', + 'fieldname': '__item_batch_nos', 'fieldtype': 'Check', 'label': 'Item Batch Nos' }, @@ -97,7 +98,7 @@ 'colour': 'White:FFF', 'description': 'To track brand name in the following documents
\nDelivery Note, Enuiry, Indent, Item, Purchase Order, Purchase Voucher, Purchaser Receipt, Quotation, Receivable Voucher, Sales BOM, Sales Order, Serial No', 'doctype': 'DocField', - 'fieldname': 'brands', + 'fieldname': '__brands', 'fieldtype': 'Check', 'label': 'Brands' }, @@ -113,7 +114,7 @@ 'colour': 'White:FFF', 'description': '1. To maintain the customer wise item code and to make them searchable based on their code use this option', 'doctype': 'DocField', - 'fieldname': 'item_advanced', + 'fieldname': '__item_advanced', 'fieldtype': 'Check', 'label': 'Item Advanced' }, @@ -123,7 +124,7 @@ 'colour': 'White:FFF', 'description': 'If Sale BOM is defined, the actual BOM of the Pack is displayed as table.\nAvailable in Delivery Note and Sales Order', 'doctype': 'DocField', - 'fieldname': 'packing_details', + 'fieldname': '__packing_details', 'fieldtype': 'Check', 'label': 'Packing Detials' }, @@ -133,7 +134,7 @@ 'colour': 'White:FFF', 'description': 'To get Item Group in details table', 'doctype': 'DocField', - 'fieldname': 'item_group_in_details', + 'fieldname': '__item_group_in_details', 'fieldtype': 'Check', 'label': 'Item Groups in Details' }, @@ -150,7 +151,7 @@ 'colour': 'White:FFF', 'description': 'All export related fields like currency, conversion rate, export total, export grand total etc are available in
\nDelivery Note, POS, Quotation, Sales Invoice, Sales Order etc.', 'doctype': 'DocField', - 'fieldname': 'exports', + 'fieldname': '__exports', 'fieldtype': 'Check', 'label': 'Exports' }, @@ -160,7 +161,7 @@ 'colour': 'White:FFF', 'description': 'All import related fields like currency, conversion rate, import total, import grand total etc are available in
\nPurchase Receipt, Supplier Quotation, Purchase Invoice, Purchase Order etc.', 'doctype': 'DocField', - 'fieldname': 'imports', + 'fieldname': '__imports', 'fieldtype': 'Check', 'label': 'Imports' }, @@ -176,7 +177,7 @@ 'colour': 'White:FFF', 'description': 'Field available in Delivery Note, Quotation, Receivable Voucher, Sales Order', 'doctype': 'DocField', - 'fieldname': 'discounts', + 'fieldname': '__discounts', 'fieldtype': 'Check', 'label': 'Discounts' }, @@ -186,7 +187,7 @@ 'colour': 'White:FFF', 'description': 'To track any installation or commissioning related work after sales', 'doctype': 'DocField', - 'fieldname': 'after_sales_installations', + 'fieldname': '__after_sales_installations', 'fieldtype': 'Check', 'label': 'After Sale Installations' }, @@ -195,7 +196,7 @@ { 'description': 'Available in \nBill Of Materials, Delivery Note, Payable Voucher, Production Order, Purchase Order, Purchase Receipt, Receivable Voucher, Sales Order, Stock Entry, Timesheet', 'doctype': 'DocField', - 'fieldname': 'projects', + 'fieldname': '__projects', 'fieldtype': 'Check', 'label': 'Projects' }, @@ -205,7 +206,7 @@ 'colour': 'White:FFF', 'description': 'If you have Sales Team and Sale Partners (Channel Partners) they can be tagged and maintain their contribution in the sales activity', 'doctype': 'DocField', - 'fieldname': 'sales_extras', + 'fieldname': '__sales_extras', 'fieldtype': 'Check', 'label': 'Sales Extras' }, @@ -222,7 +223,7 @@ 'colour': 'White:FFF', 'description': 'If you involve in manufacturing activity
\nEnables item Is Manufactured', 'doctype': 'DocField', - 'fieldname': 'manufacturing', + 'fieldname': '__manufacturing', 'fieldtype': 'Check', 'label': 'Manufacturing' }, @@ -238,7 +239,7 @@ 'colour': 'White:FFF', 'description': 'If you follow Quality Inspection
\nEnables item QA Required and QA No in Purchase Receipt', 'doctype': 'DocField', - 'fieldname': 'quality', + 'fieldname': '__quality', 'fieldtype': 'Check', 'label': 'Quality' }, @@ -248,7 +249,7 @@ 'colour': 'White:FFF', 'description': 'To enable Point of Sale features', 'doctype': 'DocField', - 'fieldname': 'pos', + 'fieldname': '__pos', 'fieldtype': 'Check', 'label': 'Point of Sale' }, @@ -265,7 +266,7 @@ 'colour': 'White:FFF', 'description': 'If you have long print formats, this feature can be used to split the page to be printed on multiple pages with all headers and footers on each page', 'doctype': 'DocField', - 'fieldname': 'page_break', + 'fieldname': '__page_break', 'fieldtype': 'Check', 'label': 'Page Break' }, @@ -281,8 +282,8 @@ 'colour': 'White:FFF', 'description': 'Enables More Info. in all documents', 'doctype': 'DocField', - 'fieldname': 'more_info', + 'fieldname': '__more_info', 'fieldtype': 'Check', 'label': 'More Info' } -] \ No newline at end of file +] diff --git a/startup/startup.js b/startup/startup.js index 942f4effc5..6199c772bc 100644 --- a/startup/startup.js +++ b/startup/startup.js @@ -552,7 +552,7 @@ Dictionary Format } // ====================================================================*/ pscript.feature_dict = { - 'projects': { + '__projects': { 'Bill Of Materials': {'fields':['project_name']}, 'Delivery Note': {'fields':['project_name']}, 'Payable Voucher': {'fields':['project_name']}, @@ -564,17 +564,17 @@ pscript.feature_dict = { 'Stock Entry': {'fields':['project_name']}, 'Timesheet': {'timesheet_details':['project_name']} }, - 'packing_details': { + '__packing_details': { 'Delivery Note': {'fields':['packing_details','print_packing_slip'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']}, 'Sales Order': {'fields':['packing_details']} }, - 'discounts': { + '__discounts': { 'Delivery Note': {'delivery_note_details':['adj_rate']}, 'Quotation': {'quotation_details':['adj_rate']}, 'Receivable Voucher': {'entries':['adj_rate']}, 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']} }, - 'brands': { + '__brands': { 'Delivery Note': {'delivery_note_details':['brand']}, 'Indent': {'indent_details':['brand']}, 'Item': {'fields':['brand']}, @@ -586,10 +586,10 @@ pscript.feature_dict = { 'Sales Order': {'sales_order_details':['brand']}, 'Serial No': {'fields':['brand']} }, - 'after_sales_installations': { + '__after_sales_installations': { 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']} }, - 'item_batch_nos': { + '__item_batch_nos': { 'Delivery Note': {'delivery_note_details':['batch_no']}, 'Item': {'fields':['has_batch_no']}, 'Purchase Receipt': {'purchase_receipt_details':['batch_no']}, @@ -599,7 +599,7 @@ pscript.feature_dict = { 'Stock Entry': {'mtn_details':['batch_no']}, 'Stock Ledger Entry': {'fields':['batch_no']} }, - 'item_serial_nos': { + '__item_serial_nos': { 'Customer Issue': {'fields':['serial_no']}, 'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']}, 'Installation Note': {'installed_item_details':['serial_no']}, @@ -613,7 +613,7 @@ pscript.feature_dict = { 'Stock Entry': {'mtn_details':['serial_no']}, 'Stock Ledger Entry': {'fields':['serial_no']} }, - 'item_group_in_details': { + '__item_group_in_details': { 'Delivery Note': {'delivery_note_details':['item_group']}, 'Enquiry': {'enquiry_details':['item_group']}, 'Indent': {'indent_details':['item_group']}, @@ -631,7 +631,7 @@ pscript.feature_dict = { 'Sales Person': {'target_details':['item_group']}, 'Territory': {'target_details':['item_group']} }, - 'page_break': { + '__page_break': { 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']}, 'Indent': {'indent_details':['page_break']}, 'Purchase Order': {'po_details':['page_break']}, @@ -641,7 +641,7 @@ pscript.feature_dict = { 'Receivable Voucher': {'entries':['page_break']}, 'Sales Order': {'sales_order_details':['page_break']} }, - 'exports': { + '__exports': { 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']}, 'POS Setting': {'fields':['conversion_rate','currency']}, 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']}, @@ -650,16 +650,16 @@ pscript.feature_dict = { 'Sales BOM': {'fields':['currency']}, 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']} }, - 'imports': { + '__imports': { 'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']}, 'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']}, 'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']}, 'Supplier Quotation': {'fields':['conversion_rate','currency']} }, - 'item_advanced': { + '__item_advanced': { 'Item': {'fields':['item_customer_details']} }, - 'sales_extras': { + '__sales_extras': { 'Address': {'fields':['sales_partner']}, 'Contact': {'fields':['sales_partner']}, 'Customer': {'fields':['sales_team']}, @@ -668,7 +668,7 @@ pscript.feature_dict = { 'Receivable Voucher': {'fields':['sales_team']}, 'Sales Order': {'fields':['sales_team','Packing List']} }, - 'more_info': { + '__more_info': { 'Customer': {'fields':['More Info']}, 'Delivery Note': {'fields':['More Info']}, 'Enquiry': {'fields':['More Info']}, @@ -683,14 +683,14 @@ pscript.feature_dict = { 'Serial No': {'fields':['More Info']}, 'Supplier': {'fields':['More Info']} }, - 'quality': { + '__quality': { 'Item': {'fields':['Item Inspection Criteria','inspection_required']}, 'Purchase Receipt': {'purchase_receipt_details':['qa_no']} }, - 'manufacturing': { + '__manufacturing': { 'Item': {'fields':['Manufacturing']} }, - 'pos': { + '__pos': { 'Receivable Voucher': {'fields':['is_pos']} } } From 5556cbe51dace8c1ff8905be5851d74a4c54b86e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 30 Sep 2011 20:36:56 +0530 Subject: [PATCH 21/30] features setup patch fixed --- patches/patch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index 8177e87f7e..cdfbbb6c6d 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -361,6 +361,8 @@ def execute(patch_no): elif patch_no == 370: sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'") elif patch_no == 371: + from webnotes.modules.module_manager import reload_doc + reload_doc('setup', 'doctype','features_setup') flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_serial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] @@ -368,9 +370,9 @@ def execute(patch_no): val = sql("select value from tabSingles where field = '%s' and doctype = 'Features Setup'" % f) val = val and val[0][0] or 0 sql("update `tabSingles` set value = %s where field = '%s' and doctype = 'Features Setup'" % (val, '__'+f)) - + st = "'"+"', '".join(flds)+"'" - sql("delete from `tabSingles` where field in (%s) and doctype = 'Features Setup'" % st) + sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st) sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st) get_obj('Features Setup', 'Features Setup').doc.save() From cdb8255628b9ce29bc185a750fe02af2f87e8935 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2011 11:26:46 +0530 Subject: [PATCH 22/30] Fieldname changed in Features Setup --- patches/patch.py | 23 +++++++++-- .../doctype/features_setup/features_setup.txt | 40 +++++++++---------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index cdfbbb6c6d..6618b7aefe 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 371 +last_patch = 372 #------------------------------------------- @@ -364,12 +364,12 @@ def execute(patch_no): from webnotes.modules.module_manager import reload_doc reload_doc('setup', 'doctype','features_setup') - flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_serial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] + flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] for f in flds: val = sql("select value from tabSingles where field = '%s' and doctype = 'Features Setup'" % f) val = val and val[0][0] or 0 - sql("update `tabSingles` set value = %s where field = '%s' and doctype = 'Features Setup'" % (val, '__'+f)) + sql("update `tabSingles` set `value` = %s where `field` = '%s' and doctype = 'Features Setup'" % (val, '__'+f)) st = "'"+"', '".join(flds)+"'" sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st) @@ -378,6 +378,23 @@ def execute(patch_no): get_obj('Features Setup', 'Features Setup').doc.save() elif patch_no == 372: + from webnotes.modules.module_manager import reload_doc + + reload_doc('setup', 'doctype','features_setup') + flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] + + for f in flds: + val = sql("select value from tabSingles where field = '%s' and doctype = 'Features Setup'" % f) + val = val and val[0][0] or 0 + sql("update `tabSingles` set `value` = %s where `field` = '%s' and doctype = 'Features Setup'" % (val, 'fs_'+f)) + + st = "'__"+"', '__".join(flds)+"'" + + sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st) + sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st) + + get_obj('Features Setup', 'Features Setup').doc.save() + elif patch_no == 373: comp = sql("select name from tabCompany where docstatus!=2") fy = sql("select name from `tabFiscal Year` order by year_start_date asc") for c in comp: diff --git a/setup/doctype/features_setup/features_setup.txt b/setup/doctype/features_setup/features_setup.txt index b43a8eba66..722d49a07e 100644 --- a/setup/doctype/features_setup/features_setup.txt +++ b/setup/doctype/features_setup/features_setup.txt @@ -5,14 +5,14 @@ { 'creation': '2011-09-07 11:59:05', 'docstatus': 0, - 'modified': '2011-09-30 19:49:12', + 'modified': '2011-10-05 10:50:17', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1317365120', + '_last_update': '1317790484', 'colour': 'White:FFF', 'default_print_format': 'Standard', 'doctype': 'DocType', @@ -22,7 +22,7 @@ 'name_case': 'Title Case', 'section_style': 'Simple', 'show_in_menu': 1, - 'version': 19 + 'version': 21 }, # These values are common for all DocField @@ -78,7 +78,7 @@ 'colour': 'White:FFF', 'description': 'To track item in sales and purchase documents based on their serial nos. This is can also used to track warranty details of the product.', 'doctype': 'DocField', - 'fieldname': '__item_searial_nos', + 'fieldname': 'fs_item_serial_nos', 'fieldtype': 'Check', 'label': 'Item Serial Nos' }, @@ -88,7 +88,7 @@ 'colour': 'White:FFF', 'description': 'To track items in sales and purchase documents with batch nos
Preferred Industry: Chemicals etc', 'doctype': 'DocField', - 'fieldname': '__item_batch_nos', + 'fieldname': 'fs_item_batch_nos', 'fieldtype': 'Check', 'label': 'Item Batch Nos' }, @@ -98,7 +98,7 @@ 'colour': 'White:FFF', 'description': 'To track brand name in the following documents
\nDelivery Note, Enuiry, Indent, Item, Purchase Order, Purchase Voucher, Purchaser Receipt, Quotation, Receivable Voucher, Sales BOM, Sales Order, Serial No', 'doctype': 'DocField', - 'fieldname': '__brands', + 'fieldname': 'fs_brands', 'fieldtype': 'Check', 'label': 'Brands' }, @@ -114,7 +114,7 @@ 'colour': 'White:FFF', 'description': '1. To maintain the customer wise item code and to make them searchable based on their code use this option', 'doctype': 'DocField', - 'fieldname': '__item_advanced', + 'fieldname': 'fs_item_advanced', 'fieldtype': 'Check', 'label': 'Item Advanced' }, @@ -124,7 +124,7 @@ 'colour': 'White:FFF', 'description': 'If Sale BOM is defined, the actual BOM of the Pack is displayed as table.\nAvailable in Delivery Note and Sales Order', 'doctype': 'DocField', - 'fieldname': '__packing_details', + 'fieldname': 'fs_packing_details', 'fieldtype': 'Check', 'label': 'Packing Detials' }, @@ -134,7 +134,7 @@ 'colour': 'White:FFF', 'description': 'To get Item Group in details table', 'doctype': 'DocField', - 'fieldname': '__item_group_in_details', + 'fieldname': 'fs_item_group_in_details', 'fieldtype': 'Check', 'label': 'Item Groups in Details' }, @@ -151,7 +151,7 @@ 'colour': 'White:FFF', 'description': 'All export related fields like currency, conversion rate, export total, export grand total etc are available in
\nDelivery Note, POS, Quotation, Sales Invoice, Sales Order etc.', 'doctype': 'DocField', - 'fieldname': '__exports', + 'fieldname': 'fs_exports', 'fieldtype': 'Check', 'label': 'Exports' }, @@ -161,7 +161,7 @@ 'colour': 'White:FFF', 'description': 'All import related fields like currency, conversion rate, import total, import grand total etc are available in
\nPurchase Receipt, Supplier Quotation, Purchase Invoice, Purchase Order etc.', 'doctype': 'DocField', - 'fieldname': '__imports', + 'fieldname': 'fs_imports', 'fieldtype': 'Check', 'label': 'Imports' }, @@ -177,7 +177,7 @@ 'colour': 'White:FFF', 'description': 'Field available in Delivery Note, Quotation, Receivable Voucher, Sales Order', 'doctype': 'DocField', - 'fieldname': '__discounts', + 'fieldname': 'fs_discounts', 'fieldtype': 'Check', 'label': 'Discounts' }, @@ -187,7 +187,7 @@ 'colour': 'White:FFF', 'description': 'To track any installation or commissioning related work after sales', 'doctype': 'DocField', - 'fieldname': '__after_sales_installations', + 'fieldname': 'fs_after_sales_installations', 'fieldtype': 'Check', 'label': 'After Sale Installations' }, @@ -196,7 +196,7 @@ { 'description': 'Available in \nBill Of Materials, Delivery Note, Payable Voucher, Production Order, Purchase Order, Purchase Receipt, Receivable Voucher, Sales Order, Stock Entry, Timesheet', 'doctype': 'DocField', - 'fieldname': '__projects', + 'fieldname': 'fs_projects', 'fieldtype': 'Check', 'label': 'Projects' }, @@ -206,7 +206,7 @@ 'colour': 'White:FFF', 'description': 'If you have Sales Team and Sale Partners (Channel Partners) they can be tagged and maintain their contribution in the sales activity', 'doctype': 'DocField', - 'fieldname': '__sales_extras', + 'fieldname': 'fs_sales_extras', 'fieldtype': 'Check', 'label': 'Sales Extras' }, @@ -223,7 +223,7 @@ 'colour': 'White:FFF', 'description': 'If you involve in manufacturing activity
\nEnables item Is Manufactured', 'doctype': 'DocField', - 'fieldname': '__manufacturing', + 'fieldname': 'fs_manufacturing', 'fieldtype': 'Check', 'label': 'Manufacturing' }, @@ -239,7 +239,7 @@ 'colour': 'White:FFF', 'description': 'If you follow Quality Inspection
\nEnables item QA Required and QA No in Purchase Receipt', 'doctype': 'DocField', - 'fieldname': '__quality', + 'fieldname': 'fs_quality', 'fieldtype': 'Check', 'label': 'Quality' }, @@ -249,7 +249,7 @@ 'colour': 'White:FFF', 'description': 'To enable Point of Sale features', 'doctype': 'DocField', - 'fieldname': '__pos', + 'fieldname': 'fs_pos', 'fieldtype': 'Check', 'label': 'Point of Sale' }, @@ -266,7 +266,7 @@ 'colour': 'White:FFF', 'description': 'If you have long print formats, this feature can be used to split the page to be printed on multiple pages with all headers and footers on each page', 'doctype': 'DocField', - 'fieldname': '__page_break', + 'fieldname': 'fs_page_break', 'fieldtype': 'Check', 'label': 'Page Break' }, @@ -282,7 +282,7 @@ 'colour': 'White:FFF', 'description': 'Enables More Info. in all documents', 'doctype': 'DocField', - 'fieldname': '__more_info', + 'fieldname': 'fs_more_info', 'fieldtype': 'Check', 'label': 'More Info' } From e20311e9d4dc4f969de664fb3c9be5d8aff1c1d6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2011 11:31:11 +0530 Subject: [PATCH 23/30] Fieldname changed in Features Setup --- startup/startup.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/startup/startup.js b/startup/startup.js index 6199c772bc..a0661ae06f 100644 --- a/startup/startup.js +++ b/startup/startup.js @@ -552,7 +552,7 @@ Dictionary Format } // ====================================================================*/ pscript.feature_dict = { - '__projects': { + 'fs_projects': { 'Bill Of Materials': {'fields':['project_name']}, 'Delivery Note': {'fields':['project_name']}, 'Payable Voucher': {'fields':['project_name']}, @@ -564,17 +564,17 @@ pscript.feature_dict = { 'Stock Entry': {'fields':['project_name']}, 'Timesheet': {'timesheet_details':['project_name']} }, - '__packing_details': { + 'fs_packing_details': { 'Delivery Note': {'fields':['packing_details','print_packing_slip'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']}, 'Sales Order': {'fields':['packing_details']} }, - '__discounts': { + 'fs_discounts': { 'Delivery Note': {'delivery_note_details':['adj_rate']}, 'Quotation': {'quotation_details':['adj_rate']}, 'Receivable Voucher': {'entries':['adj_rate']}, 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']} }, - '__brands': { + 'fs_brands': { 'Delivery Note': {'delivery_note_details':['brand']}, 'Indent': {'indent_details':['brand']}, 'Item': {'fields':['brand']}, @@ -586,10 +586,10 @@ pscript.feature_dict = { 'Sales Order': {'sales_order_details':['brand']}, 'Serial No': {'fields':['brand']} }, - '__after_sales_installations': { + 'fs_after_sales_installations': { 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']} }, - '__item_batch_nos': { + 'fs_item_batch_nos': { 'Delivery Note': {'delivery_note_details':['batch_no']}, 'Item': {'fields':['has_batch_no']}, 'Purchase Receipt': {'purchase_receipt_details':['batch_no']}, @@ -599,7 +599,7 @@ pscript.feature_dict = { 'Stock Entry': {'mtn_details':['batch_no']}, 'Stock Ledger Entry': {'fields':['batch_no']} }, - '__item_serial_nos': { + 'fs_item_serial_nos': { 'Customer Issue': {'fields':['serial_no']}, 'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']}, 'Installation Note': {'installed_item_details':['serial_no']}, @@ -613,7 +613,7 @@ pscript.feature_dict = { 'Stock Entry': {'mtn_details':['serial_no']}, 'Stock Ledger Entry': {'fields':['serial_no']} }, - '__item_group_in_details': { + 'fs_item_group_in_details': { 'Delivery Note': {'delivery_note_details':['item_group']}, 'Enquiry': {'enquiry_details':['item_group']}, 'Indent': {'indent_details':['item_group']}, @@ -631,7 +631,7 @@ pscript.feature_dict = { 'Sales Person': {'target_details':['item_group']}, 'Territory': {'target_details':['item_group']} }, - '__page_break': { + 'fs_page_break': { 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']}, 'Indent': {'indent_details':['page_break']}, 'Purchase Order': {'po_details':['page_break']}, @@ -641,7 +641,7 @@ pscript.feature_dict = { 'Receivable Voucher': {'entries':['page_break']}, 'Sales Order': {'sales_order_details':['page_break']} }, - '__exports': { + 'fs_exports': { 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']}, 'POS Setting': {'fields':['conversion_rate','currency']}, 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']}, @@ -650,16 +650,16 @@ pscript.feature_dict = { 'Sales BOM': {'fields':['currency']}, 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']} }, - '__imports': { + 'fs_imports': { 'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']}, 'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']}, 'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']}, 'Supplier Quotation': {'fields':['conversion_rate','currency']} }, - '__item_advanced': { + 'fs_item_advanced': { 'Item': {'fields':['item_customer_details']} }, - '__sales_extras': { + 'fs_sales_extras': { 'Address': {'fields':['sales_partner']}, 'Contact': {'fields':['sales_partner']}, 'Customer': {'fields':['sales_team']}, @@ -668,7 +668,7 @@ pscript.feature_dict = { 'Receivable Voucher': {'fields':['sales_team']}, 'Sales Order': {'fields':['sales_team','Packing List']} }, - '__more_info': { + 'fs_more_info': { 'Customer': {'fields':['More Info']}, 'Delivery Note': {'fields':['More Info']}, 'Enquiry': {'fields':['More Info']}, @@ -683,14 +683,14 @@ pscript.feature_dict = { 'Serial No': {'fields':['More Info']}, 'Supplier': {'fields':['More Info']} }, - '__quality': { + 'fs_quality': { 'Item': {'fields':['Item Inspection Criteria','inspection_required']}, 'Purchase Receipt': {'purchase_receipt_details':['qa_no']} }, - '__manufacturing': { + 'fs_manufacturing': { 'Item': {'fields':['Manufacturing']} }, - '__pos': { + 'fs_pos': { 'Receivable Voucher': {'fields':['is_pos']} } } From 7cb981c3fbb35b70a40035e11c86af9822ed9ba8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2011 11:47:38 +0530 Subject: [PATCH 24/30] Fieldname changed in Features Setup --- patches/patch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index 6618b7aefe..cb1f056602 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 372 +last_patch = 373 #------------------------------------------- @@ -395,6 +395,9 @@ def execute(patch_no): get_obj('Features Setup', 'Features Setup').doc.save() elif patch_no == 373: + sql("delete from `tabDocField` where fieldname = 'item_searial_nos' and parent = 'Features Setup'") + sql("delete from `tabDefaultValue` where defkey = 'item_searial_nos' and parent = 'Control Panel'") + elif patch_no == 374: comp = sql("select name from tabCompany where docstatus!=2") fy = sql("select name from `tabFiscal Year` order by year_start_date asc") for c in comp: From 1c48c598986e776829429c0c1d32b82fd7ce1c85 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2011 12:10:44 +0530 Subject: [PATCH 25/30] features by default on --- patches/patch.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index cb1f056602..a202f81ad9 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 373 +last_patch = 374 #------------------------------------------- @@ -397,7 +397,15 @@ def execute(patch_no): elif patch_no == 373: sql("delete from `tabDocField` where fieldname = 'item_searial_nos' and parent = 'Features Setup'") sql("delete from `tabDefaultValue` where defkey = 'item_searial_nos' and parent = 'Control Panel'") - elif patch_no == 374: + elif patch_no == 374: + rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null") + from webnotes.model.code import get_obj + m = get_obj('Features Setup') + for d in rs: + m.doc.fields[d[0]] = 1 + m.doc.save() + m.validate() + elif patch_no == 375: comp = sql("select name from tabCompany where docstatus!=2") fy = sql("select name from `tabFiscal Year` order by year_start_date asc") for c in comp: From f092b8c21e54eddb6fdd8bbc59e7e4dc9a44b04c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2011 15:00:34 +0530 Subject: [PATCH 26/30] purchase tax mapping while pulling --- accounts/doctype/payable_voucher/payable_voucher.js | 7 +++---- accounts/doctype/payable_voucher/payable_voucher.py | 12 +++--------- stock/doctype/purchase_receipt/purchase_receipt.js | 8 +++++--- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/accounts/doctype/payable_voucher/payable_voucher.js b/accounts/doctype/payable_voucher/payable_voucher.js index e3b986d8a1..06c2947dd2 100644 --- a/accounts/doctype/payable_voucher/payable_voucher.js +++ b/accounts/doctype/payable_voucher/payable_voucher.js @@ -169,13 +169,12 @@ cur_frm.cscript['Recalculate'] = function(doc, dt, dn) { // ----------------- cur_frm.cscript['Get Items'] = function(doc, dt, dn) { var callback = function(r,rt) { - unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']); - refresh_many(['credit_to','supplier','supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email','entries','purchase_receipt_main','purchase_order_main']); + unhide_field(['supplier_address', 'contact_person', 'supplier_name', 'address_display', 'contact_display', 'contact_mobile','contact_email']); + refresh_many(['credit_to','supplier','supplier_address','contact_person','supplier_name', 'address_display', 'contact_display','contact_mobile', 'contact_email','entries', 'purchase_receipt_main', 'purchase_order_main', 'purchase_tax_details']); } - get_server_fields('pull_details','','',doc, dt, dn,1,callback); + $c_obj(make_doclist(dt,dn),'pull_details','',callback); } - // ========== PV Details Table ============ // Item Code diff --git a/accounts/doctype/payable_voucher/payable_voucher.py b/accounts/doctype/payable_voucher/payable_voucher.py index b403d20c02..7bc0eb6301 100644 --- a/accounts/doctype/payable_voucher/payable_voucher.py +++ b/accounts/doctype/payable_voucher/payable_voucher.py @@ -72,25 +72,19 @@ class DocType(TransactionBase): ret['cost_center'] = cost_center and cost_center[0][0] or '' return ret - + # Get Items based on PO or PR # ---------------------------- def pull_details(self): if self.doc.purchase_receipt_main: self.validate_duplicate_docname('purchase_receipt') - self.doclist = get_obj('DocType Mapper', 'Purchase Receipt-Payable Voucher').dt_map('Purchase Receipt', 'Payable Voucher', self.doc.purchase_receipt_main, self.doc, self.doclist, "[['Purchase Receipt', 'Payable Voucher'],['Purchase Receipt Detail', 'PV Detail']]") + self.doclist = get_obj('DocType Mapper', 'Purchase Receipt-Payable Voucher').dt_map('Purchase Receipt', 'Payable Voucher', self.doc.purchase_receipt_main, self.doc, self.doclist, "[['Purchase Receipt', 'Payable Voucher'], ['Purchase Receipt Detail', 'PV Detail'], ['Purchase Tax Detail','Purchase Tax Detail']]") elif self.doc.purchase_order_main: self.validate_duplicate_docname('purchase_order') - self.doclist = get_obj('DocType Mapper', 'Purchase Order-Payable Voucher').dt_map('Purchase Order', 'Payable Voucher', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Payable Voucher'],['PO Detail', 'PV Detail']]") + self.doclist = get_obj('DocType Mapper', 'Purchase Order-Payable Voucher').dt_map('Purchase Order', 'Payable Voucher', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Payable Voucher'],['PO Detail', 'PV Detail'], ['Purchase Tax Detail','Purchase Tax Detail']]") ret = self.get_credit_to() - #self.doc.supplier_name = ret['supplier_name'] - #self.doc.supplier_address = ret['supplier_address'] - - #self.doc.cst_no =ret['cst_no'] - #self.doc.bst_no = ret['bst_no'] - #self.doc.vat_tin_no = ret['vat_tin_no'] if ret.has_key('credit_to'): self.doc.credit_to = ret['credit_to'] diff --git a/stock/doctype/purchase_receipt/purchase_receipt.js b/stock/doctype/purchase_receipt/purchase_receipt.js index e060e3c564..1e3d4406ac 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/stock/doctype/purchase_receipt/purchase_receipt.js @@ -78,17 +78,19 @@ cur_frm.fields_dict.contact_person.on_new = function(dn) { locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name; } + // Get Purchase Order Button // ----------------- cur_frm.cscript['Pull Purchase Order Details'] = function(doc, dt, dn) { var callback = function(r,rt) { - unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']); - refresh_many(['supplier','supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email','purchase_receipt_details']); + unhide_field(['supplier_address','contact_person','supplier_name','address_display', 'contact_display', 'contact_mobile','contact_email']); + refresh_many(['supplier','supplier_address','contact_person', 'supplier_name', 'address_display', 'contact_display','contact_mobile', 'contact_email', 'purchase_receipt_details', 'purchase_tax_details']); } - get_server_fields('get_po_details','','',doc, dt, dn,1,callback); + $c_obj(make_doclist(dt,dn),'get_po_details','',callback); } + //================ create new contact ============================================================================ cur_frm.cscript.new_contact = function(){ tn = createLocal('Contact'); From 0801ef24b07b3a5349c249e8b7e6a7e4065664a7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 7 Oct 2011 12:25:34 +0530 Subject: [PATCH 27/30] map schedule date from po to pr --- patches/patch.py | 3 +++ .../Purchase Order-Purchase Receipt.txt | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index a202f81ad9..db5317a601 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -406,6 +406,9 @@ def execute(patch_no): m.doc.save() m.validate() elif patch_no == 375: + from webnotes.session_cache import clear_cache + clear_cache(webnotes.session['user']) + elif patch_no == 376: comp = sql("select name from tabCompany where docstatus!=2") fy = sql("select name from `tabFiscal Year` order by year_start_date asc") for c in comp: diff --git a/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt b/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt index f561c157d9..42eff14c5f 100644 --- a/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt +++ b/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:09:35', 'docstatus': 0, - 'modified': '2011-09-13 17:26:55', + 'modified': '2011-10-07 12:10:26', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -145,6 +145,14 @@ 'to_field': 'amount' }, + # Field Mapper Detail + { + 'doctype': 'Field Mapper Detail', + 'from_field': 'schedule_date', + 'match_id': 1, + 'to_field': 'schedule_date' + }, + # Table Mapper Detail { 'doctype': 'Table Mapper Detail', @@ -178,4 +186,4 @@ 'to_table': 'Purchase Tax Detail', 'validation_logic': 'docstatus = 1' } -] \ No newline at end of file +] From e2904d6afee99b8db9b34559f5f7276249cffd9e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 7 Oct 2011 12:26:41 +0530 Subject: [PATCH 28/30] clear cache forcefully --- patches/patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index db5317a601..cf3bf6dcb4 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 374 +last_patch = 375 #------------------------------------------- From 95409cad784ef23e639dd18bd4bd75c41b4d5bde Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 7 Oct 2011 12:36:43 +0530 Subject: [PATCH 29/30] reload PO-PR mapper --- patches/patch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index cf3bf6dcb4..f1aff7c162 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 375 +last_patch = 376 #------------------------------------------- @@ -408,7 +408,9 @@ def execute(patch_no): elif patch_no == 375: from webnotes.session_cache import clear_cache clear_cache(webnotes.session['user']) - elif patch_no == 376: + elif patch_no == 376: + reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt') + elif patch_no == 377: comp = sql("select name from tabCompany where docstatus!=2") fy = sql("select name from `tabFiscal Year` order by year_start_date asc") for c in comp: From 7b23dbf8470a5ac9587f46e9384fb883b79d9d0d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 7 Oct 2011 19:00:54 +0530 Subject: [PATCH 30/30] patch for page break issue --- patches/patch.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index f1aff7c162..b66b4f0471 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 376 +last_patch = 377 #------------------------------------------- @@ -410,7 +410,16 @@ def execute(patch_no): clear_cache(webnotes.session['user']) elif patch_no == 376: reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt') - elif patch_no == 377: + elif patch_no == 377: + flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] + + st = "'"+"', '".join(flds)+"'" + sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st) + sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st) + + from webnotes.session_cache import clear_cache + clear_cache(webnotes.session['user']) + elif patch_no == 378: comp = sql("select name from tabCompany where docstatus!=2") fy = sql("select name from `tabFiscal Year` order by year_start_date asc") for c in comp: