summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2013-10-18 12:36:31 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2013-10-18 12:36:31 +0200
commite080294dc0d47c9abb77dff587d2e1dd9e3642a7 (patch)
tree9888d24957563b75ac7c93d18fb4a71383020e83 /addons/web
parent5696282656e22df91591800333258d6ecf378df2 (diff)
parent3853f642ff327f886086c7a766cdf76da7a2b906 (diff)
[MERGE] saas2
bzr revid: nicolas.vanhoren@openerp.com-20131018103631-vennug4iy21zhp3x
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/controllers/main.py2
-rw-r--r--addons/web/http.py19
-rw-r--r--addons/web/static/src/css/base.css34
-rw-r--r--addons/web/static/src/css/base.sass36
-rw-r--r--addons/web/static/src/js/chrome.js2
-rw-r--r--addons/web/static/src/js/data_export.js48
-rw-r--r--addons/web/static/src/js/view_form.js2
-rw-r--r--addons/web/static/src/js/view_list.js7
-rw-r--r--addons/web/static/src/xml/base.xml14
9 files changed, 82 insertions, 82 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 9ac4877d3d4..5ed0c8326f4 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -1685,8 +1685,6 @@ class Reports(http.Controller):
if 'ids' in action['datas']:
report_ids = action['datas'].pop('ids')
report_data.update(action['datas'])
- if not report_ids:
- raise ValueError("action['datas']['ids'] and context['active_ids'] are undefined")
report_id = report_srv.report(
request.session.db, request.session.uid, request.session.password,
diff --git a/addons/web/http.py b/addons/web/http.py
index b5d5fae3d63..7da80b9d354 100644
--- a/addons/web/http.py
+++ b/addons/web/http.py
@@ -21,6 +21,7 @@ import urlparse
import uuid
import errno
import re
+import warnings
import babel.core
import simplejson
@@ -35,7 +36,7 @@ import urllib
import urllib2
import openerp
-import openerp.service.security as security
+from openerp.service import security, model as service_model
from openerp.tools import config
import inspect
@@ -181,6 +182,10 @@ class WebRequest(object):
def debug(self):
return 'debug' in self.httprequest.args
+ @contextlib.contextmanager
+ def registry_cr(self):
+ warnings.warn('please use request.registry and request.cr directly', DeprecationWarning)
+ yield (self.registry, self.cr)
def auth_method_user():
request.uid = request.session.uid
@@ -390,7 +395,7 @@ def jsonrequest(f):
base = f.__name__.lstrip('/')
if f.__name__ == "index":
base = ""
- return route([base, base + "/<path:_ignored_path>"], type="json", auth="none")(f)
+ return route([base, base + "/<path:_ignored_path>"], type="json", auth="user")(f)
class HttpRequest(WebRequest):
""" Regular GET/POST request
@@ -402,7 +407,6 @@ class HttpRequest(WebRequest):
params = dict(self.httprequest.args)
params.update(self.httprequest.form)
params.update(self.httprequest.files)
-
params.pop('session_id', None)
self.params = params
@@ -460,7 +464,7 @@ def httprequest(f):
base = f.__name__.lstrip('/')
if f.__name__ == "index":
base = ""
- return route([base, base + "/<path:_ignored_path>"], type="http", auth="none")(f)
+ return route([base, base + "/<path:_ignored_path>"], type="http", auth="user")(f)
#----------------------------------------------------------
# Local storage of requests
@@ -1034,10 +1038,17 @@ class Root(object):
func, arguments = urls.match(path)
arguments = dict([(k, v) for k, v in arguments.items() if not k.startswith("_ignored_")])
+ @service_model.check
+ def checked_call(dbname, *a, **kw):
+ return func(*a, **kw)
+
def nfunc(*args, **kwargs):
kwargs.update(arguments)
if getattr(func, '_first_arg_is_req', False):
args = (request,) + args
+
+ if request.db:
+ return checked_call(request.db, *args, **kwargs)
return func(*args, **kwargs)
request.func = nfunc
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 51c3fd30f3c..5420462cbf1 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -700,10 +700,8 @@
.openerp .oe_dropdown_menu {
display: none;
position: absolute;
- top: 26px;
z-index: 3;
margin: 0;
- padding: 0;
border: 1px solid #afafb6;
background: white;
padding: 4px 0;
@@ -1116,7 +1114,7 @@
border-color: #999999;
border-color: rgba(0, 0, 0, 0.2);
border-style: solid;
- border-width: 0 1px 1px;
+ border-width: 0 2px 1px;
-moz-border-radius: 0 0 6px 6px;
-webkit-border-radius: 0 0 6px 6px;
border-radius: 0 0 6px 6px;
@@ -2736,32 +2734,20 @@
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
-.openerp ul.oe_form_status .oe_folded .label, .openerp ul.oe_form_status_clickable .oe_folded .label {
- padding-bottom: 8px;
-}
-.openerp ul.oe_form_status .oe_folded ul, .openerp ul.oe_form_status_clickable .oe_folded ul {
- position: absolute;
- z-index: 1000;
- border-top: 1px solid #cacaca;
- float: none;
- top: 30px;
- right: 0;
+.openerp ul.oe_form_status ul.oe_dropdown_menu, .openerp ul.oe_form_status_clickable ul.oe_dropdown_menu {
display: none;
+ padding: 0;
+ min-width: 0;
}
-.openerp ul.oe_form_status .oe_folded ul li, .openerp ul.oe_form_status_clickable .oe_folded ul li {
- margin: 0;
- border-left: 1px solid #cacaca;
+.openerp ul.oe_form_status ul.oe_dropdown_menu.oe_opened, .openerp ul.oe_form_status_clickable ul.oe_dropdown_menu.oe_opened {
display: block;
}
-.openerp ul.oe_form_status .oe_folded ul li.label, .openerp ul.oe_form_status_clickable .oe_folded ul li.label {
- border: 0;
- padding-left: 24px;
-}
-.openerp ul.oe_form_status .oe_folded ul li:last-child, .openerp ul.oe_form_status_clickable .oe_folded ul li:last-child {
- border-bottom: 1px solid #cacaca;
+.openerp ul.oe_form_status ul.oe_dropdown_menu li, .openerp ul.oe_form_status_clickable ul.oe_dropdown_menu li {
+ margin: 0;
+ width: 100%;
}
-.openerp ul.oe_form_status .oe_folded:hover ul, .openerp ul.oe_form_status_clickable .oe_folded:hover ul {
- display: block;
+.openerp ul.oe_form_status ul.oe_dropdown_menu li span.label, .openerp ul.oe_form_status_clickable ul.oe_dropdown_menu li span.label {
+ padding-left: 14px;
}
.openerp ul.oe_form_status li.oe_active, .openerp ul.oe_form_status_clickable li.oe_active {
background-color: #5382b9;
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index a0231387e7f..5900eb9d268 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -606,10 +606,8 @@ $sheet-padding: 16px
.oe_dropdown_menu
display: none
position: absolute
- top: 26px
z-index: 3
margin: 0
- padding: 0
border: 1px solid $tag-border
background: white
padding: 4px 0
@@ -914,7 +912,7 @@ $sheet-padding: 16px
border-color: #999
border-color: rgba(0, 0, 0, 0.2)
border-style: solid
- border-width: 0 1px 1px
+ border-width: 0 2px 1px
@include radius(0 0 6px 6px)
@include background-clip()
li
@@ -2174,28 +2172,18 @@ $sheet-padding: 16px
@include skew-gradient(#fcfcfc, #dedede)
@include radius(3px)
@include transform(rotate(45deg))
- .oe_folded
- .label
- padding-bottom: 8px
- ul
- position: absolute
- z-index: 1000
- border-top: 1px solid #cacaca
- float: none
- top: 30px
- right: 0
- display: none
- li
- margin: 0
- border-left: 1px solid #cacaca
- display: block
- li.label
- border: 0
- padding-left: 24px
- li:last-child
- border-bottom: 1px solid #cacaca
- &:hover ul
+ ul.oe_dropdown_menu
+ display: none
+ padding: 0
+ min-width: 0
+ &.oe_opened
display: block
+ li
+ margin: 0
+ width: 100%
+ span.label
+ padding-left: 14px
+
li.oe_active
@include vertical-gradient(#729fcf, #3465a4)
> .arrow span
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 09694bb0c38..0cdffb0d6b0 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -1247,6 +1247,7 @@ instance.web.Client = instance.web.Widget.extend({
this.$el.on('click', '.oe_dropdown_toggle', function(ev) {
ev.preventDefault();
var $toggle = $(this);
+ var doc_width = $(document).width();
var $menu = $toggle.siblings('.oe_dropdown_menu');
$menu = $menu.size() >= 1 ? $menu : $toggle.find('.oe_dropdown_menu');
var state = $menu.is('.oe_opened');
@@ -1255,7 +1256,6 @@ instance.web.Client = instance.web.Widget.extend({
$toggle.add($menu).toggleClass('oe_opened', !state);
if (!state) {
// Move $menu if outside window's edge
- var doc_width = $(document).width();
var offset = $menu.offset();
var menu_width = $menu.width();
var x = doc_width - offset.left - menu_width - 2;
diff --git a/addons/web/static/src/js/data_export.js b/addons/web/static/src/js/data_export.js
index f642f0a334d..2725e18ea6e 100644
--- a/addons/web/static/src/js/data_export.js
+++ b/addons/web/static/src/js/data_export.js
@@ -62,8 +62,21 @@ instance.web.DataExport = instance.web.Dialog.extend({
});
}).change();
+ var got_domain = this.getParent().get_active_domain().then(function (domain) {
+ if (domain === undefined) {
+ self.ids_to_export = self.getParent().get_selected_ids();
+ self.domain = self.dataset.domain;
+ }
+ else {
+ self.ids_to_export = false;
+ self.domain = domain;
+ }
+ self.on_show_domain();
+ });
+
return $.when(
got_fields,
+ got_domain,
this.rpc('/web/export/formats', {}).done(this.do_setup_export_formats),
this.show_exports_list());
},
@@ -196,6 +209,9 @@ instance.web.DataExport = instance.web.Dialog.extend({
self.showcontent(record.id);
}
},
+ on_show_domain: function() {
+ this.$el.find('tr').first().find('td').append(QWeb.render('ExportTreeView-Domain', {'record': this}));
+ },
on_show_data: function(result, after) {
var self = this;
@@ -384,27 +400,17 @@ instance.web.DataExport = instance.web.Dialog.extend({
var export_format = this.$el.find("#export_format").val();
- this.getParent().get_active_domain().then(function (domain) {
- if (domain === undefined) {
- var ids_to_export = self.getParent().get_selected_ids();
- var domain = self.dataset.domain;
- }
- else {
- var ids_to_export = false;
- var domain = domain;
- }
- instance.web.blockUI();
- self.session.get_file({
- url: '/web/export/' + export_format,
- data: {data: JSON.stringify({
- model: self.dataset.model,
- fields: exported_fields,
- ids: ids_to_export,
- domain: domain,
- import_compat: !!self.$el.find("#import_compat").val(),
- })},
- complete: instance.web.unblockUI,
- });
+ instance.web.blockUI();
+ this.session.get_file({
+ url: '/web/export/' + export_format,
+ data: {data: JSON.stringify({
+ model: this.dataset.model,
+ fields: exported_fields,
+ ids: this.ids_to_export,
+ domain: this.domain,
+ import_compat: !!this.$el.find("#import_compat").val(),
+ })},
+ complete: instance.web.unblockUI,
});
},
close: function() {
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index c096dd884ad..cf3d8414795 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -5475,7 +5475,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
});
this.get_selection();
if (this.options.clickable) {
- this.$el.on('click','li:not(.oe_folded)',this.on_click_stage);
+ this.$el.on('click','li[data-id]',this.on_click_stage);
}
if (this.$el.parent().is('header')) {
this.$el.after('<div class="oe_clear"/>');
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index f9ec22bf712..9c613935aa1 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -802,9 +802,11 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
},
/**
* Calculate the active domain of the list view. This should be done only
- * if the header checkbox has been checked.
+ * if the header checkbox has been checked. This is done by evaluating the
+ * search results, and then adding the dataset domain (i.e. action domain).
*/
get_active_domain: function () {
+ var self = this;
if (this.$('.oe_list_record_selector').prop('checked')) {
var search_view = this.getParent().searchview;
var search_data = search_view.build_search_data();
@@ -813,7 +815,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
contexts: search_data.contexts,
group_by_seq: search_data.groupbys || []
}).then(function (results) {
- return results.domain;
+ var domain = self.dataset.domain.concat(results.domain || []);
+ return domain
});
}
else {
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 20ee2545cf2..46241435fcf 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1228,9 +1228,9 @@
</li>
</t>
<t t-if="widget.selection.folded.length">
- <li t-att-class="value_folded ? 'oe_active oe_folded' : 'oe_folded'">
- <span class="label"> ... </span>
- <ul>
+ <li>
+ <span class="label oe_dropdown_toggle oe_dropdown_arrow">More</span>
+ <ul class="oe_dropdown_menu">
<t t-foreach="widget.selection.folded" t-as="i">
<li t-att-class="i[0] === widget.get('value') ? 'oe_active' : ''" t-att-data-id="i[0]">
<span class="label"><t t-esc="i[1]"/></span>
@@ -1775,6 +1775,14 @@
</td>
</tr>
</table>
+<t t-name="ExportTreeView-Domain">
+ <t t-if="! record.ids_to_export">
+ <p><strong>Please pay attention that all records matching your search filter will be exported. Not only the selected ids.</strong></p>
+ </t>
+ <t t-if="record.ids_to_export">
+ <p><strong>Please note that only the selected ids will be exported.</strong></p>
+ </t>
+</t>
<table t-name="ExportTreeView-Secondary"
id="field-tree-structure" class="oe_export_fields_selector_export"
cellspacing="0" cellpadding="0">