From a528f54dcb495b9c7f6ae90c800da9058ca47ceb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 5 Mar 2012 17:45:38 +0530 Subject: [PATCH 1/8] serial no fld print_hide=0 --- .../purchase_receipt_detail/purchase_receipt_detail.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt b/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt index a8d1563166..815864fdd7 100755 --- a/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt +++ b/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:09:16', 'docstatus': 0, - 'modified': '2012-03-05 15:01:58', + 'modified': '2012-03-05 17:44:23', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -22,7 +22,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 77 + 'version': 78 }, # These values are common for all DocField @@ -295,7 +295,7 @@ 'oldfieldname': u'serial_no', 'oldfieldtype': u'Text', 'permlevel': 0, - 'print_hide': 1, + 'print_hide': 0, 'report_hide': 0 }, From b659457b4d9243f5839e134ec95e5494bed6011e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 6 Mar 2012 11:07:24 +0530 Subject: [PATCH 2/8] Removed def value from invoice naming series --- .../doctype/receivable_voucher/receivable_voucher.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt index 54794cfba6..546d99781d 100644 --- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt +++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:09:18', 'docstatus': 0, - 'modified': '2012-03-02 12:22:21', + 'modified': '2012-03-06 11:05:53', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -21,7 +21,7 @@ # These values are common for all DocType { - '_last_update': u'1330593645', + '_last_update': u'1330671142', 'change_log': u'1. Change in pull_details method dt.-26-06-2009', 'colour': u'White:FFF', 'default_print_format': u'Standard', @@ -34,7 +34,7 @@ 'server_code_error': u' ', 'show_in_menu': 0, 'subject': u'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding', - 'version': 415 + 'version': 416 }, # These values are common for all DocFormat @@ -176,7 +176,6 @@ # DocField { 'colour': u'White:FFF', - 'default': u'INV', 'depends_on': u'eval:doc.retail_transaction!="Yes"', 'description': u'To manage multiple series please go to Setup > Manage Series', 'doctype': u'DocField', From 4e154d2233dc3bdbe7f1e2343ad8f3c787043839 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 6 Mar 2012 11:19:29 +0530 Subject: [PATCH 3/8] removed rv series def val --- erpnext/patches/jan_mar_2012/remove_series_defval.py | 3 +++ erpnext/patches/patch_list.py | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 erpnext/patches/jan_mar_2012/remove_series_defval.py diff --git a/erpnext/patches/jan_mar_2012/remove_series_defval.py b/erpnext/patches/jan_mar_2012/remove_series_defval.py new file mode 100644 index 0000000000..123cc41295 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/remove_series_defval.py @@ -0,0 +1,3 @@ +def execute(): + import webnotes + webnotes.conn.sql("update `tabDocField` set `default`='' where parent = 'Receivable Voucher' and fieldname = 'naming_series' and `default` = 'INV'") diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 7750962963..85a11a591d 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -177,5 +177,10 @@ patch_list = [ 'patch_file': 'reload_table', 'description': 'Relaod all item table: fld order changes' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'remove_series_defval', + 'description': 'Remove rv series default value' + }, ] From bb64d302df0b44fb9349f967f4bc6ea12df5ddad Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 6 Mar 2012 11:42:32 +0530 Subject: [PATCH 4/8] email digest fix --- .../doctype/email_digest/email_digest.py | 73 ++++--------------- 1 file changed, 14 insertions(+), 59 deletions(-) diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index c5989bbefa..ff9bf68719 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -282,7 +282,8 @@ class DocType: Returns start and end date depending on the frequency of email digest """ from datetime import datetime, date, timedelta - today = datetime.now().date() + from webnotes.utils import now_datetime + today = now_datetime().date() year, month, day = today.year, today.month, today.day if self.doc.frequency == 'Daily': @@ -409,6 +410,7 @@ class DocType: from webnotes.utils.email_lib import sendmail try: + #webnotes.msgprint('in send') sendmail( recipients=recipient_list, sender='notifications+email_digest@erpnext.com', @@ -419,64 +421,22 @@ class DocType: ) except Exception, e: webnotes.msgprint('There was a problem in sending your email. Please contact support@erpnext.com') - #webnotes.errprint(webnotes.getTraceback()) + webnotes.errprint(webnotes.getTraceback()) def get_next_sending(self): - """ - - """ - # Get TimeZone - # Get System TimeZone - import time - from pytz import timezone import datetime - import webnotes.defs - cp = webnotes.model.doc.Document('Control Panel','Control Panel') - app_tz = timezone(cp.time_zone) - server_tz = timezone(getattr(webnotes.defs, 'system_timezone')) start_date, end_date = self.get_start_end_dates() - new_date = end_date + datetime.timedelta(days=1) - new_time = datetime.time(hour=6) - - naive_dt = datetime.datetime.combine(new_date, new_time) - app_dt = app_tz.localize(naive_dt) - server_dt = server_tz.normalize(app_dt.astimezone(server_tz)) - - res = { - 'app_dt': app_dt.replace(tzinfo=None), - 'app_tz': app_tz, - 'server_dt': server_dt.replace(tzinfo=None), - 'server_tz': server_tz - } - + send_date = end_date + datetime.timedelta(days=1) + from webnotes.utils import formatdate - str_date = formatdate(str(res['app_dt'].date())) - str_time = res['app_dt'].time().strftime('%I:%M') + str_date = formatdate(str(send_date)) - self.doc.next_send = str_date + " at about " + str_time + self.doc.next_send = str_date + " at midnight" - return res - - - def get_next_execution(self): - """ - - """ - from datetime import datetime, timedelta - dt_args = self.get_next_sending() - server_dt = dt_args['server_dt'] - now_dt = datetime.now(dt_args['server_tz']) - if now_dt.time() <= server_dt.time(): - next_date = now_dt.date() - else: - next_date = now_dt.date() + timedelta(days=1) - - next_time = server_dt.time() - - return datetime.combine(next_date, next_time) + return send_date def onload(self): @@ -743,21 +703,16 @@ def send(): """, as_list=1) from webnotes.model.code import get_obj - from datetime import datetime, timedelta - now = datetime.now() - now_date = now.date() - now_time = (now + timedelta(hours=2)).time() + from webnotes.utils import now_datetime + now_date = now_datetime().date() + for ed in edigest_list: if ed[0]: ed_obj = get_obj('Email Digest', ed[0]) ed_obj.sending = True - dt_dict = ed_obj.get_next_sending() - send_date = dt_dict['server_dt'].date() - send_time = dt_dict['server_dt'].time() + send_date = ed_obj.get_next_sending() + #webnotes.msgprint([ed[0], now_date, send_date]) if (now_date == send_date): - #webnotes.msgprint('sending ' + ed_obj.doc.name) ed_obj.send() - #else: - # webnotes.msgprint('not sending ' + ed_obj.doc.name) From 2b60484babedd3ac288b6cc1ac05539efb8cdd7d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 6 Mar 2012 16:17:34 +0530 Subject: [PATCH 5/8] fix in reverted my company --- erpnext/home/page/my_company/my_company.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/home/page/my_company/my_company.py b/erpnext/home/page/my_company/my_company.py index f35f475eef..d3a7bc7a36 100644 --- a/erpnext/home/page/my_company/my_company.py +++ b/erpnext/home/page/my_company/my_company.py @@ -67,7 +67,7 @@ def add_user(args): # erpnext-saas if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')): from server_tools.gateway_utils import add_user_gateway - add_user_gateway(args['user']) + add_user_gateway(args) add_profile(args) From a872d81983ea349b13a99eecdfa8ba4528e53ec0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 6 Mar 2012 17:09:53 +0530 Subject: [PATCH 6/8] trying to fix support ticket --- erpnext/home/__init__.py | 2 +- .../support/doctype/support_ticket/__init__.py | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py index 2cca85ad9c..8118ea692c 100644 --- a/erpnext/home/__init__.py +++ b/erpnext/home/__init__.py @@ -47,7 +47,7 @@ feed_dict = { # Support 'Customer Issue': ['[%(status)s] %(description)s by %(customer_name)s', '#000080'], 'Maintenance Visit':['To %(customer_name)s', '#4169E1'], - 'Support Ticket': ['[%(status)s] %(subject)s', '#000080'], + 'Support Ticket': ["[%(status)s] %(subject)s", '#000080'], # Website 'Web Page': ['%(title)s', '#000080'], diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py index ca27a61f9f..2a6f33c31b 100644 --- a/erpnext/support/doctype/support_ticket/__init__.py +++ b/erpnext/support/doctype/support_ticket/__init__.py @@ -81,6 +81,7 @@ class SupportMailbox(POP3Mailbox): st.make_response_record(content, mail.mail['From'], content_type) webnotes.conn.set(st.doc, 'status', 'Open') update_feed(st.doc, 'on_update') + webnotes.conn.commit() # extract attachments self.save_attachments(st.doc, mail.attachments) return @@ -99,21 +100,22 @@ class SupportMailbox(POP3Mailbox): d.naming_series = (opts and opts[0] and opts[0][0] and opts[0][0].split("\n")[0]) or 'SUP' try: d.save(1) + except: + d.description = 'Unable to extract message' + d.save(1) + else: # update feed update_feed(d, 'on_update') # send auto reply self.send_auto_reply(d) - except: - d.description = 'Unable to extract message' - d.save(1) - - else: + webnotes.conn.commit() + # extract attachments self.save_attachments(d, mail.attachments) - + def save_attachments(self, doc, attachment_list=[]): """ @@ -138,7 +140,7 @@ class SupportMailbox(POP3Mailbox): """ Send auto reply to emails """ - signature = self.email_settings.support_signature + signature = self.email_settings.support_signature or '' response = self.email_settings.support_autoreply or (""" A new Ticket has been raised for your query. If you have any additional information, please @@ -148,7 +150,7 @@ We will get back to you as soon as possible [This is an automatic response] - """ + (signature or '')) + """ + signature) from webnotes.utils.email_lib import sendmail From 2bc141f5db4f181b1efb095e910a5749fb726e90 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 6 Mar 2012 18:05:23 +0530 Subject: [PATCH 7/8] fix in support ticket and email settings --- .../doctype/email_settings/email_settings.py | 18 +++--------------- .../support/doctype/support_ticket/__init__.py | 4 ++-- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py index 0f930bcef1..c670b317c9 100644 --- a/erpnext/setup/doctype/email_settings/email_settings.py +++ b/erpnext/setup/doctype/email_settings/email_settings.py @@ -35,8 +35,8 @@ class DocType: """ Update value in control panel """ - 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.get(key)) def validate(self): """ @@ -117,19 +117,7 @@ class DocType: def on_update(self): """ - Sets or cancels the event in the scheduler + update control panel """ - # update control panel for f in ('outgoing_mail_server', 'mail_login', 'mail_password', 'auto_email_id', 'mail_port', 'use_ssl'): self.set_cp_value(f) - - # setup scheduler for support emails - if cint(self.doc.sync_support_mails): - if not (self.doc.support_host and self.doc.support_username and self.doc.support_password): - webnotes.msgprint("You must give the incoming POP3 settings for support emails to activiate mailbox integration", raise_exception=1) - - from webnotes.utils.scheduler import set_event - set_event('support.doctype.support_ticket.get_support_mails', 60*5, 1) - else: - from webnotes.utils.scheduler import cancel_event - cancel_event('support.doctype.support_ticket.get_support_mails') diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py index 2a6f33c31b..557dbaedfc 100644 --- a/erpnext/support/doctype/support_ticket/__init__.py +++ b/erpnext/support/doctype/support_ticket/__init__.py @@ -140,9 +140,9 @@ class SupportMailbox(POP3Mailbox): """ Send auto reply to emails """ - signature = self.email_settings.support_signature or '' + signature = self.email_settings.fields.get('support_signature') or '' - response = self.email_settings.support_autoreply or (""" + response = self.email_settings.fields.get('support_autoreply') or (""" A new Ticket has been raised for your query. If you have any additional information, please reply back to this mail. From 18b6c1d4e9e7c694c603b1ec552ae319907c7da4 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 6 Mar 2012 18:31:25 +0530 Subject: [PATCH 8/8] minor changes in support ticket --- erpnext/support/doctype/support_ticket/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py index 557dbaedfc..eebb6cf8f2 100644 --- a/erpnext/support/doctype/support_ticket/__init__.py +++ b/erpnext/support/doctype/support_ticket/__init__.py @@ -140,6 +140,7 @@ class SupportMailbox(POP3Mailbox): """ Send auto reply to emails """ + from webnotes.utils import cstr signature = self.email_settings.fields.get('support_signature') or '' response = self.email_settings.fields.get('support_autoreply') or (""" @@ -150,15 +151,15 @@ We will get back to you as soon as possible [This is an automatic response] - """ + signature) + """ + cstr(signature)) from webnotes.utils.email_lib import sendmail sendmail(\ - recipients = [d.raised_by], \ - sender = self.email_settings.support_email, \ - subject = '['+d.name+'] ' + cstr(d.subject), \ - msg = response) + recipients = [cstr(d.raised_by)], \ + sender = cstr(self.email_settings.fields.get('support_email')), \ + subject = '['+cstr(d.name)+'] ' + cstr(d.subject), \ + msg = cstr(response)) def auto_close_tickets(self): """