Przeglądaj źródła

[fix] control.js for read only values

version-14
Rushabh Mehta 9 lat temu
rodzic
commit
6f2b58c095
4 zmienionych plików z 14 dodań i 7 usunięć
  1. +2
    -2
      frappe/build.py
  2. +2
    -0
      frappe/client.py
  3. +10
    -4
      frappe/public/js/frappe/form/control.js
  4. +0
    -1
      frappe/public/js/frappe/form/layout.js

+ 2
- 2
frappe/build.py Wyświetl plik

@@ -96,9 +96,9 @@ def get_build_maps():
source_paths.append(s)

build_maps[target] = source_paths
except Exception:
except ValueError, e:
print path
raise
print 'JSON syntax error {0}'.format(str(e))

return build_maps



+ 2
- 0
frappe/client.py Wyświetl plik

@@ -165,6 +165,8 @@ def get_js(src):
with open(contentpath, "r") as srcfile:
code = frappe.utils.cstr(srcfile.read())

print code

if frappe.local.lang != "en":
messages = frappe.get_lang_dict("jsfile", contentpath)
messages = json.dumps(messages)


+ 10
- 4
frappe/public/js/frappe/form/control.js Wyświetl plik

@@ -103,9 +103,15 @@ frappe.ui.form.Control = Class.extend({
},
get_parsed_value: function() {
var me = this;
return this.get_value ?
(this.parse ? this.parse(this.get_value()) : this.get_value()) :
undefined;
if(this.get_status()==='Write') {
return this.get_value ?
(this.parse ? this.parse(this.get_value()) : this.get_value()) :
undefined;
} else if(this.get_status()==='Read') {
return this.value || undefined;
} else {
return undefined;
}
},
set_model_value: function(value) {
if(this.frm) {
@@ -411,7 +417,7 @@ frappe.ui.form.ControlData = frappe.ui.form.ControlInput.extend({
this.set_mandatory && this.set_mandatory(value);
},
get_value: function() {
return this.$input && this.$input.val() || this.value;
return this.$input ? this.$input.val() : undefined;
},
format_for_input: function(val) {
return val==null ? "" : val;


+ 0
- 1
frappe/public/js/frappe/form/layout.js Wyświetl plik

@@ -39,7 +39,6 @@ frappe.ui.form.Layout = Class.extend({
// wrap in a block
html = '<div>' + html + '</div>';
}
console.log(html);
$(html).appendTo(this.message.removeClass('hidden'));
} else {
this.message.empty().addClass('hidden');


Ładowanie…
Anuluj
Zapisz