From 10fd91c78e0c27941164306d43fbc5d87470fa1c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 7 Jan 2014 16:18:41 +0530 Subject: [PATCH 1/3] Close tickets automatically through scheduler --- startup/schedule_handlers.py | 4 ++++ support/doctype/support_ticket/get_support_mails.py | 5 ----- support/doctype/support_ticket/support_ticket.py | 7 ++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/startup/schedule_handlers.py b/startup/schedule_handlers.py index 252a091547..0cf06026d6 100644 --- a/startup/schedule_handlers.py +++ b/startup/schedule_handlers.py @@ -53,6 +53,10 @@ def execute_daily(): # email digest from setup.doctype.email_digest.email_digest import send run_fn(send) + + # auto close support tickets + from support.doctype.support_ticket.support_ticket import auto_close_tickets + run_fn(auto_close_tickets) def execute_weekly(): from setup.doctype.backup_manager.backup_manager import take_backups_weekly diff --git a/support/doctype/support_ticket/get_support_mails.py b/support/doctype/support_ticket/get_support_mails.py index 33cb023747..67ed9f6ae8 100644 --- a/support/doctype/support_ticket/get_support_mails.py +++ b/support/doctype/support_ticket/get_support_mails.py @@ -52,11 +52,6 @@ Original Query: subject = '['+cstr(d.name)+'] ' + cstr(d.subject), \ msg = cstr(response)) - def auto_close_tickets(self): - webnotes.conn.sql("""update `tabSupport Ticket` set status = 'Closed' - where status = 'Replied' - and date_sub(curdate(),interval 15 Day) > modified""") - def get_support_mails(): if cint(webnotes.conn.get_value('Email Settings', None, 'sync_support_mails')): SupportMailbox() diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py index fd79583129..3030a146fe 100644 --- a/support/doctype/support_ticket/support_ticket.py +++ b/support/doctype/support_ticket/support_ticket.py @@ -66,4 +66,9 @@ class DocType(TransactionBase): def set_status(name, status): st = webnotes.bean("Support Ticket", name) st.doc.status = status - st.save() \ No newline at end of file + st.save() + +def auto_close_tickets(): + webnotes.conn.sql("""update `tabSupport Ticket` set status = 'Closed' + where status = 'Replied' + and date_sub(curdate(),interval 15 Day) > modified""") \ No newline at end of file From d659343541284611afec55a474abc3a9c555d446 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 8 Jan 2014 17:29:23 +0530 Subject: [PATCH 2/3] Payment Reconciliation: Fix for outstanding voucher query --- .../payment_to_invoice_matching_tool.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py index dea5fb59c9..fc58418245 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py @@ -140,13 +140,13 @@ def gl_entry_details(doctype, txt, searchfield, start, page_len, filters): and ifnull(gle.%(account_type)s, 0) > 0 and (select ifnull(abs(sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))), 0) from `tabGL Entry` - where against_voucher_type = '%(dt)s' + where account = '%(acc)s' + and against_voucher_type = '%(dt)s' and against_voucher = gle.voucher_no and voucher_no != gle.voucher_no) - != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0) - ) - and if(gle.voucher_type='Sales Invoice', (select is_pos from `tabSales Invoice` - where name=gle.voucher_no), 0)=0 + != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) + and if(gle.voucher_type='Sales Invoice', ifnull((select is_pos from `tabSales Invoice` + where name=gle.voucher_no), 0), 0)=0 %(mcond)s ORDER BY gle.posting_date desc, gle.voucher_no desc limit %(start)s, %(page_len)s""" % { From 4bbf91bea18518d56b99e04059d346e2ba548609 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 9 Jan 2014 12:44:44 +0530 Subject: [PATCH 3/3] Added match condition in general ledger report --- accounts/report/general_ledger/general_ledger.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/accounts/report/general_ledger/general_ledger.py b/accounts/report/general_ledger/general_ledger.py index 855b7d1c7a..2f5716ece3 100644 --- a/accounts/report/general_ledger/general_ledger.py +++ b/accounts/report/general_ledger/general_ledger.py @@ -72,6 +72,11 @@ def get_conditions(filters): if filters.get("voucher_no"): conditions.append("voucher_no=%(voucher_no)s") + + + from webnotes.widgets.reportview import build_match_conditions + match_conditions = build_match_conditions("GL Entry") + if match_conditions: conditions.append(match_conditions) return "and {}".format(" and ".join(conditions)) if conditions else ""