[MERGE] merge with trunk upto revision no 607.
bzr revid: ysa@tinyerp.com-20110713043901-fxrmq4y5fv71q8ht
This commit is contained in:
@@ -324,7 +324,7 @@ def fix_view_modes(action):
|
||||
generate_views(action)
|
||||
|
||||
if action.pop('view_type') != 'form':
|
||||
return
|
||||
return action
|
||||
|
||||
action['views'] = [
|
||||
[id, mode if mode != 'tree' else 'list']
|
||||
|
||||
@@ -304,6 +304,7 @@ QWeb2.Engine = (function() {
|
||||
" /* START TEMPLATE */ try {\n" +
|
||||
(e.compile()) + "\n" +
|
||||
" /* END OF TEMPLATE */ } catch(error) {\n" +
|
||||
" if (console && console.exception) console.exception(error);\n" +
|
||||
" context.engine.tools.exception('Runtime Error: ' + error, context);\n" +
|
||||
" }\n" +
|
||||
" return r.join('');";
|
||||
|
||||
@@ -845,6 +845,7 @@ openerp.base.Dialog = openerp.base.BaseWidget.extend({
|
||||
this.$dialog.dialog('close');
|
||||
},
|
||||
stop: function () {
|
||||
this.close();
|
||||
this.$dialog.dialog('destroy');
|
||||
}
|
||||
});
|
||||
@@ -921,6 +922,11 @@ openerp.base.Login = openerp.base.Controller.extend({
|
||||
this.selected_db = localStorage.getItem('last_db_login_success');
|
||||
this.selected_login = localStorage.getItem('last_login_login_success');
|
||||
}
|
||||
if (jQuery.deparam(jQuery.param.querystring()).debug != undefined) {
|
||||
this.selected_db = this.selected_db || "trunk";
|
||||
this.selected_login = this.selected_login || "admin";
|
||||
this.selected_password = this.selected_password || "a";
|
||||
}
|
||||
},
|
||||
start: function() {
|
||||
var self = this;
|
||||
|
||||
@@ -1321,10 +1321,12 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({
|
||||
}
|
||||
this.$input.focusout(anyoneLoosesFocus);
|
||||
|
||||
var isSelecting = false;
|
||||
// autocomplete
|
||||
this.$input.autocomplete({
|
||||
source: function(req, resp) { self.get_search_result(req, resp); },
|
||||
select: function(event, ui) {
|
||||
isSelecting = true;
|
||||
var item = ui.item;
|
||||
if (item.id) {
|
||||
self._change_int_value([item.id, item.name]);
|
||||
@@ -1342,6 +1344,14 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({
|
||||
minLength: 0,
|
||||
delay: 0
|
||||
});
|
||||
// used to correct a bug when selecting an element by pushing 'enter' in an editable list
|
||||
this.$input.keyup(function(e) {
|
||||
if (e.which === 13) {
|
||||
if (isSelecting)
|
||||
e.stopPropagation();
|
||||
}
|
||||
isSelecting = false;
|
||||
});
|
||||
},
|
||||
// autocomplete component content handling
|
||||
get_search_result: function(request, response) {
|
||||
@@ -1811,7 +1821,8 @@ openerp.base.form.SelectCreatePopup = openerp.base.BaseWidget.extend({
|
||||
this.initial_ids = this.options.initial_ids;
|
||||
jQuery(this.render()).dialog({title: '',
|
||||
modal: true,
|
||||
minWidth: 800});
|
||||
width: 960,
|
||||
height: 600});
|
||||
this.start();
|
||||
},
|
||||
start: function() {
|
||||
|
||||
@@ -256,11 +256,12 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
|
||||
if (column.modifiers) {
|
||||
var modifiers = JSON.parse(column.modifiers);
|
||||
column.modifiers_for = function (fields) {
|
||||
var result = {};
|
||||
for (var modifier in modifiers) {
|
||||
result[modifier] = domain_computer(modifiers[modifier], fields);
|
||||
if (!modifiers.invisible) {
|
||||
return {};
|
||||
}
|
||||
return result;
|
||||
return {
|
||||
'invisible': domain_computer(modifiers.invisible, fields)
|
||||
};
|
||||
};
|
||||
} else {
|
||||
column.modifiers_for = noop;
|
||||
|
||||
@@ -9,7 +9,7 @@ openerp.base.ActionManager = openerp.base.Controller.extend({
|
||||
init: function(session, element_id) {
|
||||
this._super(session, element_id);
|
||||
this.viewmanager = null;
|
||||
this.dialog_stack = [];
|
||||
this.current_dialog = null;
|
||||
// Temporary linking view_manager to session.
|
||||
// Will use controller_parent to find it when implementation will be done.
|
||||
session.action_manager = this;
|
||||
@@ -22,34 +22,44 @@ openerp.base.ActionManager = openerp.base.Controller.extend({
|
||||
var self = this;
|
||||
action.flags = _.extend({
|
||||
sidebar : action.target != 'new',
|
||||
search_view : true,
|
||||
search_view : action.target != 'new',
|
||||
new_window : false,
|
||||
views_switcher : true,
|
||||
action_buttons : true,
|
||||
pager : true
|
||||
views_switcher : action.target != 'new',
|
||||
action_buttons : action.target != 'new',
|
||||
pager : action.target != 'new'
|
||||
}, action.flags || {});
|
||||
// instantiate the right controllers by understanding the action
|
||||
if (this.current_dialog) {
|
||||
this.current_dialog.stop();
|
||||
this.current_dialog = null;
|
||||
}
|
||||
if (this.current_dialog) {
|
||||
this.current_dialog.stop();
|
||||
this.current_dialog = null;
|
||||
} else if (this.view_manager && this.view_manager.current_dialog) {
|
||||
this.view_manager.current_dialog.stop();
|
||||
this.view_manager.current_dialog = null;
|
||||
}
|
||||
switch (action.type) {
|
||||
case 'ir.actions.act_window':
|
||||
if (!action.target && this.dialog_stack.length) {
|
||||
if (!action.target && this.current_dialog) {
|
||||
action.flags.new_window = true;
|
||||
}
|
||||
if (action.target == 'new') {
|
||||
var element_id = _.uniqueId("act_window_dialog");
|
||||
$('<div>', {id: element_id}).dialog({
|
||||
var dialog = this.current_dialog = new openerp.base.ActionDialog(this.session, {
|
||||
title: action.name,
|
||||
modal: true,
|
||||
width: '50%',
|
||||
height: 'auto'
|
||||
}).bind('dialogclose', function(event) {
|
||||
// When dialog is closed with ESC key or close manually, branch to act_window_close logic
|
||||
self.do_action({ type: 'ir.actions.act_window_close' });
|
||||
width: '50%'
|
||||
});
|
||||
var viewmanager = new openerp.base.ViewManagerAction(this.session, element_id, action);
|
||||
if (on_closed) {
|
||||
dialog.on_closed.add_first(on_closed);
|
||||
}
|
||||
dialog.start(false);
|
||||
var viewmanager = new openerp.base.ViewManagerAction(this.session, dialog.element_id, action);
|
||||
viewmanager.start();
|
||||
viewmanager.on_act_window_closed.add(on_closed);
|
||||
viewmanager.is_dialog = true;
|
||||
this.dialog_stack.push(viewmanager);
|
||||
// TODO: merge ActionManager & ViewManager in order to get rid of this circular reference
|
||||
viewmanager.current_dialog = dialog;
|
||||
dialog.viewmanager = viewmanager;
|
||||
dialog.open();
|
||||
} else if (action.flags.new_window) {
|
||||
action.flags.new_window = false;
|
||||
this.rpc("/base/session/save_session_action", { the_action : action}, function(key) {
|
||||
@@ -66,12 +76,6 @@ openerp.base.ActionManager = openerp.base.Controller.extend({
|
||||
}
|
||||
break;
|
||||
case 'ir.actions.act_window_close':
|
||||
var dialog = this.dialog_stack.pop();
|
||||
if (!action.special) {
|
||||
dialog.on_act_window_closed();
|
||||
}
|
||||
dialog.$element.dialog('destroy');
|
||||
dialog.stop();
|
||||
break;
|
||||
case 'ir.actions.server':
|
||||
this.rpc('/base/action/run', {
|
||||
@@ -100,7 +104,6 @@ openerp.base.ViewManager = openerp.base.Controller.extend({
|
||||
this.flags = this.flags || {};
|
||||
this.sidebar = new openerp.base.NullSidebar();
|
||||
this.registry = openerp.base.views;
|
||||
this.is_dialog = false;
|
||||
},
|
||||
/**
|
||||
* @returns {jQuery.Deferred} initial view loading promise
|
||||
@@ -228,11 +231,6 @@ openerp.base.ViewManager = openerp.base.Controller.extend({
|
||||
});
|
||||
return this.searchview.start();
|
||||
},
|
||||
/**
|
||||
* Called when this view manager has been created by an action 'act_window@target=new' is closed
|
||||
*/
|
||||
on_act_window_closed : function() {
|
||||
},
|
||||
/**
|
||||
* Called when one of the view want to execute an action
|
||||
*/
|
||||
@@ -354,6 +352,22 @@ openerp.base.ViewManagerAction = openerp.base.ViewManager.extend({
|
||||
}
|
||||
});
|
||||
|
||||
openerp.base.ActionDialog = openerp.base.Dialog.extend({
|
||||
identifier_prefix: 'action_dialog',
|
||||
close: function() {
|
||||
this._super(this, arguments);
|
||||
this.on_closed();
|
||||
},
|
||||
on_closed: function() {
|
||||
},
|
||||
stop: function() {
|
||||
this._super(this, arguments);
|
||||
if (this.viewmanager) {
|
||||
this.viewmanager.stop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
openerp.base.Sidebar = openerp.base.BaseWidget.extend({
|
||||
template: "ViewManager.sidebar",
|
||||
init: function(parent, view_manager) {
|
||||
@@ -408,6 +422,7 @@ openerp.base.Sidebar = openerp.base.BaseWidget.extend({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
openerp.base.NullSidebar = openerp.base.generate_null_object_class(openerp.base.Sidebar);
|
||||
|
||||
openerp.base.Export = openerp.base.Dialog.extend({
|
||||
@@ -455,28 +470,22 @@ openerp.base.View = openerp.base.Controller.extend({
|
||||
active_model: dataset.model
|
||||
});
|
||||
action.flags = {
|
||||
sidebar : false,
|
||||
search_view : false,
|
||||
views_switcher : false,
|
||||
action_buttons : false,
|
||||
pager : false,
|
||||
new_window: true
|
||||
};
|
||||
action_manager.do_action(action, on_closed);
|
||||
if (self.view_manager.is_dialog && action.type != 'ir.actions.act_window_close') {
|
||||
handler({
|
||||
result : { type: 'ir.actions.act_window_close' }
|
||||
});
|
||||
}
|
||||
} else {
|
||||
on_no_action(action);
|
||||
}
|
||||
};
|
||||
|
||||
if (action_data.special) {
|
||||
handler({
|
||||
result : { type: 'ir.actions.act_window_close', special: action_data.special }
|
||||
});
|
||||
if (action_manager.current_dialog) {
|
||||
action_manager.current_dialog.stop();
|
||||
action_manager.current_dialog = null;
|
||||
} else if (this.view_manager.current_dialog) {
|
||||
this.view_manager.current_dialog.stop();
|
||||
this.view_manager.current_dialog = null;
|
||||
}
|
||||
} else {
|
||||
var context = new openerp.base.CompoundContext(dataset.get_context(), action_data.context || {});
|
||||
switch(action_data.type) {
|
||||
|
||||
@@ -86,7 +86,8 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="password">Password:</label></td>
|
||||
<td><input type="password" name="password"/></td>
|
||||
<td><input type="password" name="password"
|
||||
t-att-value="selected_password || ''"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
@@ -522,9 +523,9 @@
|
||||
<span class="oe-m2o-cm-button" t-att-id="widget.name + '_open'">
|
||||
<img src="/base/static/src/img/icons/gtk-index.png"/></span>
|
||||
<div t-att-id="widget.cm_id" class="contextMenu" style="display:none"><ul>
|
||||
<li t-att-id="widget.cm_id + '_search'">Search...</li>
|
||||
<li t-att-id="widget.cm_id + '_create'">Create New...</li>
|
||||
<li t-att-id="widget.cm_id + '_open'" style="color:grey">Open...</li>
|
||||
<li t-att-id="widget.cm_id + '_create'">Create and Edit...</li>
|
||||
<li t-att-id="widget.cm_id + '_search'">Search...</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
</t>
|
||||
@@ -884,9 +885,19 @@
|
||||
</t>
|
||||
<t t-name="SelectCreatePopup">
|
||||
<div t-att-id="element_id">
|
||||
<div t-att-id="element_id + '_search'"></div>
|
||||
<div t-att-id="element_id + '_view_list'"></div>
|
||||
<div t-att-id="element_id + '_view_form'"></div>
|
||||
<table style="width:100%">
|
||||
<tr style="width:100%">
|
||||
<td style="width:100%">
|
||||
<div t-att-id="element_id + '_search'" style="width:100%"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="width:100%">
|
||||
<td style="width:100%">
|
||||
<div t-att-id="element_id + '_view_list'" style="width:100%"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div t-att-id="element_id + '_view_form'" style="width:100%"></div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="SelectCreatePopup.search.buttons">
|
||||
|
||||
Reference in New Issue
Block a user