Better integration with the rest of the code. Task-2831082 closes odoo/odoo#90726 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
35 lines
884 B
JavaScript
35 lines
884 B
JavaScript
/** @odoo-module **/
|
|
|
|
import { addFields, patchIdentifyingFields, 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', {
|
|
inverse: 'timer1',
|
|
readonly: true,
|
|
}),
|
|
qunitTestOwner2: one('QUnitTest', {
|
|
inverse: 'timer2',
|
|
readonly: true,
|
|
}),
|
|
});
|
|
|
|
patchIdentifyingFields('Timer', identifyingFields => {
|
|
identifyingFields[0].push('qunitTestOwner1');
|
|
identifyingFields[0].push('qunitTestOwner2');
|
|
});
|
|
|
|
patchRecordMethods('Timer', {
|
|
_computeDuration() {
|
|
if (this.qunitTestOwner1) {
|
|
return 0;
|
|
}
|
|
if (this.qunitTestOwner2) {
|
|
return 1000 * 1000;
|
|
}
|
|
return this._super();
|
|
},
|
|
});
|