From 41cc32790f6faad95ec01261217f46b87ec189a2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 30 Apr 2012 14:36:18 +0530 Subject: [PATCH] Fixed issie in auto notification --- erpnext/hr/doctype/expense_voucher/expense_voucher.js | 3 ++- erpnext/hr/doctype/expense_voucher/expense_voucher.py | 7 +++++-- erpnext/selling/doctype/sales_order/sales_order.py | 3 ++- .../doctype/notification_control/notification_control.py | 2 +- erpnext/utilities/transaction_base.py | 6 ++++++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/erpnext/hr/doctype/expense_voucher/expense_voucher.js b/erpnext/hr/doctype/expense_voucher/expense_voucher.js index 2e03567751..dac5543536 100644 --- a/erpnext/hr/doctype/expense_voucher/expense_voucher.js +++ b/erpnext/hr/doctype/expense_voucher/expense_voucher.js @@ -248,7 +248,8 @@ $import(Notification Control) cur_frm.cscript.on_submit = function(doc, cdt, cdn) { var args = { type: 'Expense Voucher', - doctype: 'Expense Voucher' + doctype: 'Expense Voucher', + send_to: doc.exp_approver } cur_frm.cscript.notify(doc, args); } diff --git a/erpnext/hr/doctype/expense_voucher/expense_voucher.py b/erpnext/hr/doctype/expense_voucher/expense_voucher.py index b349100300..a29682cf6c 100644 --- a/erpnext/hr/doctype/expense_voucher/expense_voucher.py +++ b/erpnext/hr/doctype/expense_voucher/expense_voucher.py @@ -98,8 +98,6 @@ class DocType: set(self.doc, 'remark', self.doc.remark) set(self.doc, 'approval_status', 'Rejected') - # on approval notification - #get_obj('Notification Control').notify_contact('Expense Voucher Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name) return cstr('Rejected') @@ -157,3 +155,8 @@ class DocType: def on_cancel(self): set(self.doc, 'approval_status', 'Cancelled') + + + def get_formatted_message(self, args): + """ get formatted message for auto notification""" + return get_obj('Notification Control').get_formatted_message(args) diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index c886ec38b6..ca248b73a6 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -90,7 +90,8 @@ class DocType(TransactionBase): # ------------------------------------- def get_comm_rate(self, sales_partner): return get_obj('Sales Common').get_comm_rate(sales_partner, self) - + + # Clear Sales Order Details Table # -------------------------------- def clear_sales_order_details(self): diff --git a/erpnext/setup/doctype/notification_control/notification_control.py b/erpnext/setup/doctype/notification_control/notification_control.py index 61f558765f..fabd7d8dd9 100644 --- a/erpnext/setup/doctype/notification_control/notification_control.py +++ b/erpnext/setup/doctype/notification_control/notification_control.py @@ -23,7 +23,7 @@ from webnotes.model.code import get_obj from webnotes import msgprint sql = webnotes.conn.sql - + # ----------------------------------------------------------------------------------------- # Notification control class DocType: diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index 032b52faa6..41fec67b56 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -18,6 +18,7 @@ import webnotes from webnotes.utils import load_json, cint, cstr, flt, get_defaults from webnotes.model.doc import Document, addchild, removechild, getchildren from webnotes.model.doclist import getlist, copy_doclist +from webnotes.model.code import get_obj from webnotes import msgprint class TransactionBase: @@ -225,3 +226,8 @@ class TransactionBase: ret = webnotes.conn.sql("select default_currency from tabCompany where name = '%s'" %(name)) dcc = ret and ret[0][0] or get_defaults()['currency'] return dcc + + + def get_formatted_message(self, args): + """ get formatted message for auto notification""" + return get_obj('Notification Control').get_formatted_message(args)