[FIX] web: avoid _reset crashing because of empty parameters
Purpose ======= Avoid displaying a traceback when editing a partner in form view. This was observed in crm -> Sales Teams -> Clicking on a member to save and pressing "save" (which returned a javascript traceback in master). The same error was also observed in mass_mailing, when editing the responsible of a mailing list. This was due to the ev parameter being undefined in method _reset. A simple check has been added to see if the event is defined. Task-2694067 closes odoo/odoo#80504 X-original-commit: 88044fa003b3f17d2003bffb810965854427cbd3 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
This commit is contained in:
committed by
Thibault Delavallée
co-authored by
Mohammed Shekha
parent
c3399b5470
commit
1863ebc0aa
@@ -3715,7 +3715,7 @@ var FieldDomain = AbstractField.extend({
|
||||
this.domainSelector.destroy();
|
||||
this.domainSelector = null;
|
||||
}
|
||||
if (ev.target !== this) {
|
||||
if (!ev || ev.target !== this) {
|
||||
this.debugEdition = false;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4449,6 +4449,43 @@ QUnit.module('Views', {
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('form with domain widget: opening a many2many form and save should not crash', async function (assert) {
|
||||
assert.expect(0);
|
||||
|
||||
// We just test that there is no crash in this situation
|
||||
this.data.partner.records[0].timmy = [12];
|
||||
const form = await createView({
|
||||
View: FormView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch:
|
||||
`<form string="Partners">
|
||||
<group>
|
||||
<field name="foo" widget="domain"/>
|
||||
</group>
|
||||
<field name="timmy">
|
||||
<tree>
|
||||
<field name="display_name"/>
|
||||
</tree>
|
||||
<form>
|
||||
<field name="name"/>
|
||||
<field name="color"/>
|
||||
</form>
|
||||
</field>
|
||||
</form>`,
|
||||
res_id: 1,
|
||||
});
|
||||
|
||||
// switch to edit mode
|
||||
await testUtils.form.clickEdit(form);
|
||||
|
||||
// open a form view and save many2many record
|
||||
await testUtils.dom.click(form.$('.o_data_row .o_data_cell:first'));
|
||||
await testUtils.dom.click($('.modal-dialog footer button:first-child'));
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('display_name not sent for onchanges if not in view', async function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user