[FIX] mail: remove deprecated exists check
The deprecated exists check(located in getFieldValue (ModelManager)) is removed, but a lot of tests will fail after removing this check because it will try to read fields after records are deleted. So added some missing exists checks. Task-2871062 closes odoo/odoo#95415 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
committed by
Hiral Bhavsar
parent
ee61cc4259
commit
bd832118ee
@@ -1237,10 +1237,6 @@ export class ModelManager {
|
||||
for (const fieldName of Object.keys(model.__fieldMap)) {
|
||||
Object.defineProperty(model.prototype, fieldName, {
|
||||
get: function getFieldValue() { // this is bound to record
|
||||
if (!this.exists()) {
|
||||
// Deprecated, allows reading fields on deleted records. Use exists() instead.
|
||||
return undefined;
|
||||
}
|
||||
const field = model.__fieldMap[fieldName];
|
||||
if (this.modelManager._listeners.size) {
|
||||
if (!this.modelManager._listenersObservingLocalId.has(this.localId)) {
|
||||
|
||||
@@ -197,7 +197,9 @@ registerModel({
|
||||
if (isEventHandled(ev, 'MessageActionList.replyTo')) {
|
||||
return;
|
||||
}
|
||||
this.discard();
|
||||
if (this.exists()) {
|
||||
this.discard();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Called when clicking on "discard" button.
|
||||
|
||||
@@ -1550,7 +1550,7 @@ QUnit.test('[technical] does not crash when an attachment is removed before its
|
||||
}
|
||||
);
|
||||
// Simulates the completion of the upload of the first attachment
|
||||
uploadPromise.resolve();
|
||||
await afterNextRender(() => uploadPromise.resolve());
|
||||
assert.containsOnce(
|
||||
document.body,
|
||||
'.o_AttachmentCard:contains("text1.txt")',
|
||||
|
||||
Reference in New Issue
Block a user