fix #2847
This commit is contained in:
parent
652c7db6e8
commit
0c677aa151
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
@ -1,13 +1,19 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
cur_frm.cscript.select_transaction = function(doc, cdt, cdn) {
|
||||
if(doc.select_transaction) {
|
||||
var callback = function(r,rt) {
|
||||
var doc = locals[cdt][cdn];
|
||||
doc.custom_message = r.message;
|
||||
refresh_field('custom_message');
|
||||
}
|
||||
return $c_obj(doc,'get_message',doc.select_transaction, callback)
|
||||
}
|
||||
}
|
||||
frappe.ui.form.on("Notification Control", {
|
||||
select_transaction: function(frm) {
|
||||
frm.set_value("custom_message", frm.events.get_fieldname(frm));
|
||||
},
|
||||
set_message: function(frm) {
|
||||
frm.set_value(frm.events.get_fieldname(frm), frm.doc.custom_message);
|
||||
frm.save();
|
||||
},
|
||||
get_fieldname: function(frm) {
|
||||
return frm.doc.select_transaction.replace(" ", "_").toLowerCase() + "_message";
|
||||
},
|
||||
after_save: function(frm) {
|
||||
// update notification settings in current session
|
||||
frappe.boot.notification_settings = frm.doc;
|
||||
}
|
||||
});
|
||||
|
@ -102,10 +102,10 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "update",
|
||||
"fieldname": "set_message",
|
||||
"fieldtype": "Button",
|
||||
"label": "Update",
|
||||
"options": "set_message",
|
||||
"options": "",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
@ -176,7 +176,7 @@
|
||||
"icon": "icon-envelope",
|
||||
"idx": 1,
|
||||
"issingle": 1,
|
||||
"modified": "2015-02-05 05:11:41.580894",
|
||||
"modified": "2015-03-04 01:13:46.715113",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Notification Control",
|
||||
|
@ -4,18 +4,8 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe import _
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
class NotificationControl(Document):
|
||||
def get_message(self, arg):
|
||||
fn = arg.lower().replace(' ', '_') + '_message'
|
||||
v = frappe.db.sql("select value from tabSingles where field=%s and doctype=%s", (fn, 'Notification Control'))
|
||||
return v and v[0][0] or ''
|
||||
|
||||
def set_message(self, arg = ''):
|
||||
fn = self.select_transaction.lower().replace(' ', '_') + '_message'
|
||||
frappe.db.set(self, fn, self.custom_message)
|
||||
frappe.msgprint(_("Message updated"))
|
||||
|
||||
def validate(self):
|
||||
frappe.clear_cache()
|
||||
|
@ -728,10 +728,10 @@
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"description": "Select \"Yes\" if you supply raw materials to your supplier to manufacture this item.",
|
||||
"description": "",
|
||||
"fieldname": "is_sub_contracted_item",
|
||||
"fieldtype": "Select",
|
||||
"label": "Is Sub Contracted Item",
|
||||
"label": "Supply Raw Materials for Purchase",
|
||||
"oldfieldname": "is_sub_contracted_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
@ -877,7 +877,7 @@
|
||||
"icon": "icon-tag",
|
||||
"idx": 1,
|
||||
"max_attachments": 1,
|
||||
"modified": "2015-03-02 07:48:53.411086",
|
||||
"modified": "2015-03-03 06:18:35.717586",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item",
|
||||
|
Loading…
x
Reference in New Issue
Block a user