mirror of https://github.com/OCA/web.git
[FIX] ActWindow from Python Method after Popup
Allow python methods called from an ir.action.act_window.message action to return window actions without specifying the ``views`` key, as they would be if called from a button defined in xml. ``view_mode`` key is used for creating the views array as it is required anywaypull/846/head
parent
1f77e3adc8
commit
b8be5bf9ed
|
@ -78,6 +78,29 @@ openerp.web_ir_actions_act_window_message = function(instance)
|
|||
{
|
||||
if(_.isObject(result))
|
||||
{
|
||||
if (! ('views' in result) && 'view_mode' in result){
|
||||
types = result.view_mode.split(",");
|
||||
if (types.length > 1){
|
||||
if (types.includes('tree') && types.includes('form')){
|
||||
if (types[0] === "tree"){
|
||||
views = [[false, "list"], [false, types[1]]];
|
||||
result.view_mode = "list" + ',' + types[1];
|
||||
}
|
||||
else {
|
||||
views = [[false, types[0]], [false, "list"]];
|
||||
result.view_mode = types[0] + ',' + "list";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (result.view_mode === 'form'){
|
||||
views = [[false, "form"]];
|
||||
}
|
||||
else if (result.view_mode === 'tree'){
|
||||
views = [[false, "list"]];
|
||||
result.view_mode = 'list';
|
||||
}
|
||||
result.views = views;
|
||||
}
|
||||
self.do_action(result);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue