openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #00650
[Merge] lp:~openerp-dev/openobject-client-web/sidebar-domain-context into lp:openobject-client-web
sma (Open ERP) has proposed merging lp:~openerp-dev/openobject-client-web/sidebar-domain-context into lp:openobject-client-web.
Requested reviews:
OpenERP SA's Web Client R&D (openerp-dev-web)
Related bugs:
#675578 [v6 trunk] domain not working in Customer
https://bugs.launchpad.net/bugs/675578
* Long url problem occur due to data, so removed data from the side bar.
* For sidebar domain, from addons module set context like,
context="{'search_default_partner_id': [active_id]}"
So need to evaluate active_id in list.
* Passed selected id from the do_action.
* When no record is selected in listview and perform any action from side bar,
before that we alert 'You must select at least one record.' But now we are remove this.
So can we pass listview 1st id? or put the alert again.
--
https://code.launchpad.net/~openerp-dev/openobject-client-web/sidebar-domain-context/+merge/41567
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-client-web/sidebar-domain-context.
=== modified file 'addons/openerp/static/javascript/form.js'
--- addons/openerp/static/javascript/form.js 2010-11-18 15:08:20 +0000
+++ addons/openerp/static/javascript/form.js 2010-11-23 10:47:44 +0000
@@ -823,18 +823,18 @@
function do_action(src, context_menu) {
var params = {};
+ var $src = jQuery(src);
+ var field = $src.attr('field') || '_terp_id';
+ var source = jQuery('[id="'+field+'"]').attr('id');
+
if (openobject.dom.get('_terp_list')) {
params['_terp_selection'] = '[' +
new ListView('_terp_list').getSelectedRecords().join(',') +
']';
+ } else {
+ var id = jQuery('[id="'+field+'"]').val();
}
-
- var $src = jQuery(src);
- var field = $src.attr('field') || '_terp_id';
-
- var id = jQuery('[id="'+field+'"]').val();
- var source = jQuery('[id="'+field+'"]').attr('id');
-
+
var action_id = $src.attr('action_id') || null;
var relation = $src.attr('relation');
var datas = $src.attr('data') || null;
=== modified file 'addons/openerp/utils/tools.py'
--- addons/openerp/utils/tools.py 2010-11-17 10:47:30 +0000
+++ addons/openerp/utils/tools.py 2010-11-23 10:47:44 +0000
@@ -55,6 +55,8 @@
for i,v in string.items():
if v=='active_id':
string[i] = eval(v,context)
+ elif v==['active_id']:
+ string[i] = eval(v[0],context)
return string
def node_attributes(node):
=== modified file 'addons/openerp/widgets/search.py'
--- addons/openerp/widgets/search.py 2010-11-12 11:05:16 +0000
+++ addons/openerp/widgets/search.py 2010-11-23 10:47:44 +0000
@@ -51,15 +51,15 @@
screen_context = screen_context or {}
default_domain = attrs.get('default_domain', default_domain)
default_search = False
-
+ from_context = False
default_val = attrs.get('default')
if default_val:
default_val = expr_eval(default_val, {'context':screen_context})
if attrs.get('name', False):
context_str = 'search_default_' + str(attrs['name'])
- default_search = screen_context.get(context_str, False)
-
+ from_context = screen_context.get(context_str, False)
+ default_search = from_context
if flag:
if default_domain and attrs.get('domain'):
domain = expr_eval(attrs.get('domain'))
@@ -70,7 +70,8 @@
else:
default_val = default_search = False
else:
- default_val = default_search = False
+ if not from_context:
+ default_val = default_search = False
if attrs.get('context'):
ctx = expr_eval(attrs.get('context', "{}"), {'self':attrs.get('name', False)})
=== modified file 'addons/openerp/widgets/templates/sidebar.mako'
--- addons/openerp/widgets/templates/sidebar.mako 2010-11-18 14:48:04 +0000
+++ addons/openerp/widgets/templates/sidebar.mako 2010-11-23 10:47:44 +0000
@@ -1,13 +1,14 @@
<%def name="sidebox_action_item(item, model, submenu, icon)">
% if submenu != 1:
- <li data="${item}" action_id="${item['id']}" relation="${model}" onclick="validate_action(this, do_action)">
+ <li action_id="${item['id']}" relation="${model}" domain="${item.get('domain')}"
+ context="${item.get('context')}" onclick="validate_action(this, do_action)">
% if icon:
<img src="${icon}" alt=""/>
% endif
<a href="javascript: void(0)" onclick="return false">${item['name']}</a>
</li>
% else:
- <li data="${item}">
+ <li>
% if icon:
<img src="${icon}" alt=""/>
% endif
Follow ups