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