Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait 2011-07-10 13:50:00 +05:30
commit 025d0620fe
5 changed files with 142 additions and 116 deletions

View File

@ -18,85 +18,92 @@ 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 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 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")
# 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)
# 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 party details
#------------------
def get_party_det(self):
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)
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 = {
'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 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)

View File

@ -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
}

View File

@ -1,7 +1,7 @@
# REMEMBER to update this
# ========================
last_patch = 320
last_patch = 322
#-------------------------------------------
@ -1281,3 +1281,7 @@ 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')
elif patch_no == 322:
sql("delete from `tabDocField` where parent = 'Leave Application' and fieldname = 'latter_head'")

View File

@ -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)
@ -74,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)

View File

@ -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
@ -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")