Files
odoo_source/addons/mail/static/tests/models/timer_qunit_tests.js
T
Louis Wicket (wil) 5d43fad9e6 [IMP] mail, *: auto add implicit attributes of identifying fields
Automatically add `required` and `readonly` on identifying fields and
remove them from field definition.

Task-2955910.
* = calendar, hr, im_livechat, rating, snailmail, website_livechat

closes odoo/odoo#98283

Related: odoo/enterprise#30511
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-08-17 19:48:53 +02:00

30 lines
706 B
JavaScript

/** @odoo-module **/
import { addFields, patchRecordMethods } from '@mail/model/model_core';
import { one } from '@mail/model/model_field';
// ensure that the model definition is loaded before the patch
import '@mail/models/timer';
addFields('Timer', {
qunitTestOwner1: one('QUnitTest', {
identifying: true,
inverse: 'timer1',
}),
qunitTestOwner2: one('QUnitTest', {
identifying: true,
inverse: 'timer2',
}),
});
patchRecordMethods('Timer', {
_computeDuration() {
if (this.qunitTestOwner1) {
return 0;
}
if (this.qunitTestOwner2) {
return 1000 * 1000;
}
return this._super();
},
});