[FIX] mail,web: link attachments & messages

The information of the active model and record was not given in the context
Records created from the Manage Messages and Manage Attachements in the debug
menu were not linked to the current records
Add context in test too

closes odoo/odoo#27766
This commit is contained in:
Swapnesh Shah
2018-12-28 10:33:05 +00:00
committed by Martin Trigaux
parent ff873626ed
commit d67658c043
4 changed files with 16 additions and 0 deletions
@@ -23,6 +23,10 @@ DebugManager.include({
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['res_id', '=', selectedIDs[0]], ['model', '=', this._controller.modelName]],
context: {
default_res_model: this._controller.modelName,
default_res_id: selectedIDs[0],
},
});
},
});
@@ -14,6 +14,10 @@ QUnit.module('Mail DebugManager', {}, function () {
intercepts: {
do_action: function (event) {
assert.deepEqual(event.data.action, {
context: {
default_res_model: "testModel",
default_res_id: 5,
},
res_model: 'mail.message',
name: "Manage Messages",
views: [[false, 'list'], [false, 'form']],
@@ -365,6 +365,10 @@ DebugManager.include({
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['res_model', '=', this._action.res_model], ['res_id', '=', selectedIDs[0]]],
context: {
default_res_model: this._action.res_model,
default_res_id: selectedIDs[0],
},
});
},
get_metadata: function() {
@@ -46,6 +46,10 @@ QUnit.module('DebugManager', {}, function () {
intercepts: {
do_action: function (event) {
assert.deepEqual(event.data.action, {
context: {
default_res_model: "test.model",
default_res_id: 5,
},
domain: [["res_model", "=", "test.model"],["res_id", "=", 5]],
name: "Manage Attachments",
res_model: "ir.attachment",