Files
odoo_source/addons/mail/static/tests/models/timer_qunit_tests.js
T
Sébastien Theys 60c87dd426 [IMP] mail, *: introduce identifyingMode and remove identifyingFields
* = calendar, hr, im_livechat, rating, snailmail, website_livechat

This simplifies definition and overrides and opens up new identification
opportunities.

Part of task-2741982

closes odoo/odoo#98166

Related: odoo/enterprise#30470
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2022-08-17 11:21:40 +02:00

32 lines
754 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',
readonly: true,
}),
qunitTestOwner2: one('QUnitTest', {
identifying: true,
inverse: 'timer2',
readonly: true,
}),
});
patchRecordMethods('Timer', {
_computeDuration() {
if (this.qunitTestOwner1) {
return 0;
}
if (this.qunitTestOwner2) {
return 1000 * 1000;
}
return this._super();
},
});