Always send id for the on_change calls
Since cc277611c254 we rely on the id to decide if the instance is a new instance from the server-side or from the client-side. Closes #13769
This commit is contained in:
1 parent
523264e287
commit
91f80aa529
5 files changed
+14
No files matched your search
@@ -925,6 +925,7 @@ class Model(object):
|
||||
else:
|
||||
record, = records
|
||||
values = record._on_change_args(change)
|
||||
values['id'] = record.id
|
||||
changes = getattr(proxy, button)(values, context)
|
||||
record._set_on_change(changes)
|
||||
|
||||
@@ -1151,6 +1152,7 @@ class Model(object):
|
||||
on_change)
|
||||
values.update(self._on_change_args(on_change))
|
||||
if values:
|
||||
values['id'] = self.id
|
||||
context = self._context
|
||||
change = getattr(self._proxy, 'on_change')(values, names, context)
|
||||
self._set_on_change(change)
|
||||
@@ -1171,6 +1173,7 @@ class Model(object):
|
||||
to_change.add(field)
|
||||
values.update(self._on_change_args(on_change_with + [field]))
|
||||
if to_change:
|
||||
values['id'] = self.id
|
||||
context = self._context
|
||||
changes = getattr(self._proxy, 'on_change_with')(values,
|
||||
list(to_change), context)
|
||||
@@ -1180,6 +1183,7 @@ class Model(object):
|
||||
for field in later:
|
||||
on_change_with = self._fields[field]['on_change_with']
|
||||
values.update(self._on_change_args(on_change_with + [field]))
|
||||
values['id'] = self.id
|
||||
context = self._context
|
||||
changes = getattr(self._proxy, 'on_change_with')(
|
||||
values, list(later), context)
|
||||
|
||||
@@ -1097,6 +1097,7 @@
|
||||
}
|
||||
}
|
||||
if (!jQuery.isEmptyObject(values)) {
|
||||
values.id = this.id;
|
||||
var changes;
|
||||
try {
|
||||
if ((fieldnames.length == 1) ||
|
||||
@@ -1179,6 +1180,7 @@
|
||||
[values], this.get_context(), false));
|
||||
}
|
||||
} else {
|
||||
values.id = this.id;
|
||||
changed = this.model.execute(
|
||||
'on_change_with',
|
||||
[values, fieldnames], this.get_context(), false);
|
||||
@@ -1211,6 +1213,7 @@
|
||||
[values], this.get_context(), false));
|
||||
}
|
||||
} else {
|
||||
values.id = this.id;
|
||||
changed = this.model.execute(
|
||||
'on_change_with',
|
||||
[values, fieldnames], this.get_context(), false);
|
||||
@@ -1266,6 +1269,7 @@
|
||||
on_scan_code: function(code, depends) {
|
||||
depends = this.expr_eval(depends);
|
||||
var values = this._get_on_change_args(depends);
|
||||
values.id = this.id;
|
||||
return this.model.execute(
|
||||
'on_scan_code', [values, code], this.get_context(),
|
||||
true, false).then((changes) => {
|
||||
|
||||
@@ -2015,6 +2015,7 @@
|
||||
if (attributes.type === 'instance') {
|
||||
var args = record.expr_eval(attributes.change || []);
|
||||
var values = record._get_on_change_args(args);
|
||||
values.id = record.id;
|
||||
return record.model.execute(attributes.name, [values],
|
||||
this.context).then(function(changes) {
|
||||
record.set_on_change(changes);
|
||||
|
||||
@@ -607,6 +607,7 @@ class Record:
|
||||
values.update(self._get_on_change_args(on_change))
|
||||
|
||||
if values:
|
||||
values['id'] = self.id
|
||||
try:
|
||||
if len(fieldnames) == 1 or 'id' not in values:
|
||||
changes = []
|
||||
@@ -668,6 +669,7 @@ class Record:
|
||||
'on_change_with_' + fieldname,
|
||||
values, context=self.get_context()))
|
||||
else:
|
||||
values['id'] = self.id
|
||||
changed = RPCExecute(
|
||||
'model', self.model_name, 'on_change_with',
|
||||
values, list(fieldnames), context=self.get_context())
|
||||
@@ -690,6 +692,7 @@ class Record:
|
||||
'on_change_with_' + fieldname,
|
||||
values, context=self.get_context()))
|
||||
else:
|
||||
values['id'] = self.id
|
||||
changed = RPCExecute(
|
||||
'model', self.model_name, 'on_change_with',
|
||||
values, list(later), context=self.get_context())
|
||||
@@ -721,6 +724,7 @@ class Record:
|
||||
def on_scan_code(self, code, depends):
|
||||
depends = self.expr_eval(depends)
|
||||
values = self._get_on_change_args(depends)
|
||||
values['id'] = self.id
|
||||
try:
|
||||
changes = RPCExecute(
|
||||
'model', self.model_name, 'on_scan_code', values, code,
|
||||
|
||||
@@ -1263,6 +1263,7 @@ class Screen:
|
||||
record = self.current_record
|
||||
args = record.expr_eval(button.get('change', []))
|
||||
values = record._get_on_change_args(args)
|
||||
values['id'] = record.id
|
||||
try:
|
||||
changes = RPCExecute('model', self.model_name, button['name'],
|
||||
values, context=self.context)
|
||||
|
||||
Reference in new issue
Block a user