[MERGE] from trunk

bzr revid: fva@openerp.com-20120920115126-0lydpibguzfu6zm4
This commit is contained in:
Frédéric van der Essen 2012-09-20 13:51:26 +02:00
commit 9d8fecf6a1
8 changed files with 138 additions and 2907 deletions

View File

@ -1922,7 +1922,7 @@ class Reports(View):
report = zlib.decompress(report) report = zlib.decompress(report)
report_mimetype = self.TYPES_MAPPING.get( report_mimetype = self.TYPES_MAPPING.get(
report_struct['format'], 'octet-stream') report_struct['format'], 'octet-stream')
file_name = None file_name = action.get('name', 'report')
if 'name' not in action: if 'name' not in action:
reports = req.session.model('ir.actions.report.xml') reports = req.session.model('ir.actions.report.xml')
res_id = reports.search([('report_name', '=', action['report_name']),], res_id = reports.search([('report_name', '=', action['report_name']),],

File diff suppressed because it is too large Load Diff

View File

@ -475,6 +475,12 @@ $sheet-max-width: 860px
text-decoration: none text-decoration: none
margin-bottom: 1px margin-bottom: 1px
// }}} // }}}
.oe_form
header
.oe_tags
margin:5px 0 0 5px
width:400px
padding-bottom:0
// Tooltips {{{ // Tooltips {{{
&.oe_tooltip &.oe_tooltip
font-size: 12px font-size: 12px
@ -563,7 +569,7 @@ $sheet-max-width: 860px
position: absolute position: absolute
top: 26px top: 26px
left: 0 left: 0
z-index: 1 z-index: 3
margin: 0 margin: 0
padding: 0 padding: 0
border: 1px solid $tag-border border: 1px solid $tag-border
@ -1552,7 +1558,7 @@ $sheet-max-width: 860px
margin: 16px margin: 16px
> header > header
margin: -16px -16px 0 -16px margin: -16px -16px 0 -16px
padding: 8px padding: 0
.oe_form_sheetbg .oe_form_sheetbg
padding: 8px 0 padding: 8px 0
.oe_form_sheet_width .oe_form_sheet_width
@ -1798,6 +1804,9 @@ $sheet-max-width: 860px
* http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image * http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image
*/ */
.oe_hidden_input_file .oe_hidden_input_file
// Position: relative is used for the hidden input[type=file]
// Do not remove it anymore !
position: relative
input.oe_form_binary_file input.oe_form_binary_file
z-index: 0 z-index: 0
line-height: 0 line-height: 0

View File

@ -162,8 +162,9 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.$el.find(".oe_form_group_row,.oe_form_field,label").on('click', function (e) { this.$el.find(".oe_form_group_row,.oe_form_field,label").on('click', function (e) {
if(self.get("actual_mode") == "view") { if(self.get("actual_mode") == "view") {
var $button = self.options.$buttons.find(".oe_form_button_edit"); var $button = self.options.$buttons.find(".oe_form_button_edit");
$button.effect('bounce', {distance: 18, times: 5}, 150) $button.effect('bounce', {distance: 18, times: 5}, 150);
e.stopPropagation(); e.stopPropagation();
instance.web.bus.trigger('click', e);
} }
}); });
@ -270,9 +271,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
if (this.$buttons) { if (this.$buttons) {
this.$buttons.show(); this.$buttons.show();
} }
if (this.$pager) {
this.$pager.show();
}
this.$el.show().css({ this.$el.show().css({
opacity: '0', opacity: '0',
filter: 'alpha(opacity = 0)' filter: 'alpha(opacity = 0)'
@ -408,7 +406,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.$pager.remove(); this.$pager.remove();
if (this.get("actual_mode") === "create") if (this.get("actual_mode") === "create")
return; return;
this.$pager = $(QWeb.render("FormView.pager", {'widget':self})); this.$pager = $(QWeb.render("FormView.pager", {'widget':self})).hide();
if (this.options.$pager) { if (this.options.$pager) {
this.$pager.appendTo(this.options.$pager); this.$pager.appendTo(this.options.$pager);
} else { } else {
@ -421,8 +419,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.do_update_pager(); this.do_update_pager();
}, },
do_update_pager: function(hide_index) { do_update_pager: function(hide_index) {
this.$pager.find('button').prop('disabled', this.dataset.ids.length < 2); this.$pager.toggle(this.dataset.ids.length > 1);
if (hide_index || this.dataset.ids.length <= 1) { if (hide_index) {
$(".oe_form_pager_state", this.$pager).html(""); $(".oe_form_pager_state", this.$pager).html("");
} else { } else {
$(".oe_form_pager_state", this.$pager).html(_.str.sprintf(_t("%d / %d"), this.dataset.index + 1, this.dataset.ids.length)); $(".oe_form_pager_state", this.$pager).html(_.str.sprintf(_t("%d / %d"), this.dataset.index + 1, this.dataset.ids.length));

View File

@ -1120,7 +1120,7 @@
<t t-call="HiddenInputFile"> <t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileupload_id"/> <t t-set="fileupload_id" t-value="widget.fileupload_id"/>
<t t-set="fileupload_style">width: 83px;</t> <t t-set="fileupload_style">width: 83px;</t>
<button class="oe_button oe_field_button" type="button" title="Set Image"> <button class="oe_button oe_field_button" type="button">
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY.png"'/> <img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY.png"'/>
<span>Select</span> <span>Select</span>
</button> </button>

View File

@ -130,7 +130,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
case 'field': case 'field':
if(this.fields_view.fields[ node.attrs['name'] ].type == 'many2many'){ if(this.fields_view.fields[ node.attrs['name'] ].type == 'many2many'){
node.tag = 'div'; node.tag = 'div';
node.attrs['class'] = 'oe_kanban_many2many_tags'; node.attrs['class'] = 'oe_form_field oe_tags';
node.attrs['model'] = this.fields_view.fields[node.attrs['name']].relation; node.attrs['model'] = this.fields_view.fields[node.attrs['name']].relation;
node.attrs['t-att-data'] = 'record.' + node.attrs['name'] + '.raw_value'; node.attrs['t-att-data'] = 'record.' + node.attrs['name'] + '.raw_value';
}else { }else {
@ -176,37 +176,6 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
} }
} }
}, },
/* widget for list of tags/categories...
*/
transform_widget_many2many: function(){
var self=this,
arg={};
// select all widget
self.$el.find(".oe_kanban_many2many_tags").each(function(){
var model = $(this).attr("model");
var data = $(this).attr("data");
var list = data.split(",");
//select all id (per model)
if(!arg[model]) arg[model]=[];
for(var t=0;t<list.length;t++) if(list[t]!="") arg[model].push( list[t] );
});
// only one request by model
for(var model in arg){
if(arg[model].length>0){
var dataset = new instance.web.DataSetSearch(self, model, self.session.context);
dataset.name_get(_.uniq( arg[model] )).then(
function(result) {
for(var t=0;t<result.length;t++){
self.$el.find(".oe_kanban_many2many_tags[model='" + model + "']")
.filter(function(){ return this.getAttribute("data").match(new RegExp('(^|,)'+result[t][0]+'(,|$)')); })
.append('<span class="oe_tag" data-list_id="' + result[t][0] +'"">'+result[t][1]+'</span>');
}
}
);
}
}
},
do_add_record: function() { do_add_record: function() {
this.dataset.index = null; this.dataset.index = null;
this.do_switch_view('form'); this.do_switch_view('form');
@ -394,7 +363,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
} else { } else {
this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle');
} }
this.transform_widget_many2many(); instance.web_kanban.KanbanView.postprocessing_widget_many2many_tags(self);
}, },
on_record_moved : function(record, old_group, old_index, new_group, new_index) { on_record_moved : function(record, old_group, old_index, new_group, new_index) {
var self = this; var self = this;
@ -479,6 +448,42 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
} }
}); });
/*
* widget for list of tags/categories
* make the rpc request for all ids/model and insert value inside .oe_tags fields
*/
instance.web_kanban.KanbanView.postprocessing_widget_many2many_tags = function(self){
var model_list_id={};
// select all widget for the kanban view or the widget inside the record
self.$el.find(".oe_form_field.oe_tags").each(function(){
var model = $(this).attr("model");
if(model.length){
var data = $(this).attr("data");
var list = data.split(",");
//select all id (per model)
if(!model_list_id[model]) model_list_id[model]=[];
for(var t=0;t<list.length;t++) if(list[t]!="") model_list_id[model].push( list[t] );
}
});
// rpc and insert
for(var model in model_list_id){
if(model_list_id[model].length>0){
var block = self.$el.find(".oe_form_field.oe_tags[model='" + model + "']");
var dataset = new instance.web.DataSetSearch(self, model, self.session.context);
dataset.name_get(_.uniq( model_list_id[model] )).then(
function(result) {
for(var t=0;t<result.length;t++){
block.filter(function(){ return this.getAttribute("data").match(new RegExp('(^|,)'+result[t][0]+'(,|$)')); })
.append('<span class="oe_tag" data-list_id="' + result[t][0] +'"">'+result[t][1]+'</span>');
}
}
);
}
}
}
function get_class(name) { function get_class(name) {
return new instance.web.Registry({'tmp' : name}).get_object("tmp"); return new instance.web.Registry({'tmp' : name}).get_object("tmp");
} }
@ -551,7 +556,9 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({
}); });
this.$el.find('.oe_kanban_add').click(function () { this.$el.find('.oe_kanban_add').click(function () {
if (self.quick) { return; } if (self.quick) {
return self.quick.trigger('close');
}
var ctx = {}; var ctx = {};
ctx['default_' + self.view.group_by] = self.value; ctx['default_' + self.view.group_by] = self.value;
self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, ctx, true) self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, ctx, true)
@ -911,6 +918,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({
self.$el.data('widget', self); self.$el.data('widget', self);
self.bind_events(); self.bind_events();
self.group.compute_cards_auto_height(); self.group.compute_cards_auto_height();
instance.web_kanban.KanbanView.postprocessing_widget_many2many_tags(self);
} else { } else {
self.destroy(); self.destroy();
} }
@ -1011,7 +1019,8 @@ instance.web_kanban.QuickCreate = instance.web.Widget.extend({
$(".oe_kanban_quick_create_add", this.$el).click(function () { $(".oe_kanban_quick_create_add", this.$el).click(function () {
self.quick_add(); self.quick_add();
}); });
$(".oe_kanban_quick_create_close", this.$el).click(function () { $(".oe_kanban_quick_create_close", this.$el).click(function (ev) {
ev.preventDefault();
self.trigger('close'); self.trigger('close');
}); });
self.$input.keyup(function(e) { self.$input.keyup(function(e) {
@ -1029,7 +1038,7 @@ instance.web_kanban.QuickCreate = instance.web.Widget.extend({
quick_add: function () { quick_add: function () {
var self = this; var self = this;
this._dataset.call( this._dataset.call(
'name_create', [self.$input.val(), new instance.web.CompoundContext( 'name_create', [self.$input.val() || false, new instance.web.CompoundContext(
this._dataset.get_context(), this._context)]) this._dataset.get_context(), this._context)])
.pipe(function(record) { .pipe(function(record) {
self.$input.val(""); self.$input.val("");

View File

@ -86,7 +86,7 @@
<t t-if="widget._buttons"> <t t-if="widget._buttons">
<div class="oe_kanban_quick_create_buttons"> <div class="oe_kanban_quick_create_buttons">
<button class="oe_kanban_quick_create_add">Add</button> <button class="oe_kanban_quick_create_add">Add</button>
or <a class="oe_kanban_quick_create_close">Cancel</a> or <a href="#" class="oe_kanban_quick_create_close">Cancel</a>
</div> </div>
</t> </t>
</div> </div>

View File

@ -0,0 +1,20 @@
# French (Canada) translation for openerp-web
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openerp-web package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openerp-web\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-07-02 09:06+0200\n"
"PO-Revision-Date: 2012-09-19 12:09+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: French (Canada) <fr_CA@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-09-20 04:49+0000\n"
"X-Generator: Launchpad (build 15985)\n"