version
This commit is contained in:
commit
bc5ec4f19e
@ -505,9 +505,9 @@ def manage_recurring_invoices():
|
|||||||
and notify the concerned people
|
and notify the concerned people
|
||||||
"""
|
"""
|
||||||
rv = webnotes.conn.sql("""select name, recurring_id from `tabReceivable Voucher` where ifnull(convert_into_recurring_invoice, 0) = 1
|
rv = webnotes.conn.sql("""select name, recurring_id from `tabReceivable Voucher` where ifnull(convert_into_recurring_invoice, 0) = 1
|
||||||
and next_date = %s and next_date <= end_date order by next_date desc""", nowdate())
|
and next_date = %s and next_date <= end_date and docstatus=1 order by next_date desc""", nowdate())
|
||||||
for d in rv:
|
for d in rv:
|
||||||
if not webnotes.conn.sql("""select name from `tabReceivable Voucher` where posting_date = %s and recurring_id = %s""", (nowdate(), d[1])):
|
if not webnotes.conn.sql("""select name from `tabReceivable Voucher` where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
|
||||||
prev_rv = get_obj('Receivable Voucher', d[0], with_children=1)
|
prev_rv = get_obj('Receivable Voucher', d[0], with_children=1)
|
||||||
new_rv = create_new_invoice(prev_rv)
|
new_rv = create_new_invoice(prev_rv)
|
||||||
|
|
||||||
@ -524,6 +524,7 @@ def create_new_invoice(prev_rv):
|
|||||||
new_rv.doc.posting_date = new_rv.doc.next_date
|
new_rv.doc.posting_date = new_rv.doc.next_date
|
||||||
new_rv.doc.aging_date = new_rv.doc.next_date
|
new_rv.doc.aging_date = new_rv.doc.next_date
|
||||||
new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
|
new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
|
||||||
|
new_rv.doc.owner = prev_rv.doc.owner
|
||||||
new_rv.doc.save()
|
new_rv.doc.save()
|
||||||
|
|
||||||
# submit and after submit
|
# submit and after submit
|
||||||
@ -588,5 +589,5 @@ def send_notification(new_rv):
|
|||||||
|
|
||||||
msg = hd + tbl + totals
|
msg = hd + tbl + totals
|
||||||
from webnotes.utils.email_lib import sendmail
|
from webnotes.utils.email_lib import sendmail
|
||||||
sendmail(recipients = [new_rv.doc.email_notification_address], \
|
sendmail(recipients = new_rv.doc.notification_email_address.split(", "), \
|
||||||
sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]])
|
sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]])
|
||||||
|
@ -439,7 +439,7 @@ cur_frm.cscript['View Ledger Entry'] = function(){
|
|||||||
cur_frm.cscript.convert_into_recurring_invoice = function(doc) {
|
cur_frm.cscript.convert_into_recurring_invoice = function(doc) {
|
||||||
if (doc.convert_into_recurring_invoice) {
|
if (doc.convert_into_recurring_invoice) {
|
||||||
doc.repeat_on_day_of_month = doc.posting_date.split('-')[2];
|
doc.repeat_on_day_of_month = doc.posting_date.split('-')[2];
|
||||||
doc.notification_email_address = doc.owner + ', ' + doc.contact_email;
|
doc.notification_email_address = [doc.owner, doc.contact_email].join(', ');
|
||||||
refresh_field(['repeat_on_day_of_month', 'notification_email_address']);
|
refresh_field(['repeat_on_day_of_month', 'notification_email_address']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,8 +158,7 @@ class DocType:
|
|||||||
('Payable Voucher', 'supplier'),
|
('Payable Voucher', 'supplier'),
|
||||||
('Purchase Order', 'supplier'),
|
('Purchase Order', 'supplier'),
|
||||||
('Purchase Receipt', 'supplier'),
|
('Purchase Receipt', 'supplier'),
|
||||||
('Serial No', 'supplier'),
|
('Serial No', 'supplier')]
|
||||||
('Supplier Quotation', 'supplier')]
|
|
||||||
for rec in update_fields:
|
for rec in update_fields:
|
||||||
sql("update `tab%s` set supplier_name = '%s' where %s = '%s'" %(rec[0],newdn,rec[1],olddn))
|
sql("update `tab%s` set supplier_name = '%s' where %s = '%s'" %(rec[0],newdn,rec[1],olddn))
|
||||||
|
|
||||||
|
@ -105,9 +105,10 @@ def send_welcome_mail(email, args):
|
|||||||
from webnotes.utils.email_lib import sendmail_md
|
from webnotes.utils.email_lib import sendmail_md
|
||||||
args.update({
|
args.update({
|
||||||
'company': webnotes.conn.get_default('company'),
|
'company': webnotes.conn.get_default('company'),
|
||||||
'password': password,
|
'password': args.get('password'),
|
||||||
'account_url': webnotes.conn.get_default('account_url')
|
'account_url': webnotes.conn.get_default('account_url')
|
||||||
})
|
})
|
||||||
|
if not args.get('last_name'): args['last_name'] = ''
|
||||||
sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args)
|
sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args)
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -188,7 +189,7 @@ Welcome!
|
|||||||
|
|
||||||
A new account has been created for you, here are your details:
|
A new account has been created for you, here are your details:
|
||||||
|
|
||||||
login-id: %(name)s
|
login-id: %(user)s
|
||||||
password: %(password)s
|
password: %(password)s
|
||||||
|
|
||||||
To login to your new ERPNext account, please go to:
|
To login to your new ERPNext account, please go to:
|
||||||
|
13
erpnext/patches/jan_mar_2012/email_settings_reload.py
Normal file
13
erpnext/patches/jan_mar_2012/email_settings_reload.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
def execute():
|
||||||
|
"""
|
||||||
|
* Change type of mail_port field to int
|
||||||
|
* reload email settings
|
||||||
|
"""
|
||||||
|
import webnotes
|
||||||
|
webnotes.conn.sql("""
|
||||||
|
UPDATE `tabDocField` SET fieldtype='Int'
|
||||||
|
WHERE parent = 'Email Settings' AND fieldname = 'mail_port'
|
||||||
|
""")
|
||||||
|
|
||||||
|
from webnotes.modules.module_manager import reload_doc
|
||||||
|
reload_doc('setup', 'doctype', 'email_settings')
|
@ -45,4 +45,9 @@ patch_list = [
|
|||||||
'patch_file': 'doclabel_in_doclayer',
|
'patch_file': 'doclabel_in_doclayer',
|
||||||
'description': "Show DocType Labels instead of DocType names in Customize Form View"
|
'description': "Show DocType Labels instead of DocType names in Customize Form View"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.jan_mar_2012',
|
||||||
|
'patch_file': 'email_settings_reload',
|
||||||
|
'description': "Change type of mail_port field to Int and reload email_settings doctype"
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
@ -22,6 +22,82 @@ class DocType:
|
|||||||
if self.doc.fields.get(key):
|
if self.doc.fields.get(key):
|
||||||
webnotes.conn.set_value('Control Panel', None, key, self.doc.fields[key])
|
webnotes.conn.set_value('Control Panel', None, key, self.doc.fields[key])
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
"""
|
||||||
|
Checks connectivity to email servers before saving
|
||||||
|
"""
|
||||||
|
self.validate_outgoing()
|
||||||
|
self.validate_incoming()
|
||||||
|
|
||||||
|
|
||||||
|
def validate_outgoing(self):
|
||||||
|
"""
|
||||||
|
Checks incoming email settings
|
||||||
|
"""
|
||||||
|
if self.doc.outgoing_mail_server:
|
||||||
|
from webnotes.utils import cint
|
||||||
|
import _socket
|
||||||
|
from webnotes.utils.email_lib.send import EMail
|
||||||
|
out_email = EMail()
|
||||||
|
out_email.server = self.doc.outgoing_mail_server.encode('utf-8')
|
||||||
|
out_email.port = cint(self.doc.mail_port)
|
||||||
|
out_email.use_ssl = self.doc.use_ssl
|
||||||
|
try:
|
||||||
|
out_email.login = self.doc.mail_login.encode('utf-8')
|
||||||
|
out_email.password = self.doc.mail_password.encode('utf-8')
|
||||||
|
except AttributeError, e:
|
||||||
|
webnotes.msgprint('Login Id or Mail Password missing. Please enter and try again.')
|
||||||
|
webnotes.msgprint(e)
|
||||||
|
|
||||||
|
try:
|
||||||
|
sess = out_email.smtp_connect()
|
||||||
|
try:
|
||||||
|
sess.quit()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except _socket.error, e:
|
||||||
|
# Invalid mail server -- due to refusing connection
|
||||||
|
webnotes.msgprint('Invalid Outgoing Mail Server. Please rectify and try again.')
|
||||||
|
webnotes.msgprint(e)
|
||||||
|
except smtplib.SMTPAuthenticationError, e:
|
||||||
|
webnotes.msgprint('Invalid Login Id or Mail Password. Please rectify and try again.')
|
||||||
|
except smtplib.SMTPException, e:
|
||||||
|
webnotes.msgprint('There is something wrong with your Outgoing Mail Settings. \
|
||||||
|
Please contact us at support@erpnext.com')
|
||||||
|
webnotes.msgprint(e)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_incoming(self):
|
||||||
|
"""
|
||||||
|
Checks support ticket email settings
|
||||||
|
"""
|
||||||
|
if self.doc.sync_support_mails and self.doc.support_host:
|
||||||
|
from webnotes.utils.email_lib.receive import POP3Mailbox
|
||||||
|
from webnotes.model.doc import Document
|
||||||
|
import _socket, poplib
|
||||||
|
inc_email = Document('Incoming Email Settings')
|
||||||
|
inc_email.host = self.doc.support_host.encode('utf-8')
|
||||||
|
inc_email.use_ssl = self.doc.support_use_ssl
|
||||||
|
try:
|
||||||
|
inc_email.username = self.doc.support_username.encode('utf-8')
|
||||||
|
inc_email.password = self.doc.support_password.encode('utf-8')
|
||||||
|
except AttributeError, e:
|
||||||
|
webnotes.msgprint('User Name or Support Password missing. Please enter and try again.')
|
||||||
|
webnotes.msgprint(e)
|
||||||
|
|
||||||
|
pop_mb = POP3Mailbox(inc_email)
|
||||||
|
|
||||||
|
try:
|
||||||
|
pop_mb.connect()
|
||||||
|
except _socket.error, e:
|
||||||
|
# Invalid mail server -- due to refusing connection
|
||||||
|
webnotes.msgprint('Invalid POP3 Mail Server. Please rectify and try again.')
|
||||||
|
webnotes.msgprint(e)
|
||||||
|
except poplib.error_proto, e:
|
||||||
|
webnotes.msgprint('Invalid User Name or Support Password. Please rectify and try again.')
|
||||||
|
webnotes.msgprint(e)
|
||||||
|
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
"""
|
"""
|
||||||
Sets or cancels the event in the scheduler
|
Sets or cancels the event in the scheduler
|
||||||
|
@ -5,18 +5,19 @@
|
|||||||
{
|
{
|
||||||
'creation': '2010-08-08 17:08:59',
|
'creation': '2010-08-08 17:08:59',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2011-07-25 15:03:51',
|
'modified': '2012-01-25 18:44:45',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'owner': 'harshada@webnotestech.com'
|
'owner': 'harshada@webnotestech.com'
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocType
|
# These values are common for all DocType
|
||||||
{
|
{
|
||||||
'_last_update': '1311586371',
|
'_last_update': '1325570647',
|
||||||
'allow_copy': 1,
|
'allow_copy': 1,
|
||||||
'allow_email': 1,
|
'allow_email': 1,
|
||||||
'allow_print': 1,
|
'allow_print': 1,
|
||||||
'colour': 'White:FFF',
|
'colour': 'White:FFF',
|
||||||
|
'default_print_format': 'Standard',
|
||||||
'doctype': 'DocType',
|
'doctype': 'DocType',
|
||||||
'in_create': 1,
|
'in_create': 1,
|
||||||
'issingle': 1,
|
'issingle': 1,
|
||||||
@ -24,7 +25,7 @@
|
|||||||
'name': '__common__',
|
'name': '__common__',
|
||||||
'section_style': 'Simple',
|
'section_style': 'Simple',
|
||||||
'server_code_error': ' ',
|
'server_code_error': ' ',
|
||||||
'version': 34
|
'version': 35
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocField
|
# These values are common for all DocField
|
||||||
@ -59,21 +60,18 @@
|
|||||||
|
|
||||||
# DocPerm
|
# DocPerm
|
||||||
{
|
{
|
||||||
'doctype': 'DocPerm',
|
'doctype': 'DocPerm'
|
||||||
'idx': 1
|
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocPerm
|
# DocPerm
|
||||||
{
|
{
|
||||||
'doctype': 'DocPerm',
|
'doctype': 'DocPerm'
|
||||||
'idx': 2
|
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldtype': 'Section Break',
|
'fieldtype': 'Section Break',
|
||||||
'idx': 1,
|
|
||||||
'label': 'Outgoing Mails'
|
'label': 'Outgoing Mails'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -81,7 +79,6 @@
|
|||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldtype': 'HTML',
|
'fieldtype': 'HTML',
|
||||||
'idx': 2,
|
|
||||||
'label': '1',
|
'label': '1',
|
||||||
'options': '<div class="help_box">Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server</div>'
|
'options': '<div class="help_box">Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server</div>'
|
||||||
},
|
},
|
||||||
@ -91,7 +88,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'outgoing_mail_server',
|
'fieldname': 'outgoing_mail_server',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Data',
|
||||||
'idx': 3,
|
|
||||||
'label': 'Outgoing Mail Server'
|
'label': 'Outgoing Mail Server'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -99,8 +95,7 @@
|
|||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'mail_port',
|
'fieldname': 'mail_port',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Int',
|
||||||
'idx': 4,
|
|
||||||
'label': 'Mail Port'
|
'label': 'Mail Port'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -109,7 +104,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'use_ssl',
|
'fieldname': 'use_ssl',
|
||||||
'fieldtype': 'Check',
|
'fieldtype': 'Check',
|
||||||
'idx': 5,
|
|
||||||
'label': 'Use SSL'
|
'label': 'Use SSL'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -118,7 +112,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'mail_login',
|
'fieldname': 'mail_login',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Data',
|
||||||
'idx': 6,
|
|
||||||
'label': 'Login Id'
|
'label': 'Login Id'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -127,7 +120,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'mail_password',
|
'fieldname': 'mail_password',
|
||||||
'fieldtype': 'Password',
|
'fieldtype': 'Password',
|
||||||
'idx': 7,
|
|
||||||
'label': 'Mail Password'
|
'label': 'Mail Password'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -136,7 +128,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'auto_email_id',
|
'fieldname': 'auto_email_id',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Data',
|
||||||
'idx': 8,
|
|
||||||
'label': 'Auto Email Id'
|
'label': 'Auto Email Id'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -145,7 +136,6 @@
|
|||||||
'description': 'Set the POP3 email settings to pull emails directly from a mailbox and create Support Tickets',
|
'description': 'Set the POP3 email settings to pull emails directly from a mailbox and create Support Tickets',
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldtype': 'Section Break',
|
'fieldtype': 'Section Break',
|
||||||
'idx': 9,
|
|
||||||
'label': 'Support Ticket Mail Settings'
|
'label': 'Support Ticket Mail Settings'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -153,7 +143,6 @@
|
|||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldtype': 'HTML',
|
'fieldtype': 'HTML',
|
||||||
'idx': 10,
|
|
||||||
'label': '2',
|
'label': '2',
|
||||||
'options': '<div class="help_box">To automatically create Support Tickets from your incoming mail, set your pop3 settings here.</div>'
|
'options': '<div class="help_box">To automatically create Support Tickets from your incoming mail, set your pop3 settings here.</div>'
|
||||||
},
|
},
|
||||||
@ -162,7 +151,6 @@
|
|||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldtype': 'Section Break',
|
'fieldtype': 'Section Break',
|
||||||
'idx': 11,
|
|
||||||
'options': 'Simple'
|
'options': 'Simple'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -173,7 +161,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'sync_support_mails',
|
'fieldname': 'sync_support_mails',
|
||||||
'fieldtype': 'Check',
|
'fieldtype': 'Check',
|
||||||
'idx': 12,
|
|
||||||
'label': 'Sync Support Mails'
|
'label': 'Sync Support Mails'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -184,7 +171,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'support_email',
|
'fieldname': 'support_email',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Data',
|
||||||
'idx': 13,
|
|
||||||
'label': 'Support Email'
|
'label': 'Support Email'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -195,7 +181,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'support_host',
|
'fieldname': 'support_host',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Data',
|
||||||
'idx': 14,
|
|
||||||
'label': 'POP3 Mail Server'
|
'label': 'POP3 Mail Server'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -204,7 +189,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'support_use_ssl',
|
'fieldname': 'support_use_ssl',
|
||||||
'fieldtype': 'Check',
|
'fieldtype': 'Check',
|
||||||
'idx': 15,
|
|
||||||
'label': 'Use SSL'
|
'label': 'Use SSL'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -213,7 +197,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'support_username',
|
'fieldname': 'support_username',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Data',
|
||||||
'idx': 16,
|
|
||||||
'label': 'User Name'
|
'label': 'User Name'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -222,15 +205,13 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'support_password',
|
'fieldname': 'support_password',
|
||||||
'fieldtype': 'Password',
|
'fieldtype': 'Password',
|
||||||
'idx': 17,
|
|
||||||
'label': 'Support Password'
|
'label': 'Support Password'
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldtype': 'Column Break',
|
'fieldtype': 'Column Break'
|
||||||
'idx': 18
|
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
@ -240,7 +221,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'support_signature',
|
'fieldname': 'support_signature',
|
||||||
'fieldtype': 'Text',
|
'fieldtype': 'Text',
|
||||||
'idx': 19,
|
|
||||||
'label': 'Signature'
|
'label': 'Signature'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -251,7 +231,6 @@
|
|||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'support_autoreply',
|
'fieldname': 'support_autoreply',
|
||||||
'fieldtype': 'Text',
|
'fieldtype': 'Text',
|
||||||
'idx': 20,
|
|
||||||
'label': 'Autoreply'
|
'label': 'Autoreply'
|
||||||
}
|
}
|
||||||
]
|
]
|
Loading…
x
Reference in New Issue
Block a user