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

This commit is contained in:
Anand Doshi 2012-09-28 16:06:45 +05:30
commit 9912d0e5e6
4 changed files with 38 additions and 73 deletions

View File

@ -3,11 +3,11 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-07-03 13:30:49', u'creation': '2012-09-18 11:20:24',
'docstatus': 0, u'docstatus': 0,
'modified': '2012-07-12 14:08:27', u'modified': '2012-09-28 12:27:43',
'modified_by': u'Administrator', u'modified_by': u'Administrator',
'owner': u'wasim@webnotestech.com' u'owner': u'wasim@webnotestech.com'
}, },
# These values are common for all DocType # These values are common for all DocType
@ -16,11 +16,11 @@
'autoname': u'PVTD.######', 'autoname': u'PVTD.######',
'colour': u'White:FFF', 'colour': u'White:FFF',
'default_print_format': u'Standard', 'default_print_format': u'Standard',
'doctype': 'DocType', u'doctype': u'DocType',
'hide_heading': 1, 'hide_heading': 1,
'istable': 1, 'istable': 1,
'module': u'Accounts', 'module': u'Accounts',
'name': '__common__', u'name': u'__common__',
'section_style': u'Tray', 'section_style': u'Tray',
'server_code_error': u' ', 'server_code_error': u' ',
'show_in_menu': 0, 'show_in_menu': 0,
@ -29,8 +29,8 @@
# These values are common for all DocField # These values are common for all DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'name': '__common__', u'name': u'__common__',
'parent': u'Purchase Taxes and Charges', 'parent': u'Purchase Taxes and Charges',
'parentfield': u'fields', 'parentfield': u'fields',
'parenttype': u'DocType' 'parenttype': u'DocType'
@ -38,13 +38,13 @@
# DocType, Purchase Taxes and Charges # DocType, Purchase Taxes and Charges
{ {
'doctype': 'DocType', u'doctype': u'DocType',
'name': u'Purchase Taxes and Charges' u'name': u'Purchase Taxes and Charges'
}, },
# DocField # DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'charge_type', 'fieldname': u'charge_type',
'fieldtype': u'Select', 'fieldtype': u'Select',
'label': u'Type', 'label': u'Type',
@ -58,7 +58,7 @@
# DocField # DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'account_head', 'fieldname': u'account_head',
'fieldtype': u'Link', 'fieldtype': u'Link',
'label': u'Account Head', 'label': u'Account Head',
@ -72,7 +72,7 @@
# DocField # DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'cost_center', 'fieldname': u'cost_center',
'fieldtype': u'Link', 'fieldtype': u'Link',
'label': u'Cost Center', 'label': u'Cost Center',
@ -85,7 +85,7 @@
# DocField # DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'description', 'fieldname': u'description',
'fieldtype': u'Small Text', 'fieldtype': u'Small Text',
'label': u'Description', 'label': u'Description',
@ -98,7 +98,7 @@
# DocField # DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'rate', 'fieldname': u'rate',
'fieldtype': u'Currency', 'fieldtype': u'Currency',
'label': u'Rate', 'label': u'Rate',
@ -111,7 +111,7 @@
# DocField # DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'tax_amount', 'fieldname': u'tax_amount',
'fieldtype': u'Currency', 'fieldtype': u'Currency',
'label': u'Amount', 'label': u'Amount',
@ -124,7 +124,7 @@
# DocField # DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'total', 'fieldname': u'total',
'fieldtype': u'Currency', 'fieldtype': u'Currency',
'label': u'Total', 'label': u'Total',
@ -135,7 +135,7 @@
# DocField # DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'row_id', 'fieldname': u'row_id',
'fieldtype': u'Data', 'fieldtype': u'Data',
'hidden': 0, 'hidden': 0,
@ -149,8 +149,8 @@
# DocField # DocField
{ {
'colour': u'White:FFF', 'colour': u'White:FFF',
'description': u'For Both', 'default': u'Valuation and Total',
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'category', 'fieldname': u'category',
'fieldtype': u'Select', 'fieldtype': u'Select',
'label': u'Consider Tax or Charge for', 'label': u'Consider Tax or Charge for',
@ -165,7 +165,7 @@
{ {
'colour': u'White:FFF', 'colour': u'White:FFF',
'default': u'Add', 'default': u'Add',
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'add_deduct_tax', 'fieldname': u'add_deduct_tax',
'fieldtype': u'Select', 'fieldtype': u'Select',
'label': u'Add or Deduct', 'label': u'Add or Deduct',
@ -180,7 +180,7 @@
# DocField # DocField
{ {
'colour': u'White:FFF', 'colour': u'White:FFF',
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'item_wise_tax_detail', 'fieldname': u'item_wise_tax_detail',
'fieldtype': u'Small Text', 'fieldtype': u'Small Text',
'hidden': 1, 'hidden': 1,
@ -193,7 +193,7 @@
# DocField # DocField
{ {
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'parenttype', 'fieldname': u'parenttype',
'fieldtype': u'Data', 'fieldtype': u'Data',
'hidden': 1, 'hidden': 1,
@ -209,7 +209,7 @@
# DocField # DocField
{ {
'description': u'Cheating Field\nPlease do not delete ', 'description': u'Cheating Field\nPlease do not delete ',
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'total_tax_amount', 'fieldname': u'total_tax_amount',
'fieldtype': u'Currency', 'fieldtype': u'Currency',
'hidden': 1, 'hidden': 1,
@ -225,7 +225,7 @@
# DocField # DocField
{ {
'description': u'Cheating Field\nPlease do not delete ', 'description': u'Cheating Field\nPlease do not delete ',
'doctype': u'DocField', u'doctype': u'DocField',
'fieldname': u'total_amount', 'fieldname': u'total_amount',
'fieldtype': u'Currency', 'fieldtype': u'Currency',
'hidden': 1, 'hidden': 1,

View File

@ -30,10 +30,7 @@ def execute():
fy_obj = get_obj('Fiscal Year', f[0]) fy_obj = get_obj('Fiscal Year', f[0])
fy_obj.doc.past_year = prev_fy fy_obj.doc.past_year = prev_fy
fy_obj.doc.company = c[0] fy_obj.doc.company = c[0]
fy_obj.doc.save()
fy_obj = get_obj('Fiscal Year', f[0])
fy_obj.repost() fy_obj.repost()
prev_fy = f[0] prev_fy = f[0]
sql("commit") webnotes.conn.commit()
sql("start transaction") webnotes.conn.begin()

View File

@ -83,7 +83,7 @@ class DocType:
def on_update(self): def on_update(self):
if self.doc.contact_by: if self.doc.contact_date:
self.add_calendar_event() self.add_calendar_event()
if not self.doc.naming_series: if not self.doc.naming_series:
@ -104,44 +104,19 @@ class DocType:
# delete any earlier event by this lead # delete any earlier event by this lead
sql("delete from tabEvent where ref_type='Lead' and ref_name=%s", self.doc.name) sql("delete from tabEvent where ref_type='Lead' and ref_name=%s", self.doc.name)
in_calendar_of = self.doc.lead_owner # create new event
# get profile (id) if exists for contact_by
email_id = webnotes.conn.get_value('Sales Person', self.doc.contact_by, 'email_id')
if webnotes.conn.exists('Profile', email_id):
in_calendar_of = email_id
ev = Document('Event') ev = Document('Event')
ev.owner = in_calendar_of ev.owner = self.doc.lead_owner
ev.description = 'Contact ' + cstr(self.doc.lead_name) + '.By : ' + cstr(self.doc.contact_by) + '.To Discuss : ' + cstr(self.doc.remark) ev.description = ('Contact ' + cstr(self.doc.lead_name)) + \
(self.doc.contact_by and ('. By : ' + cstr(self.doc.contact_by)) or '') + \
(self.doc.remark and ('.To Discuss : ' + cstr(self.doc.remark)) or '')
ev.event_date = self.doc.contact_date ev.event_date = self.doc.contact_date
ev.event_hour = '10:00' ev.event_hour = '10:00'
ev.event_type = 'Private' ev.event_type = 'Private'
ev.ref_type = 'Lead' ev.ref_type = 'Lead'
ev.ref_name = self.doc.name ev.ref_name = self.doc.name
ev.save(1) ev.save(1)
def add_in_follow_up(self,message,type):
import datetime
child = addchild( self.doc, 'follow_up', 'Communication Log', 1, self.doclist)
child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
child.notes = message
child.follow_up_type = type
child.save()
#-------------------SMS----------------------------------------------
def send_sms(self):
if not self.doc.sms_message or not self.doc.mobile_no:
msgprint("Please enter mobile number in Basic Info Section and message in SMS Section ")
raise Exception
else:
receiver_list = []
if self.doc.mobile_no:
receiver_list.append(self.doc.mobile_no)
for d in getlist(self.doclist,'lead_sms_detail'):
if d.other_mobile_no:
receiver_list.append(d.other_mobile_no)
if receiver_list: event_user = addchild(ev, 'event_individuals', 'Event User')
msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message)) event_user.person = self.doc.contact_by
# self.add_in_follow_up(self.doc.sms_message,'SMS') event_user.save()

View File

@ -42,14 +42,7 @@ keydict = {
class DocType: class DocType:
def __init__(self, d, dl): def __init__(self, d, dl):
self.doc, self.doclist = d, dl self.doc, self.doclist = d, dl
def get_bal(self,arg):
"""get account balance (??)"""
from webnotes.utils import fmt_money, flt
bal = webnotes.conn.sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
if bal:
return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
def on_update(self): def on_update(self):
"""update defaults""" """update defaults"""