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 : 6.0
This commit is contained in:
+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(
|
||||
@@ -2431,7 +2435,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 '';
|
||||
},
|
||||
@@ -2447,7 +2451,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('');
|
||||
}
|
||||
@@ -2536,7 +2540,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;
|
||||
},
|
||||
@@ -2843,7 +2847,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()));
|
||||
@@ -2862,7 +2866,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 '';
|
||||
},
|
||||
@@ -2916,7 +2921,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