merge trunk
bzr revid: nicolas.vanhoren@openerp.com-20120525131037-n077w3nh3mu70y62 bzr revid: nicolas.vanhoren@openerp.com-20120525142624-rdkx40r0w1cahdto
This commit is contained in:
commit
ce77d86da4
|
@ -595,6 +595,7 @@
|
|||
background-color: none;
|
||||
}
|
||||
.openerp .oe_user_menu .oe_dropdown_options li a {
|
||||
white-space: nowrap;
|
||||
display: block;
|
||||
padding: 4px 15px;
|
||||
clear: both;
|
||||
|
@ -1744,6 +1745,9 @@
|
|||
right: 5px;
|
||||
top: 3px;
|
||||
}
|
||||
.openerp .oe_form .oe_form_group_cell .oe_kanban_view {
|
||||
position: static;
|
||||
}
|
||||
.openerp .oe_form .oe_form_button.oe_button {
|
||||
height: 22px;
|
||||
color: #4c4c4c;
|
||||
|
|
|
@ -499,6 +499,7 @@ $colour4: #8a89ba
|
|||
display: block
|
||||
background-color: none
|
||||
a
|
||||
white-space: nowrap
|
||||
display: block
|
||||
padding: 4px 15px
|
||||
clear: both
|
||||
|
@ -1420,6 +1421,9 @@ $colour4: #8a89ba
|
|||
filter: alpha(opacity=50)
|
||||
right: 5px
|
||||
top: 3px
|
||||
.oe_form_group_cell .oe_kanban_view
|
||||
// Hack due to absolute positioning of kanban view messing with o2m
|
||||
position: static
|
||||
// }}}
|
||||
// FormView.buttons {{{
|
||||
.oe_form
|
||||
|
|
|
@ -331,6 +331,9 @@ instance.web.EventDispatcherMixin = _.extend({}, instance.web.ParentedMixin, {
|
|||
},
|
||||
on: function(events, dest, func) {
|
||||
var self = this;
|
||||
if (!(func instanceof Function)) {
|
||||
throw new Error("Event handler must be a function.");
|
||||
}
|
||||
events = events.split(/\s+/);
|
||||
_.each(events, function(eventName) {
|
||||
self.__edispatcherEvents.on(eventName, func, dest);
|
||||
|
|
|
@ -2952,6 +2952,12 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({
|
|||
var pop = new instance.web.form.FormOpenPopup(self.o2m.view);
|
||||
pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(), {
|
||||
title: _t("Open: ") + self.name,
|
||||
create_function: function(data) {
|
||||
return self.o2m.dataset.create(data).then(function(r) {
|
||||
self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r.result]));
|
||||
self.o2m.dataset.on_change();
|
||||
});
|
||||
},
|
||||
write_function: function(id, data, options) {
|
||||
return self.o2m.dataset.write(id, data, {}).then(function() {
|
||||
self.o2m.reload_current_view();
|
||||
|
@ -2966,6 +2972,9 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({
|
|||
form_view_options: {'not_interactible_on_create':true},
|
||||
readonly: self.o2m.get("effective_readonly")
|
||||
});
|
||||
pop.on_select_elements.add_last(function() {
|
||||
self.o2m.reload_current_view();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
@charset "utf-8";
|
||||
.openerp .oe_kanban_view {
|
||||
position: absolute;
|
||||
top: 111px;
|
||||
top: 118px;
|
||||
bottom: 0;
|
||||
left: 221px;
|
||||
right: 0;
|
||||
}
|
||||
.openerp .oe_kanban_view .ui-sortable-placeholder {
|
||||
border: 1px dotted black;
|
||||
|
@ -20,6 +22,7 @@
|
|||
}
|
||||
.openerp .oe_kanban_view .oe_kanban_groups {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.openerp .oe_kanban_view .oe_kanban_group_title {
|
||||
margin: 1px 1px 4px;
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
.openerp .oe_kanban_view
|
||||
// KanbanView {{{
|
||||
position: absolute
|
||||
top: 111px
|
||||
top: 118px
|
||||
bottom: 0
|
||||
left: 221px
|
||||
right: 0
|
||||
.ui-sortable-placeholder
|
||||
border: 1px dotted black
|
||||
visibility: visible !important
|
||||
|
@ -38,6 +40,7 @@
|
|||
// KanbanGroups {{{
|
||||
.oe_kanban_groups
|
||||
height: 100%
|
||||
width: 100%
|
||||
.oe_kanban_group_title
|
||||
margin: 1px 1px 4px
|
||||
padding-left: 2px
|
||||
|
|
|
@ -38,31 +38,19 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
|||
},
|
||||
start: function() {
|
||||
var self = this;
|
||||
this._super.apply(this, arguments);
|
||||
var def = this._super.apply(this, arguments);
|
||||
// Bind kanban cards dropdown menus
|
||||
this.$element.on('click', '.oe_kanban_menuaction', function() {
|
||||
var $menu = $(this).next('.oe_kanban_menu');
|
||||
var show = !$menu.is(':visible');
|
||||
self.$element.find('.oe_kanban_menu').hide();
|
||||
var doc_width = $(document).width();
|
||||
$menu.toggle(show);
|
||||
if (show) {
|
||||
var offset = $menu.offset();
|
||||
var menu_width = $menu.width();
|
||||
var x = doc_width - offset.left - menu_width - 15;
|
||||
if (x < 0) {
|
||||
$menu.offset({ left: offset.left + x }).width(menu_width);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
$('html').on('click.kanban', function() {
|
||||
self.trigger('hide_menus');
|
||||
});
|
||||
$('html').on('click', function() {
|
||||
this.on('hide_menus', this, function() {
|
||||
self.$element.find('.oe_kanban_menu').hide();
|
||||
});
|
||||
return def;
|
||||
},
|
||||
destroy: function() {
|
||||
this._super.apply(this, arguments);
|
||||
$('html').off('click');
|
||||
$('html').off('click.kanban');
|
||||
},
|
||||
on_loaded: function(data) {
|
||||
this.fields_view = data;
|
||||
|
@ -604,8 +592,8 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({
|
|||
this.$element.children(':first').addClass('oe_kanban_draghandle');
|
||||
}
|
||||
|
||||
this.$element.find('.oe_kanban_action').click(function(ev) {
|
||||
ev.preventDefault();
|
||||
this.$element.find('.oe_kanban_action').click(function() {
|
||||
self.view.trigger('hide_menus');
|
||||
var $action = $(this),
|
||||
type = $action.data('type') || 'button',
|
||||
method = 'do_action_' + (type === 'action' ? 'object' : type);
|
||||
|
@ -616,7 +604,31 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({
|
|||
} else {
|
||||
self.do_warn("Kanban: no action for type : " + type);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$element.on('click', '.oe_kanban_menuaction', function() {
|
||||
var $menu = $(this).next('.oe_kanban_menu');
|
||||
var show = !$menu.is(':visible');
|
||||
self.view.trigger('hide_menus');
|
||||
var doc_width = $(document).width();
|
||||
$menu.toggle(show);
|
||||
if (show) {
|
||||
var offset = $menu.offset();
|
||||
var menu_width = $menu.width();
|
||||
var x = doc_width - offset.left - menu_width - 15;
|
||||
if (x < 0) {
|
||||
$menu.offset({ left: offset.left + x }).width(menu_width);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$element.on('click', this.on_card_clicked);
|
||||
},
|
||||
on_card_clicked: function() {
|
||||
this.view.trigger('hide_menus');
|
||||
this.view.open_record(this.id);
|
||||
},
|
||||
setup_color_picker: function() {
|
||||
var self = this;
|
||||
|
@ -625,8 +637,8 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({
|
|||
$el.html(QWeb.render('KanbanColorPicker', {
|
||||
widget: this
|
||||
}));
|
||||
$el.on('click', 'a', function(ev) {
|
||||
ev.preventDefault();
|
||||
$el.on('click', 'a', function() {
|
||||
self.view.trigger('hide_menus');
|
||||
var color_field = $(this).parents('.oe_kanban_colorpicker').first().data('field') || 'color';
|
||||
var data = {};
|
||||
data[color_field] = $(this).data('color');
|
||||
|
@ -634,6 +646,7 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({
|
|||
self.record[color_field] = $(this).data('color');
|
||||
self.do_reload();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -668,6 +681,7 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({
|
|||
var $render = $(self.render());
|
||||
self.$element.replaceWith($render);
|
||||
self.$element = $render;
|
||||
self.$element.data('widget', self);
|
||||
self.bind_events();
|
||||
self.group.compute_cards_auto_height();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue