From fac96e19f592279d47dfd6dc19e00e67deacace2 Mon Sep 17 00:00:00 2001 From: Ravi Dey Date: Fri, 8 Jul 2011 13:38:16 +0530 Subject: [PATCH 1/8] leave_application letter head fix --- .../leave_application/leave_application.txt | 68 ++++++++++--------- patches/patch.py | 4 +- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt index a95f4ce89a..11d01e6ba1 100644 --- a/hr/doctype/leave_application/leave_application.txt +++ b/hr/doctype/leave_application/leave_application.txt @@ -3,16 +3,16 @@ # These values are common in all dictionaries { - 'creation': '2011-02-10 14:10:08', + 'creation': '2011-02-17 13:25:56', 'docstatus': 0, - 'modified': '2011-02-17 13:44:37', + 'modified': '2011-07-08 13:28:15', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1305714022', + '_last_update': '1310019491', 'autoname': 'LAP/.#####', 'colour': 'White:FFF', 'doctype': 'DocType', @@ -24,7 +24,7 @@ 'show_in_menu': 0, 'subject': 'From %(employee_name)s, %(designation)s', 'tag_fields': 'leave_type', - 'version': 18 + 'version': 17 }, # These values are common for all DocField @@ -54,37 +54,24 @@ # DocPerm { - 'amend': 1, - 'cancel': 1, + 'amend': 0, + 'cancel': 0, 'create': 1, 'doctype': 'DocPerm', 'idx': 1, - 'match': 'owner', 'permlevel': 0, - 'submit': 1, + 'role': 'Employee', + 'submit': 0, 'write': 1 }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'idx': 2, - 'match': 'owner', - 'permlevel': 0, - 'submit': 0, - 'write': 0 - }, - # DocPerm { 'amend': 1, 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 3, + 'idx': 2, 'permlevel': 0, 'role': 'HR User', 'submit': 1, @@ -97,7 +84,7 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 4, + 'idx': 3, 'permlevel': 0, 'role': 'HR Manager', 'submit': 1, @@ -106,24 +93,33 @@ # DocPerm { + 'amend': 0, + 'cancel': 0, + 'create': 0, 'doctype': 'DocPerm', - 'idx': 5, + 'idx': 4, 'permlevel': 1, - 'role': 'HR User' + 'role': 'HR User', + 'submit': 0, + 'write': 0 }, # DocPerm { + 'amend': 0, + 'cancel': 0, + 'create': 0, 'doctype': 'DocPerm', - 'idx': 6, + 'idx': 5, 'permlevel': 1, - 'role': 'HR Manager' + 'role': 'HR Manager', + 'submit': 0, + 'write': 0 }, # DocField { 'doctype': 'DocField', - 'fieldname': 'column_break1', 'fieldtype': 'Column Break', 'idx': 1, 'permlevel': 0, @@ -211,7 +207,6 @@ # DocField { 'doctype': 'DocField', - 'fieldname': 'column_break8', 'fieldtype': 'Column Break', 'idx': 8, 'permlevel': 0, @@ -275,12 +270,23 @@ 'width': '300px' }, + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'letter_head', + 'fieldtype': 'Link', + 'idx': 14, + 'label': 'Letter Head', + 'options': 'Letter Head', + 'permlevel': 0 + }, + # DocField { 'doctype': 'DocField', 'fieldname': 'amended_from', 'fieldtype': 'Data', - 'idx': 14, + 'idx': 15, 'label': 'Amended From', 'permlevel': 1 }, @@ -290,7 +296,7 @@ 'doctype': 'DocField', 'fieldname': 'amendment_date', 'fieldtype': 'Date', - 'idx': 15, + 'idx': 16, 'label': 'Amendment Date', 'permlevel': 1 } diff --git a/patches/patch.py b/patches/patch.py index 56004a8317..c66067581c 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 320 +last_patch = 321 #------------------------------------------- @@ -1281,3 +1281,5 @@ def execute(patch_no): sql("delete from tabFeed where doc_name like 'New %'") elif patch_no == 320: reload_doc('setup', 'doctype', 'series_detail') + elif patch_no == 321: + reload_doc('hr','doctype','leave_application') From 8491384946e728a42bf6e52cf410d6da73d6e073 Mon Sep 17 00:00:00 2001 From: Ravi Dey Date: Fri, 8 Jul 2011 13:46:09 +0530 Subject: [PATCH 2/8] latter_head docfield delete --- patches/patch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index c66067581c..87b2f78f10 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 321 +last_patch = 322 #------------------------------------------- @@ -1282,4 +1282,6 @@ def execute(patch_no): elif patch_no == 320: reload_doc('setup', 'doctype', 'series_detail') elif patch_no == 321: - reload_doc('hr','doctype','leave_application') + reload_doc('hr','doctype','leave_application') + elif patch_no == 322: + sql("delete from `tabDocField` where parent = 'Leave Application' and fieldname = 'latter_head'") From 402ebab7dff7a2e361fb652c67909c552187b17f Mon Sep 17 00:00:00 2001 From: Ravi Dey Date: Fri, 8 Jul 2011 15:05:40 +0530 Subject: [PATCH 3/8] form_16a party address pull fix --- accounts/doctype/form_16a/form_16a.py | 166 ++++++++++++++------------ 1 file changed, 87 insertions(+), 79 deletions(-) diff --git a/accounts/doctype/form_16a/form_16a.py b/accounts/doctype/form_16a/form_16a.py index 7d569b70d8..28d38c9779 100644 --- a/accounts/doctype/form_16a/form_16a.py +++ b/accounts/doctype/form_16a/form_16a.py @@ -18,85 +18,93 @@ convert_to_lists = webnotes.conn.convert_to_lists from utilities.transaction_base import TransactionBase class DocType(TransactionBase): - def __init__(self,d,dl): - self.doc, self.doclist = d, dl - - def autoname(self): - self.doc.name = make_autoname('Form 16A' + '/.#####') + def __init__(self,d,dl): + self.doc, self.doclist = d, dl + + def autoname(self): + self.doc.name = make_autoname('Form 16A' + '/.#####') - # Get pan no and tan no from company - #------------------------------------- - def get_registration_details(self): - comp_det=sql("Select address,registration_details from `tabCompany` where name = '%s'"%(self.doc.company)) - if not comp_det: - msgprint("Registration Details is not mentioned in comapny") - ret = { - 'company_address':'', - 'registration_details': '' - } - else: - ret = { - 'company_address': cstr(comp_det[0][0]), - 'registration_details': cstr(comp_det[0][1]) - } - return cstr(ret) + # Get pan no and tan no from company + #------------------------------------- + def get_registration_details(self): + comp_det=sql("Select address,registration_details from `tabCompany` where name = '%s'"%(self.doc.company)) + if not comp_det: + msgprint("Registration Details is not mentioned in comapny") + ret = { + 'company_address':'', + 'registration_details': '' + } + else: + ret = { + 'company_address': cstr(comp_det[0][0]), + 'registration_details': cstr(comp_det[0][1]) + } + return cstr(ret) - # Get party details - #------------------ - def get_party_det(self): - party_det=sql("Select pan_number, address from `tabAccount` where name = '%s'" % self.doc.party_name) - ret = { - 'pan_number': cstr(party_det[0][0]) , - 'party_address': cstr(party_det[0][1]) - } - return cstr(ret) + # Get party details + #------------------ + def get_party_det(self): + party_det=sql("select master_type, master_name, pan_number from `tabAccount` where name='%s'" % self.doc.party_name) + if party_det and party_det[0][0]=='Supplier': + try: + rec = sql("select name, address_line1, address_line2, city, country, pincode, state from `tabAddress` where supplier = '%s' and docstatus != 2 order by is_primary_address desc limit 1" %(party_det[0][1]), as_dict = 1) + address_display = cstr((rec[0]['address_line1'] and rec[0]['address_line1'] or '')) + cstr((rec[0]['address_line2'] and '\n' + rec[0]['address_line2'] or '')) + cstr((rec[0]['city'] and '\n'+rec[0]['city'] or '')) + cstr((rec[0]['pincode'] and '\n' + rec[0]['pincode'] or '')) + cstr((rec[0]['state'] and '\n'+rec[0]['state'] or '')) + cstr((rec[0]['country'] and '\n'+rec[0]['country'] or '')) + except: + address_display = '' + + ret = { + 'pan_number': cstr(party_det[0][2]) , + 'party_address': cstr(address_display) + } + + return cstr(ret) + + # Get TDS Return acknowledgement + #------------------------------- + def get_return_ack_details(self): + self.doc.clear_table(self.doclist, 'form_16A_ack_details') + if not (self.doc.from_date and self.doc.to_date): + msgprint("Please enter From Date, To Date") + else: + ack = sql("select quarter, acknowledgement_no from `tabTDS Return Acknowledgement` where date_of_receipt>='%s' and date_of_receipt<='%s' and tds_category = '%s' order by date_of_receipt ASC" % (self.doc.from_date, self.doc.to_date, self.doc.tds_category)) + for d in ack: + ch = addchild(self.doc, 'form_16A_ack_details', 'Form 16A Ack Detail', 1, self.doclist) + ch.quarter = d[0] + ch.ack_no = d[1] - # Get TDS Return acknowledgement - #------------------------------- - def get_return_ack_details(self): - self.doc.clear_table(self.doclist, 'form_16A_ack_details') - if not (self.doc.from_date and self.doc.to_date): - msgprint("Please enter From Date, To Date") - else: - ack = sql("select quarter, acknowledgement_no from `tabTDS Return Acknowledgement` where date_of_receipt>='%s' and date_of_receipt<='%s' and tds_category = '%s' order by date_of_receipt ASC" % (self.doc.from_date, self.doc.to_date, self.doc.tds_category)) - for d in ack: - ch = addchild(self.doc, 'form_16A_ack_details', 'Form 16A Ack Detail', 1, self.doclist) - ch.quarter = d[0] - ch.ack_no = d[1] - - # Get tds payment details - #------------------------------- - def get_tds(self): - self.doc.clear_table(self.doclist,'form_16A_tax_details') - import datetime - if self.doc.from_date and self.doc.to_date and self.doc.tds_category: - tot=0.0 - party_tds_list=sql("select t2.amount_paid,t2.date_of_payment,t2.tds_amount,t2.cess_on_tds, t2.total_tax_amount, t1.cheque_no, t1.bsr_code, t1.date_of_receipt, t1.challan_id from `tabTDS Payment` t1, `tabTDS Payment Detail` t2 where t1.tds_category='%s' and t2.party_name='%s' and t1.from_date >= '%s' and t1.to_date <= '%s' and t2.total_tax_amount>0 and t2.parent=t1.name and t1.docstatus=1" % (self.doc.tds_category,self.doc.party_name,self.doc.from_date,self.doc.to_date)) - for s in party_tds_list: - child = addchild(self.doc, 'form_16A_tax_details', 'Form 16A Tax Detail', 1, self.doclist) - child.amount_paid = s and flt(s[0]) or '' - child.date_of_payment =s and s[1].strftime('%Y-%m-%d') or '' - child.tds_main = s and flt(s[2]) or '' - child.surcharge = 0 - child.cess_on_tds = s and flt(s[3]) or '' - child.total_tax_deposited = s and flt(s[4]) or '' - child.cheque_no = s and s[5] or '' - child.bsr_code = s and s[6] or '' - child.tax_deposited_date = s and s[7].strftime('%Y-%m-%d') or '' - child.challan_no = s and s[8] or '' - tot=flt(tot)+flt(s[4]) - self.doc.total_amount = flt(tot) - else: - msgprint("Plaese enter from date, to date and TDS category") - - - # validate - #---------------- - def validate(self): - tot=0.0 - for d in getlist(self.doclist,'form_16A_tax_details'): - tot=flt(tot)+flt(d.total_tax_deposited) - - dcc = TransactionBase().get_company_currency(self.doc.company) - self.doc.total_amount = flt(tot) - self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.total_amount) + # Get tds payment details + #------------------------------- + def get_tds(self): + self.doc.clear_table(self.doclist,'form_16A_tax_details') + import datetime + if self.doc.from_date and self.doc.to_date and self.doc.tds_category: + tot=0.0 + party_tds_list=sql("select t2.amount_paid,t2.date_of_payment,t2.tds_amount,t2.cess_on_tds, t2.total_tax_amount, t1.cheque_no, t1.bsr_code, t1.date_of_receipt, t1.challan_id from `tabTDS Payment` t1, `tabTDS Payment Detail` t2 where t1.tds_category='%s' and t2.party_name='%s' and t1.from_date >= '%s' and t1.to_date <= '%s' and t2.total_tax_amount>0 and t2.parent=t1.name and t1.docstatus=1" % (self.doc.tds_category,self.doc.party_name,self.doc.from_date,self.doc.to_date)) + for s in party_tds_list: + child = addchild(self.doc, 'form_16A_tax_details', 'Form 16A Tax Detail', 1, self.doclist) + child.amount_paid = s and flt(s[0]) or '' + child.date_of_payment =s and s[1].strftime('%Y-%m-%d') or '' + child.tds_main = s and flt(s[2]) or '' + child.surcharge = 0 + child.cess_on_tds = s and flt(s[3]) or '' + child.total_tax_deposited = s and flt(s[4]) or '' + child.cheque_no = s and s[5] or '' + child.bsr_code = s and s[6] or '' + child.tax_deposited_date = s and s[7].strftime('%Y-%m-%d') or '' + child.challan_no = s and s[8] or '' + tot=flt(tot)+flt(s[4]) + self.doc.total_amount = flt(tot) + else: + msgprint("Plaese enter from date, to date and TDS category") + + + # validate + #---------------- + def validate(self): + tot=0.0 + for d in getlist(self.doclist,'form_16A_tax_details'): + tot=flt(tot)+flt(d.total_tax_deposited) + + dcc = TransactionBase().get_company_currency(self.doc.company) + self.doc.total_amount = flt(tot) + self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.total_amount) From b6e2488847d219caedd0c43042aeac4140a671ec Mon Sep 17 00:00:00 2001 From: Ravi Dey Date: Fri, 8 Jul 2011 15:33:18 +0530 Subject: [PATCH 4/8] party_address fix --- accounts/doctype/form_16a/form_16a.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/accounts/doctype/form_16a/form_16a.py b/accounts/doctype/form_16a/form_16a.py index 28d38c9779..292c52a2da 100644 --- a/accounts/doctype/form_16a/form_16a.py +++ b/accounts/doctype/form_16a/form_16a.py @@ -39,12 +39,12 @@ class DocType(TransactionBase): 'company_address': cstr(comp_det[0][0]), 'registration_details': cstr(comp_det[0][1]) } - return cstr(ret) - + return cstr(ret) + # Get party details #------------------ def get_party_det(self): - party_det=sql("select master_type, master_name, pan_number from `tabAccount` where name='%s'" % self.doc.party_name) + party_det=sql("select master_type, master_name from `tabAccount` where name='%s'" % self.doc.party_name) if party_det and party_det[0][0]=='Supplier': try: rec = sql("select name, address_line1, address_line2, city, country, pincode, state from `tabAddress` where supplier = '%s' and docstatus != 2 order by is_primary_address desc limit 1" %(party_det[0][1]), as_dict = 1) @@ -53,7 +53,6 @@ class DocType(TransactionBase): address_display = '' ret = { - 'pan_number': cstr(party_det[0][2]) , 'party_address': cstr(address_display) } From 7b18b6c8f84c7d229b45958bc934d8cb919caf72 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 8 Jul 2011 16:12:19 +0530 Subject: [PATCH 5/8] Resolved issue of default currency not getting assigned to first company through setup_control --- setup/doctype/setup_control/setup_control.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py index 7cbf4d32fb..65ac094167 100644 --- a/setup/doctype/setup_control/setup_control.py +++ b/setup/doctype/setup_control/setup_control.py @@ -58,7 +58,8 @@ class DocType: # Company master_dict = {'Company':{'company_name':company_name, - 'abbr':comp_abbr + 'abbr':comp_abbr, + 'default_currency':currency }} self.create_records(master_dict) From cb54a24ead357c3dbd576106224d8e69ea137797 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 8 Jul 2011 16:25:01 +0530 Subject: [PATCH 6/8] Implemented auto setting of default currency format in global defaults depending on currency after initial setup --- setup/doctype/setup_control/setup_control.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py index 65ac094167..1b30660a82 100644 --- a/setup/doctype/setup_control/setup_control.py +++ b/setup/doctype/setup_control/setup_control.py @@ -75,7 +75,9 @@ class DocType: 'pr_required':'No', 'emp_created_by':'Naming Series', 'cust_master_name':'Customer Name', - 'supp_master_name':'Supplier Name'} + 'supp_master_name':'Supplier Name', + 'default_currency_format': (currency=='INR') and 'Lacs' or 'Millions' + } # Set self.set_defaults(def_args) From 28717a82d0f70efe3c6b96a3f01b3fce48ed592e Mon Sep 17 00:00:00 2001 From: Ravi Dey Date: Fri, 8 Jul 2011 17:00:43 +0530 Subject: [PATCH 7/8] support ticket auto close --- support/doctype/support_ticket/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/support/doctype/support_ticket/__init__.py b/support/doctype/support_ticket/__init__.py index 959a751d47..931bb94f53 100644 --- a/support/doctype/support_ticket/__init__.py +++ b/support/doctype/support_ticket/__init__.py @@ -54,7 +54,7 @@ class SupportMailbox(POP3Mailbox): d.save(1) # update feed - update_feed(d) + update_feed(d) def get_support_mails(): @@ -62,3 +62,9 @@ def get_support_mails(): Gets new emails from support inbox and updates / creates Support Ticket records """ SupportMailbox().get_messages() + +def auto_close_tickets(): + """ + Auto Closes Waiting for Customer Support Ticket after 15 days + """ + webnotes.conn.sql("update `tabSupport Ticket` set status = 'Closed' where status = 'Waiting for Customer' and date_sub(curdate(),interval 15 Day) > modified") From c8d0747d93de4219383d5b1289f1b23b51e918fb Mon Sep 17 00:00:00 2001 From: Ravi Dey Date: Fri, 8 Jul 2011 18:07:19 +0530 Subject: [PATCH 8/8] Support Ticket: To Reply to Open --- support/doctype/support_ticket/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/doctype/support_ticket/__init__.py b/support/doctype/support_ticket/__init__.py index 931bb94f53..0ca33ec0b9 100644 --- a/support/doctype/support_ticket/__init__.py +++ b/support/doctype/support_ticket/__init__.py @@ -35,7 +35,7 @@ class SupportMailbox(POP3Mailbox): st = get_obj('Support Ticket', thread_id) st.make_response_record(content, mail.mail['From'], content_type) - webnotes.conn.set(st.doc, 'status', 'To Reply') + webnotes.conn.set(st.doc, 'status', 'Open') update_feed(st.doc) return