diff --git a/proteus/proteus/__init__.py b/proteus/proteus/__init__.py index c61734de80..74015de877 100644 --- a/proteus/proteus/__init__.py +++ b/proteus/proteus/__init__.py @@ -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) diff --git a/sao/src/model.js b/sao/src/model.js index e7d172a901..2f99677206 100644 --- a/sao/src/model.js +++ b/sao/src/model.js @@ -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) => { diff --git a/sao/src/screen.js b/sao/src/screen.js index 8e731978e0..1f70b5223b 100644 --- a/sao/src/screen.js +++ b/sao/src/screen.js @@ -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); diff --git a/tryton/tryton/gui/window/view_form/model/record.py b/tryton/tryton/gui/window/view_form/model/record.py index b89897a408..b990af17d4 100644 --- a/tryton/tryton/gui/window/view_form/model/record.py +++ b/tryton/tryton/gui/window/view_form/model/record.py @@ -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, diff --git a/tryton/tryton/gui/window/view_form/screen/screen.py b/tryton/tryton/gui/window/view_form/screen/screen.py index a397639a9f..ff9f3d33da 100644 --- a/tryton/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/tryton/gui/window/view_form/screen/screen.py @@ -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)