소스 검색

[fix] control.js for read only values

version-14
Rushabh Mehta 9 년 전
부모
커밋
6f2b58c095
4개의 변경된 파일14개의 추가작업 그리고 7개의 파일을 삭제
  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 파일 보기

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


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


return build_maps return build_maps




+ 2
- 0
frappe/client.py 파일 보기

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


print code

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


+ 10
- 4
frappe/public/js/frappe/form/control.js 파일 보기

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


+ 0
- 1
frappe/public/js/frappe/form/layout.js 파일 보기

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


불러오는 중...
취소
저장