Remove new lines characters when comparing record name of Many2One and Reference
This avoid to trigger a reset of the field if the record name has such character. Closes #13687 (grafted from cac71113f210bce90c55f6a6c6f32703654cdc59) --HG-- branch : 7.0
This commit is contained in:
1 parent
8f89d18192
commit
788cddf20c
1 file changed
+11
-6
+11
-6
@@ -12,6 +12,10 @@ function eval_pyson(value){
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
function remove_newline(value) {
|
||||
return value.replace(/[\n\r]/gm, '')
|
||||
}
|
||||
|
||||
Sao.View.FormXMLViewParser = Sao.class_(Sao.View.XMLViewParser, {
|
||||
init: function(view, exclude_field, field_attrs) {
|
||||
Sao.View.FormXMLViewParser._super.init.call(
|
||||
@@ -2560,7 +2564,7 @@ function eval_pyson(value){
|
||||
get_text: function() {
|
||||
var record = this.record;
|
||||
if (record) {
|
||||
return record.field_get_client(this.field_name);
|
||||
return remove_newline(record.field_get_client(this.field_name));
|
||||
}
|
||||
return '';
|
||||
},
|
||||
@@ -2576,7 +2580,7 @@ function eval_pyson(value){
|
||||
set_value: function() {
|
||||
var record = this.record;
|
||||
var field = this.field;
|
||||
if (field.get_client(record) != this.entry.val()) {
|
||||
if (this.get_text() != this.entry.val()) {
|
||||
field.set_client(record, this.value_from_id(null, ''));
|
||||
this.entry.val('');
|
||||
}
|
||||
@@ -2671,7 +2675,7 @@ function eval_pyson(value){
|
||||
get modified() {
|
||||
if (this.record && this.field) {
|
||||
var value = this.entry.val();
|
||||
return this.field.get_client(this.record) != value;
|
||||
return this.get_text() != value;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
@@ -2979,7 +2983,7 @@ function eval_pyson(value){
|
||||
name = '';
|
||||
if (value) {
|
||||
model = value[0];
|
||||
name = value[1];
|
||||
name = remove_newline(value[1]);
|
||||
}
|
||||
return ((model != this.get_model()) ||
|
||||
(name != this.entry.val()));
|
||||
@@ -2998,7 +3002,8 @@ function eval_pyson(value){
|
||||
get_text: function() {
|
||||
var record = this.record;
|
||||
if (record) {
|
||||
return record.field_get_client(this.field_name)[1];
|
||||
return remove_newline(
|
||||
record.field_get_client(this.field_name)[1]);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
@@ -3052,7 +3057,7 @@ function eval_pyson(value){
|
||||
var model, name;
|
||||
if (value instanceof Array) {
|
||||
model = value[0];
|
||||
name = value[1];
|
||||
name = remove_newline(value[1]);
|
||||
} else {
|
||||
model = '';
|
||||
name = '';
|
||||
|
||||
Reference in new issue
Block a user