Files
odoo_source/addons/mail/static/src/model/model_onchange.js
T
Sébastien Theys 8ce96ac850 [IMP] mail: rename js Model to Record
Removes confusion in technical code. An instance of Thread is a thread, by
analogy a record should be an instance of Record.

closes odoo/odoo#85359

Related: odoo/enterprise#24731
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-02-24 18:42:13 +00:00

29 lines
945 B
JavaScript

/** @odoo-module **/
export class OnChange {
/**
* Creates a new "on change" definition. This "on change" should be provided
* to "onChanges" attribute of the concerned model to be notified of
* changes in the given dependencies.
*
* @constructor
* @param {Object} param
* @param {string[]} param.dependencies a list of fields on the associated
* model to observe for change. x2one relational fields can be followed by
* using dot notation to have dependencies on their own fields too.
* @param {string} param.methodName the name of a method on the associated
* model that will be called when one of the dependencies changes.
*/
constructor({ dependencies, methodName }) {
this.dependencies = dependencies;
this.methodName = methodName;
}
/**
* @returns {string}
*/
toString() {
return `onChange(${this.methodName})`;
}
}