[MERGE] Merged with main web.
bzr revid: tde@openerp.com-20120518083926-0w0igb83bbd30v03
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@charset "UTF-8";
|
||||
@charset "utf-8";
|
||||
@font-face {
|
||||
font-family: "mnmliconsRegular";
|
||||
src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot");
|
||||
@@ -117,6 +117,9 @@
|
||||
float: right;
|
||||
margin-left: 8px;
|
||||
}
|
||||
.openerp .oe_text_right {
|
||||
text-align: right;
|
||||
}
|
||||
.openerp .oe_clear {
|
||||
clear: both;
|
||||
}
|
||||
@@ -1415,7 +1418,7 @@
|
||||
}
|
||||
.openerp .oe_form_topbar button {
|
||||
font-size: 12px;
|
||||
height: 24px;
|
||||
height: 24px !important;
|
||||
line-height: 24px;
|
||||
vertical-align: top;
|
||||
padding: 0 10px;
|
||||
@@ -1508,44 +1511,30 @@
|
||||
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
||||
-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.openerp .oe_form_autolayout .oe_button {
|
||||
height: 20px;
|
||||
}
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell {
|
||||
.openerp .oe_form .oe_form_group_cell {
|
||||
line-height: 18px;
|
||||
padding: 2px;
|
||||
height: 20px;
|
||||
}
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_many2one,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_many2one input,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_char input,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_text textarea,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_email,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_email input,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_url,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_url input,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_float input,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_selection select,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > div > .oe_datepicker_root,
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master {
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_many2one,
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_many2one input,
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_char input,
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_text textarea,
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_email,
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_email input,
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_url,
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_url input,
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_float input,
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_field_selection select,
|
||||
.openerp .oe_form .oe_form_group_cell > div > .oe_datepicker_root,
|
||||
.openerp .oe_form .oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master {
|
||||
width: 100%;
|
||||
}
|
||||
.openerp .oe_form_autolayout .oe_form_button.oe_button {
|
||||
color: #4c4c4c;
|
||||
}
|
||||
.openerp .oe_form_autolayout .oe_form_button.oe_button span {
|
||||
position: relative;
|
||||
vertical-align: top;
|
||||
}
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_button.oe_button {
|
||||
white-space: nowrap;
|
||||
min-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.openerp .oe_form_autolayout .oe_form_group_cell.oe_form_group_nested {
|
||||
.openerp .oe_form .oe_form_group_cell.oe_form_group_nested {
|
||||
padding: 0;
|
||||
}
|
||||
.openerp .oe_form .oe_form_label_help[for], .openerp .oe_form .oe_form_label[for] {
|
||||
font-weight: bold;
|
||||
white-space: nowrap;
|
||||
padding-right: 8px;
|
||||
}
|
||||
@@ -1673,6 +1662,7 @@
|
||||
border: 1px solid #dd0000 !important;
|
||||
}
|
||||
.openerp .oe_form .oe_button.oe_field_button {
|
||||
display: block;
|
||||
-webkit-border-top-left-radius: 0px;
|
||||
-webkit-border-bottom-left-radius: 0px;
|
||||
-moz-border-radius-topleft: 0px;
|
||||
@@ -1695,10 +1685,24 @@
|
||||
right: 5px;
|
||||
top: 3px;
|
||||
}
|
||||
.openerp .oe_form .oe_form_button.oe_button {
|
||||
height: 22px;
|
||||
color: #4c4c4c;
|
||||
}
|
||||
.openerp .oe_form .oe_form_button.oe_button span {
|
||||
position: relative;
|
||||
vertical-align: top;
|
||||
}
|
||||
.openerp .oe_form .oe_form_button > img {
|
||||
vertical-align: -3px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
.openerp .oe_form .oe_form_group_cell > .oe_form_button.oe_button {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
min-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.openerp .oe_form .oe-binary-file-set {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
@@ -1718,6 +1722,9 @@
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.openerp .oe_horizontal_border {
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
.openerp .oe_horizontal_separator {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
@@ -1842,7 +1849,30 @@
|
||||
}
|
||||
.openerp .oe_form .oe_form_group_odd_border > tbody > tr.oe_form_group_row > td.oe_form_group_cell,
|
||||
.openerp .oe_form .oe_form_group_label_border > tbody > tr.oe_form_group_row > td.oe_form_group_cell {
|
||||
padding: 2px 2px 2px 8px !important;
|
||||
padding-left: 8px;
|
||||
}
|
||||
.openerp .oe_form .oe_form_subtotal_footer {
|
||||
float: right;
|
||||
}
|
||||
.openerp .oe_form .oe_form_subtotal_footer > div {
|
||||
text-align: right;
|
||||
padding: 3px;
|
||||
}
|
||||
.openerp .oe_form .oe_form_subtotal_footer label {
|
||||
font-weight: normal !important;
|
||||
}
|
||||
.openerp .oe_form .oe_form_subtotal_footer span {
|
||||
display: inline-block;
|
||||
min-width: 80px;
|
||||
text-align: right;
|
||||
}
|
||||
.openerp .oe_form .oe_form_subtotal_footer .oe_form_subtotal_footer_separator {
|
||||
border-top: 1px solid #cacaca;
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
}
|
||||
.openerp .oe_form .oe_form_subtotal_footer .oe_form_subtotal_footer_separator label {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
.openerp .oe-listview-content {
|
||||
width: 100%;
|
||||
|
||||
@@ -143,6 +143,8 @@ $colour4: #8a89ba
|
||||
.oe_right
|
||||
float: right
|
||||
margin-left: 8px
|
||||
.oe_text_right
|
||||
text-align: right
|
||||
.oe_clear
|
||||
clear: both
|
||||
.oe_wait
|
||||
@@ -1152,7 +1154,7 @@ $colour4: #8a89ba
|
||||
line-height: 30px
|
||||
button
|
||||
font-size: 12px
|
||||
height: 24px
|
||||
height: 24px !important
|
||||
line-height: 24px
|
||||
vertical-align: top
|
||||
padding: 0 10px
|
||||
@@ -1229,10 +1231,8 @@ $colour4: #8a89ba
|
||||
border: 1px solid #afafb6
|
||||
@include box-shadow(0 0 10px rgba(0,0,0,0.3))
|
||||
// }}}
|
||||
// FormView.autolayout {{{
|
||||
.oe_form_autolayout
|
||||
.oe_button
|
||||
height: 20px
|
||||
// FormView.layout {{{
|
||||
.oe_form
|
||||
.oe_form_group_cell
|
||||
line-height: 18px
|
||||
padding: 2px
|
||||
@@ -1250,21 +1250,13 @@ $colour4: #8a89ba
|
||||
.oe_form_group_cell > div > .oe_datepicker_root,
|
||||
.oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master
|
||||
width: 100%
|
||||
.oe_form_button.oe_button
|
||||
color: #4c4c4c
|
||||
span
|
||||
position: relative
|
||||
vertical-align: top
|
||||
.oe_form_group_cell > .oe_form_button.oe_button
|
||||
white-space: nowrap
|
||||
min-width: 100%
|
||||
width: 100%
|
||||
.oe_form_group_cell.oe_form_group_nested
|
||||
padding: 0
|
||||
// }}}
|
||||
// FormView.label {{{
|
||||
.oe_form
|
||||
.oe_form_label_help[for], .oe_form_label[for]
|
||||
font-weight: bold
|
||||
white-space: nowrap
|
||||
padding-right: 8px
|
||||
span
|
||||
@@ -1373,10 +1365,8 @@ $colour4: #8a89ba
|
||||
input, select, textarea
|
||||
background-color: #F66 !important
|
||||
border: 1px solid #D00 !important
|
||||
// }}}
|
||||
// FormView.buttons {{{
|
||||
.oe_form
|
||||
.oe_button.oe_field_button
|
||||
display: block
|
||||
-webkit-border-top-left-radius: 0px
|
||||
-webkit-border-bottom-left-radius: 0px
|
||||
-moz-border-radius-topleft: 0px
|
||||
@@ -1396,9 +1386,23 @@ $colour4: #8a89ba
|
||||
filter: alpha(opacity=50)
|
||||
right: 5px
|
||||
top: 3px
|
||||
// }}}
|
||||
// FormView.buttons {{{
|
||||
.oe_form
|
||||
.oe_form_button.oe_button
|
||||
height: 22px
|
||||
color: #4c4c4c
|
||||
span
|
||||
position: relative
|
||||
vertical-align: top
|
||||
.oe_form_button > img
|
||||
vertical-align: -3px
|
||||
padding: 0 2px
|
||||
.oe_form_group_cell > .oe_form_button.oe_button
|
||||
display: block
|
||||
white-space: nowrap
|
||||
min-width: 100%
|
||||
width: 100%
|
||||
// }}}
|
||||
// FormView.binaryfile {{{
|
||||
/* http://www.quirksmode.org/dom/inputfile.html
|
||||
@@ -1425,6 +1429,8 @@ $colour4: #8a89ba
|
||||
padding: 0
|
||||
// }}}
|
||||
// FormView.separator {{{
|
||||
.oe_horizontal_border
|
||||
border-bottom: 1px solid black
|
||||
.oe_horizontal_separator
|
||||
font-weight: bold
|
||||
font-size: 16px
|
||||
@@ -1536,7 +1542,24 @@ $colour4: #8a89ba
|
||||
min-width: 120px
|
||||
.oe_form_group_odd_border > tbody > tr.oe_form_group_row > td.oe_form_group_cell,
|
||||
.oe_form_group_label_border > tbody > tr.oe_form_group_row > td.oe_form_group_cell
|
||||
padding: 2px 2px 2px 8px !important
|
||||
padding-left: 8px
|
||||
.oe_form_subtotal_footer
|
||||
float: right
|
||||
> div
|
||||
text-align: right
|
||||
padding: 3px
|
||||
label
|
||||
font-weight: normal !important
|
||||
span
|
||||
display: inline-block
|
||||
min-width: 80px
|
||||
text-align: right
|
||||
.oe_form_subtotal_footer_separator
|
||||
border-top: 1px solid #cacaca
|
||||
font-size: 120%
|
||||
font-weight: bold
|
||||
label
|
||||
font-weight: bold !important
|
||||
// }}}
|
||||
// ListView {{{
|
||||
.oe-listview-content
|
||||
|
||||
@@ -43,6 +43,10 @@ instance.web.Notification = instance.web.Widget.extend({
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The very minimal function everything should call to create a dialog
|
||||
* in OpenERP Web Client.
|
||||
*/
|
||||
instance.web.dialog = function(element) {
|
||||
var result = element.dialog.apply(element, _.rest(_.toArray(arguments)));
|
||||
result.dialog("widget").addClass("openerp");
|
||||
|
||||
@@ -1079,44 +1079,44 @@ instance.web.ProxyDataSet = instance.web.DataSetSearch.extend({
|
||||
this.create_function = null;
|
||||
this.write_function = null;
|
||||
this.read_function = null;
|
||||
this.default_get_function = null;
|
||||
this.unlink_function = null;
|
||||
},
|
||||
read_ids: function () {
|
||||
read_ids: function (ids, fields, options) {
|
||||
if (this.read_function) {
|
||||
return this.read_function.apply(null, arguments);
|
||||
return this.read_function(ids, fields, options, this._super);
|
||||
} else {
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
default_get: function(fields, options) {
|
||||
return this._super(fields, options).then(this.on_default_get);
|
||||
if (this.default_get_function) {
|
||||
return this.default_get_function(fields, options, this._super);
|
||||
} else {
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
on_default_get: function(result) {},
|
||||
create: function(data, callback, error_callback) {
|
||||
this.on_create(data);
|
||||
if (this.create_function) {
|
||||
return this.create_function(data, callback, error_callback);
|
||||
return this.create_function(data, this._super).then(callback, error_callback);
|
||||
} else {
|
||||
console.warn("trying to create a record using default proxy dataset behavior");
|
||||
return $.async_when({"result": undefined}).then(callback);
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
on_create: function(data) {},
|
||||
write: function (id, data, options, callback) {
|
||||
this.on_write(id, data);
|
||||
write: function (id, data, options, callback, error_callback) {
|
||||
if (this.write_function) {
|
||||
return this.write_function(id, data, options, callback);
|
||||
return this.write_function(id, data, options, this._super).then(callback, error_callback);
|
||||
} else {
|
||||
console.warn("trying to write a record using default proxy dataset behavior");
|
||||
return $.async_when({"result": true}).then(callback);
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
on_write: function(id, data) {},
|
||||
unlink: function(ids, callback, error_callback) {
|
||||
this.on_unlink(ids);
|
||||
console.warn("trying to unlink a record using default proxy dataset behavior");
|
||||
return $.async_when({"result": true}).then(callback);
|
||||
if (this.unlink_function) {
|
||||
return this.unlink_function(ids, this._super).then(callback, error_callback);
|
||||
} else {
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
on_unlink: function(ids) {}
|
||||
});
|
||||
|
||||
instance.web.CompoundContext = instance.web.Class.extend({
|
||||
|
||||
@@ -984,9 +984,6 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
|
||||
},
|
||||
process: function($tag, layout) {
|
||||
var self = this;
|
||||
if ($tag.attr('layout') === 'auto') {
|
||||
$tag.addClass('oe_form_autolayout');
|
||||
}
|
||||
layout = $tag.attr('layout') || layout || 'auto';
|
||||
$tag.removeAttr('layout');
|
||||
var tagname = $tag[0].nodeName.toLowerCase();
|
||||
@@ -2310,16 +2307,6 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(_.exte
|
||||
});
|
||||
})();
|
||||
|
||||
instance.web.form.dialog = function(content, options) {
|
||||
options = _.extend({
|
||||
width: '90%',
|
||||
height: 'auto',
|
||||
min_width: '800px'
|
||||
}, options || {});
|
||||
var dialog = new instance.web.Dialog(null, options, content).open();
|
||||
return dialog.$element;
|
||||
};
|
||||
|
||||
/**
|
||||
* A mixin containing some useful methods to handle completion inputs.
|
||||
*/
|
||||
@@ -2756,20 +2743,18 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
|
||||
view.view_type = 'form';
|
||||
}
|
||||
view.options.not_interactible_on_create = true;
|
||||
} else if (view.view_type === "kanban") {
|
||||
if (self.get("effective_readonly")) {
|
||||
view.options.action_buttons = false;
|
||||
view.options.quick_creatable = false;
|
||||
}
|
||||
}
|
||||
views.push(view);
|
||||
});
|
||||
this.views = views;
|
||||
|
||||
this.viewmanager = new instance.web.ViewManager(this, this.dataset, views, {
|
||||
$sidebar: false,
|
||||
});
|
||||
this.viewmanager.template = 'One2Many.viewmanager';
|
||||
this.viewmanager.registry = instance.web.views.extend({
|
||||
list: 'instance.web.form.One2ManyListView',
|
||||
form: 'instance.web.form.One2ManyFormView',
|
||||
kanban: 'instance.web.form.One2ManyKanbanView',
|
||||
});
|
||||
this.viewmanager = new instance.web.form.One2ManyViewManager(this, this.dataset, views, {});
|
||||
this.viewmanager.o2m = self;
|
||||
var once = $.Deferred().then(function() {
|
||||
self.init_form_last_update.resolve();
|
||||
});
|
||||
@@ -2953,6 +2938,42 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
|
||||
},
|
||||
});
|
||||
|
||||
instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({
|
||||
template: 'One2Many.viewmanager',
|
||||
init: function(parent, dataset, views, flags) {
|
||||
this._super(parent, dataset, views, _.extend({}, flags, {$sidebar: false}));
|
||||
this.registry = this.registry.extend({
|
||||
list: 'instance.web.form.One2ManyListView',
|
||||
form: 'instance.web.form.One2ManyFormView',
|
||||
kanban: 'instance.web.form.One2ManyKanbanView',
|
||||
});
|
||||
},
|
||||
switch_view: function(mode, unused) {
|
||||
if (mode !== 'form') {
|
||||
return this._super(mode, unused);
|
||||
}
|
||||
var self = this;
|
||||
var id = self.o2m.dataset.index !== null ? self.o2m.dataset.ids[self.o2m.dataset.index] : null;
|
||||
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,
|
||||
write_function: function(id, data, options) {
|
||||
return self.o2m.dataset.write(id, data, {}).then(function() {
|
||||
self.o2m.reload_current_view();
|
||||
});
|
||||
},
|
||||
alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined,
|
||||
parent_view: self.o2m.view,
|
||||
child_name: self.o2m.name,
|
||||
read_function: function() {
|
||||
return self.o2m.dataset.read_ids.apply(self.o2m.dataset, arguments);
|
||||
},
|
||||
form_view_options: {'not_interactible_on_create':true},
|
||||
readonly: self.o2m.get("effective_readonly")
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
instance.web.form.One2ManyDataSet = instance.web.BufferedDataSet.extend({
|
||||
get_context: function() {
|
||||
this.context = this.o2m.build_context([this.o2m.name]);
|
||||
@@ -2968,7 +2989,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
|
||||
} else {
|
||||
var self = this;
|
||||
var pop = new instance.web.form.SelectCreatePopup(this);
|
||||
pop.on_default_get.add(self.dataset.on_default_get);
|
||||
pop.select_element(
|
||||
self.o2m.field.relation,
|
||||
{
|
||||
@@ -3001,7 +3021,11 @@ instance.web.form.One2ManyListView = instance.web.ListView.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,
|
||||
auto_write: false,
|
||||
write_function: function(id, data) {
|
||||
return self.o2m.dataset.write(id, data, {}, function(r) {
|
||||
self.o2m.reload_current_view();
|
||||
});
|
||||
},
|
||||
alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined,
|
||||
parent_view: self.o2m.view,
|
||||
child_name: self.o2m.name,
|
||||
@@ -3011,11 +3035,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
|
||||
form_view_options: {'not_interactible_on_create':true},
|
||||
readonly: self.o2m.get("effective_readonly")
|
||||
});
|
||||
pop.on_write.add(function(id, data) {
|
||||
self.o2m.dataset.write(id, data, {}, function(r) {
|
||||
self.o2m.reload_current_view();
|
||||
});
|
||||
});
|
||||
},
|
||||
do_button_action: function (name, id, callback) {
|
||||
var self = this;
|
||||
@@ -3046,28 +3065,6 @@ var lazy_build_o2m_kanban_view = function() {
|
||||
if (! instance.web_kanban || instance.web.form.One2ManyKanbanView)
|
||||
return;
|
||||
instance.web.form.One2ManyKanbanView = instance.web_kanban.KanbanView.extend({
|
||||
open_record: function(id) {
|
||||
var self = this;
|
||||
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,
|
||||
auto_write: false,
|
||||
alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined,
|
||||
parent_view: self.o2m.view,
|
||||
child_name: self.o2m.name,
|
||||
read_function: function() {
|
||||
return self.o2m.dataset.read_ids.apply(self.o2m.dataset, arguments);
|
||||
},
|
||||
form_view_options: {'not_interactible_on_create':true},
|
||||
readonly: self.o2m.get("effective_readonly"),
|
||||
});
|
||||
pop.on_write.add(function(id, data) {
|
||||
self.o2m.dataset.write(id, data, {}, function(r) {
|
||||
self.o2m.reload_current_view();
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3223,7 +3220,6 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(_.
|
||||
* TODO niv: clean those deferred stuff, it could be better
|
||||
*/
|
||||
instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({
|
||||
template: "FieldMany2Many.render",
|
||||
multi_selection: false,
|
||||
disable_utility_classes: true,
|
||||
init: function(field_manager, node) {
|
||||
@@ -3274,7 +3270,6 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({
|
||||
'addable': self.get("effective_readonly") ? null : _t("Add"),
|
||||
'deletable': self.get("effective_readonly") ? false : true,
|
||||
'selectable': self.multi_selection,
|
||||
'$buttons': $(".oe_form_view_m2m_buttons", self.$element),
|
||||
});
|
||||
var embedded = (this.field.views || {}).tree;
|
||||
if (embedded) {
|
||||
@@ -3287,7 +3282,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({
|
||||
loaded.resolve();
|
||||
});
|
||||
$.async_when().then(function () {
|
||||
self.list_view.appendTo($(".oe_form_view_m2m_view", self.$element));
|
||||
self.list_view.appendTo(self.$element);
|
||||
});
|
||||
return loaded;
|
||||
},
|
||||
@@ -3349,60 +3344,166 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in
|
||||
});
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @extends instance.web.OldWidget
|
||||
* Class with everything which is common between FormOpenPopup and SelectCreatePopup.
|
||||
*/
|
||||
instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends instance.web.form.SelectCreatePopup# */{
|
||||
template: "SelectCreatePopup",
|
||||
instance.web.form.AbstractFormPopup = instance.web.OldWidget.extend({
|
||||
template: "AbstractFormPopup.render",
|
||||
/**
|
||||
* options:
|
||||
* -readonly: only applicable when not in creation mode, default to false
|
||||
* - alternative_form_view
|
||||
* - write_function
|
||||
* - read_function
|
||||
* - create_function
|
||||
* - parent_view
|
||||
* - child_name
|
||||
* - form_view_options
|
||||
*/
|
||||
init_popup: function(model, row_id, domain, context, options) {
|
||||
this.row_id = row_id;
|
||||
this.model = model;
|
||||
this.domain = domain || [];
|
||||
this.context = context || {};
|
||||
this.options = options;
|
||||
_.defaults(this.options, {
|
||||
});
|
||||
},
|
||||
init_dataset: function() {
|
||||
var self = this;
|
||||
this.created_elements = [];
|
||||
this.dataset = new instance.web.ProxyDataSet(this, this.model, this.context);
|
||||
this.dataset.read_function = this.options.read_function;
|
||||
this.dataset.create_function = function(data, sup) {
|
||||
var fct = self.options.create_function || sup;
|
||||
return fct.call(this, data).then(function(r) {
|
||||
self.created_elements.push(r.result);
|
||||
});
|
||||
};
|
||||
this.dataset.write_function = function(id, data, options, sup) {
|
||||
var fct = self.options.write_function || sup;
|
||||
return fct.call(this, id, data, options).then(self.on_write_completed);
|
||||
};
|
||||
this.dataset.parent_view = this.options.parent_view;
|
||||
this.dataset.child_name = this.options.child_name;
|
||||
},
|
||||
display_popup: function() {
|
||||
var self = this;
|
||||
this.renderElement();
|
||||
new instance.web.Dialog(this, {
|
||||
width: '90%',
|
||||
min_width: '800px',
|
||||
close: function() {
|
||||
self.check_exit();
|
||||
},
|
||||
title: this.options.title || "",
|
||||
}, this.$element).open();
|
||||
this.start();
|
||||
},
|
||||
on_write_completed: function() {},
|
||||
setup_form_view: function() {
|
||||
var self = this;
|
||||
if (this.row_id) {
|
||||
this.dataset.ids = [this.row_id];
|
||||
this.dataset.index = 0;
|
||||
} else {
|
||||
this.dataset.index = null;
|
||||
}
|
||||
var options = _.clone(self.options.form_view_options) || {};
|
||||
if (this.row_id !== null) {
|
||||
options.initial_mode = this.options.readonly ? "view" : "edit";
|
||||
}
|
||||
this.view_form = new instance.web.FormView(this, this.dataset, false, options);
|
||||
if (this.options.alternative_form_view) {
|
||||
this.view_form.set_embedded_view(this.options.alternative_form_view);
|
||||
}
|
||||
this.view_form.appendTo(this.$element.find(".oe-form-view-popup-form-placeholder"));
|
||||
this.view_form.on_loaded.add_last(function() {
|
||||
var $buttons = self.view_form.$element.find(".oe_form_buttons");
|
||||
var multi_select = self.row_id === null && ! self.options.disable_multiple_selection;
|
||||
$buttons.html(QWeb.render("AbstractFormPopup.buttons", {multi_select: multi_select}));
|
||||
var $snbutton = $buttons.find(".oe_abstractformpopup-form-save-new");
|
||||
$snbutton.click(function() {
|
||||
$.when(self.view_form.do_save()).then(function() {
|
||||
self.view_form.reload_mutex.exec(function() {
|
||||
self.view_form.on_button_new();
|
||||
});
|
||||
});
|
||||
});
|
||||
var $sbutton = $buttons.find(".oe_abstractformpopup-form-save");
|
||||
$sbutton.click(function() {
|
||||
$.when(self.view_form.do_save()).then(function() {
|
||||
self.view_form.reload_mutex.exec(function() {
|
||||
self.check_exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
var $cbutton = $buttons.find(".oe_abstractformpopup-form-close");
|
||||
$cbutton.click(function() {
|
||||
self.check_exit();
|
||||
});
|
||||
if (self.row_id !== null && self.options.readonly) {
|
||||
$snbutton.hide();
|
||||
$sbutton.hide();
|
||||
$cbutton.text(_t("Close"));
|
||||
}
|
||||
self.view_form.do_show();
|
||||
});
|
||||
},
|
||||
on_select_elements: function(element_ids) {
|
||||
},
|
||||
check_exit: function() {
|
||||
if (this.created_elements.length > 0) {
|
||||
this.on_select_elements(this.created_elements);
|
||||
}
|
||||
this.destroy();
|
||||
},
|
||||
destroy: function () {
|
||||
this.$element.dialog('close');
|
||||
this._super();
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Class to display a popup containing a form view.
|
||||
*/
|
||||
instance.web.form.FormOpenPopup = instance.web.form.AbstractFormPopup.extend({
|
||||
show_element: function(model, row_id, context, options) {
|
||||
this.init_popup(model, row_id, [], context, options);
|
||||
_.defaults(this.options, {
|
||||
});
|
||||
this.display_popup();
|
||||
},
|
||||
start: function() {
|
||||
this._super();
|
||||
this.init_dataset();
|
||||
this.setup_form_view();
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Class to display a popup to display a list to search a row. It also allows
|
||||
* to switch to a form view to create a new row.
|
||||
*/
|
||||
instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend({
|
||||
/**
|
||||
* options:
|
||||
* - initial_ids
|
||||
* - initial_view: form or search (default search)
|
||||
* - disable_multiple_selection
|
||||
* - alternative_form_view
|
||||
* - create_function (defaults to a naive saving behavior)
|
||||
* - parent_view
|
||||
* - child_name
|
||||
* - form_view_options
|
||||
* - list_view_options
|
||||
* - read_function
|
||||
*/
|
||||
select_element: function(model, options, domain, context) {
|
||||
this.init_popup(model, null, domain, context, options);
|
||||
var self = this;
|
||||
this.model = model;
|
||||
this.domain = domain || [];
|
||||
this.context = context || {};
|
||||
this.options = _.defaults(options || {}, {"initial_view": "search", "create_function": function() {
|
||||
return self.create_row.apply(self, arguments);
|
||||
}, read_function: null});
|
||||
this.initial_ids = this.options.initial_ids;
|
||||
this.created_elements = [];
|
||||
this.renderElement();
|
||||
instance.web.form.dialog(this.$element, {
|
||||
close: function() {
|
||||
self.check_exit();
|
||||
},
|
||||
title: options.title || ""
|
||||
_.defaults(this.options, {
|
||||
initial_view: "search",
|
||||
});
|
||||
this.start();
|
||||
this.initial_ids = this.options.initial_ids;
|
||||
this.display_popup();
|
||||
},
|
||||
start: function() {
|
||||
this._super();
|
||||
var self = this;
|
||||
this.dataset = new instance.web.ProxyDataSet(this, this.model,
|
||||
this.context);
|
||||
this.dataset.create_function = function() {
|
||||
return self.options.create_function.apply(null, arguments).then(function(r) {
|
||||
self.created_elements.push(r.result);
|
||||
});
|
||||
};
|
||||
this.dataset.write_function = function() {
|
||||
return self.write_row.apply(self, arguments);
|
||||
};
|
||||
this.dataset.read_function = this.options.read_function;
|
||||
this.dataset.parent_view = this.options.parent_view;
|
||||
this.dataset.child_name = this.options.child_name;
|
||||
this.dataset.on_default_get.add(this.on_default_get);
|
||||
this.init_dataset();
|
||||
if (this.options.initial_view == "search") {
|
||||
self.rpc('/web/session/eval_domain_and_context', {
|
||||
domains: [],
|
||||
@@ -3421,10 +3522,6 @@ instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends i
|
||||
this.new_object();
|
||||
}
|
||||
},
|
||||
stop: function () {
|
||||
this.$element.dialog('close');
|
||||
this._super();
|
||||
},
|
||||
setup_search_view: function(search_defaults) {
|
||||
var self = this;
|
||||
if (this.searchview) {
|
||||
@@ -3482,22 +3579,6 @@ instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends i
|
||||
self.view_list.do_search(results.domain, results.context, results.group_by);
|
||||
});
|
||||
},
|
||||
create_row: function() {
|
||||
var self = this;
|
||||
var wdataset = new instance.web.DataSetSearch(this, this.model, this.context, this.domain);
|
||||
wdataset.parent_view = this.options.parent_view;
|
||||
wdataset.child_name = this.options.child_name;
|
||||
return wdataset.create.apply(wdataset, arguments);
|
||||
},
|
||||
write_row: function() {
|
||||
var self = this;
|
||||
var wdataset = new instance.web.DataSetSearch(this, this.model, this.context, this.domain);
|
||||
wdataset.parent_view = this.options.parent_view;
|
||||
wdataset.child_name = this.options.child_name;
|
||||
return wdataset.write.apply(wdataset, arguments);
|
||||
},
|
||||
on_select_elements: function(element_ids) {
|
||||
},
|
||||
on_click_element: function(ids) {
|
||||
this.selected_ids = ids || [];
|
||||
if(this.selected_ids.length > 0) {
|
||||
@@ -3507,52 +3588,14 @@ instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends i
|
||||
}
|
||||
},
|
||||
new_object: function() {
|
||||
var self = this;
|
||||
if (this.searchview) {
|
||||
this.searchview.hide();
|
||||
}
|
||||
if (this.view_list) {
|
||||
this.view_list.$element.hide();
|
||||
}
|
||||
this.dataset.index = null;
|
||||
this.view_form = new instance.web.FormView(this, this.dataset, false, self.options.form_view_options);
|
||||
if (this.options.alternative_form_view) {
|
||||
this.view_form.set_embedded_view(this.options.alternative_form_view);
|
||||
}
|
||||
this.view_form.appendTo(this.$element.find(".oe-select-create-popup-view-form"));
|
||||
this.view_form.on_loaded.add_last(function() {
|
||||
var $buttons = self.view_form.$element.find(".oe_form_buttons");
|
||||
$buttons.html(QWeb.render("SelectCreatePopup.form.buttons", {widget:self}));
|
||||
var $nbutton = $buttons.find(".oe_selectcreatepopup-form-save-new");
|
||||
$nbutton.click(function() {
|
||||
$.when(self.view_form.do_save()).then(function() {
|
||||
self.view_form.reload_mutex.exec(function() {
|
||||
self.view_form.on_button_new();
|
||||
});
|
||||
});
|
||||
});
|
||||
var $nbutton = $buttons.find(".oe_selectcreatepopup-form-save");
|
||||
$nbutton.click(function() {
|
||||
$.when(self.view_form.do_save()).then(function() {
|
||||
self.view_form.reload_mutex.exec(function() {
|
||||
self.check_exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
var $cbutton = $buttons.find(".oe_selectcreatepopup-form-close");
|
||||
$cbutton.click(function() {
|
||||
self.check_exit();
|
||||
});
|
||||
});
|
||||
this.view_form.do_show();
|
||||
this.setup_form_view();
|
||||
},
|
||||
check_exit: function() {
|
||||
if (this.created_elements.length > 0) {
|
||||
this.on_select_elements(this.created_elements);
|
||||
}
|
||||
this.destroy();
|
||||
},
|
||||
on_default_get: function(res) {}
|
||||
});
|
||||
|
||||
instance.web.form.SelectCreateListView = instance.web.ListView.extend({
|
||||
@@ -3569,101 +3612,6 @@ instance.web.form.SelectCreateListView = instance.web.ListView.extend({
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @extends instance.web.OldWidget
|
||||
*/
|
||||
instance.web.form.FormOpenPopup = instance.web.OldWidget.extend(/** @lends instance.web.form.FormOpenPopup# */{
|
||||
template: "FormOpenPopup",
|
||||
/**
|
||||
* options:
|
||||
* - alternative_form_view
|
||||
* - auto_write (default true)
|
||||
* - read_function
|
||||
* - parent_view
|
||||
* - child_name
|
||||
* - form_view_options
|
||||
* - readonly
|
||||
*/
|
||||
show_element: function(model, row_id, context, options) {
|
||||
this.model = model;
|
||||
this.row_id = row_id;
|
||||
this.context = context || {};
|
||||
this.options = _.defaults(options || {}, {"auto_write": true});
|
||||
this.renderElement();
|
||||
instance.web.dialog(this.$element, {
|
||||
title: options.title || '',
|
||||
modal: true,
|
||||
width: 960,
|
||||
height: 600
|
||||
});
|
||||
this.start();
|
||||
},
|
||||
start: function() {
|
||||
this._super();
|
||||
this.dataset = new instance.web.form.FormOpenDataset(this, this.model, this.context);
|
||||
this.dataset.fop = this;
|
||||
this.dataset.ids = [this.row_id];
|
||||
this.dataset.index = 0;
|
||||
this.dataset.parent_view = this.options.parent_view;
|
||||
this.dataset.child_name = this.options.child_name;
|
||||
this.setup_form_view();
|
||||
},
|
||||
on_write: function(id, data) {
|
||||
if (!this.options.auto_write)
|
||||
return;
|
||||
var self = this;
|
||||
var wdataset = new instance.web.DataSetSearch(this, this.model, this.context, this.domain);
|
||||
wdataset.parent_view = this.options.parent_view;
|
||||
wdataset.child_name = this.options.child_name;
|
||||
wdataset.write(id, data, {}, function(r) {
|
||||
self.on_write_completed();
|
||||
});
|
||||
},
|
||||
on_write_completed: function() {},
|
||||
setup_form_view: function() {
|
||||
var self = this;
|
||||
var FormClass = instance.web.views.get_object('form');
|
||||
var options = _.clone(self.options.form_view_options) || {};
|
||||
options.initial_mode = this.options.readonly ? "view" : "edit";
|
||||
this.view_form = new FormClass(this, this.dataset, false, options);
|
||||
if (this.options.alternative_form_view) {
|
||||
this.view_form.set_embedded_view(this.options.alternative_form_view);
|
||||
}
|
||||
this.view_form.appendTo(this.$element.find(".oe-form-open-popup-form-view"));
|
||||
this.view_form.on_loaded.add_last(function() {
|
||||
var $buttons = self.view_form.$element.find(".oe_form_buttons");
|
||||
$buttons.html(QWeb.render("FormOpenPopup.form.buttons"));
|
||||
var $nbutton = $buttons.find(".oe_formopenpopup-form-save");
|
||||
$nbutton.click(function() {
|
||||
self.view_form.do_save().then(function() {
|
||||
self.destroy();
|
||||
});
|
||||
});
|
||||
var $cbutton = $buttons.find(".oe_formopenpopup-form-close");
|
||||
$cbutton.click(function() {
|
||||
self.destroy();
|
||||
});
|
||||
if (self.options.readonly) {
|
||||
$nbutton.hide();
|
||||
$cbutton.text(_t("Close"));
|
||||
}
|
||||
self.view_form.do_show();
|
||||
});
|
||||
this.dataset.on_write.add(this.on_write);
|
||||
}
|
||||
});
|
||||
|
||||
instance.web.form.FormOpenDataset = instance.web.ProxyDataSet.extend({
|
||||
read_ids: function() {
|
||||
if (this.fop.options.read_function) {
|
||||
return this.fop.options.read_function.apply(null, arguments);
|
||||
} else {
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
instance.web.form.FieldReference = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, {
|
||||
template: 'FieldReference',
|
||||
init: function(field_manager, node) {
|
||||
|
||||
@@ -20,6 +20,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
||||
'sortable': true,
|
||||
// whether the view rows can be reordered (via vertical drag & drop)
|
||||
'reorderable': true,
|
||||
'action_buttons': true,
|
||||
},
|
||||
/**
|
||||
* Core class for list-type displays.
|
||||
|
||||
@@ -295,7 +295,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
|
||||
if (view.embedded_view) {
|
||||
controller.set_embedded_view(view.embedded_view);
|
||||
}
|
||||
controller.do_switch_view.add_last(this.on_mode_switch);
|
||||
controller.do_switch_view.add_last(_.bind(this.switch_view, this));
|
||||
controller.do_prev_view.add_last(this.on_prev_view);
|
||||
var container = this.$element.find(".oe_view_manager_view_" + view_type);
|
||||
view_promise = controller.appendTo(container);
|
||||
@@ -342,6 +342,14 @@ instance.web.ViewManager = instance.web.Widget.extend({
|
||||
});
|
||||
return view_promise;
|
||||
},
|
||||
/**
|
||||
* Method used internally when a view asks to switch view. This method is meant
|
||||
* to be extended by child classes to change the default behavior, which simply
|
||||
* consist to switch to the asked view.
|
||||
*/
|
||||
switch_view: function(view_type, no_store) {
|
||||
return this.on_mode_switch(view_type, no_store);
|
||||
},
|
||||
/**
|
||||
* Returns to the view preceding the caller view in this manager's
|
||||
* navigation history (the navigation history is appended to via
|
||||
|
||||
@@ -1054,12 +1054,6 @@
|
||||
</span>
|
||||
</t>
|
||||
</t>
|
||||
<t t-name="FieldMany2Many.render">
|
||||
<div class="oe_form_view_m2m">
|
||||
<div class="oe_form_view_m2m_buttons" />
|
||||
<div class="oe_form_view_m2m_view" />
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="FieldMany2ManyTags">
|
||||
<div class="oe_form_field_many2manytags">
|
||||
<t t-if="! widget.get('effective_readonly')">
|
||||
@@ -1525,7 +1519,7 @@
|
||||
</t>
|
||||
</select>
|
||||
</t>
|
||||
<t t-name="SelectCreatePopup">
|
||||
<t t-name="AbstractFormPopup.render">
|
||||
<div>
|
||||
<table style="width:100%">
|
||||
<tr style="width:100%">
|
||||
@@ -1539,31 +1533,22 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="oe-select-create-popup-view-form" style="width:100%"></div>
|
||||
<div class="oe-form-view-popup-form-placeholder oe-select-create-popup-view-form" style="width:100%"></div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="SelectCreatePopup.search.buttons">
|
||||
<button type="button" class="oe_button oe_selectcreatepopup-search-select" disabled="disabled">Select</button>
|
||||
<button type="button" class="oe_button oe_selectcreatepopup-search-close">Cancel</button>
|
||||
</t>
|
||||
<t t-name="SelectCreatePopup.form.buttons">
|
||||
<t t-if="widget.options.disable_multiple_selection">
|
||||
<button type="button" class="oe_button oe_selectcreatepopup-form-save">Save</button>
|
||||
<t t-name="AbstractFormPopup.buttons">
|
||||
<t t-if="! multi_select">
|
||||
<button type="button" class="oe_button oe_abstractformpopup-form-save">Save</button>
|
||||
</t>
|
||||
<t t-if="! widget.options.disable_multiple_selection">
|
||||
<button type="button" class="oe_button oe_selectcreatepopup-form-save-new">Save & New</button>
|
||||
<button type="button" class="oe_button oe_selectcreatepopup-form-save">Save & Close</button>
|
||||
<t t-if="multi_select">
|
||||
<button type="button" class="oe_button oe_abstractformpopup-form-save-new">Save & New</button>
|
||||
<button type="button" class="oe_button oe_abstractformpopup-form-save">Save & Close</button>
|
||||
</t>
|
||||
<button type="button" class="oe_button oe_selectcreatepopup-form-close">Cancel</button>
|
||||
</t>
|
||||
<t t-name="FormOpenPopup">
|
||||
<div>
|
||||
<div class="oe-form-open-popup-form-view" style="width:100%"></div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="FormOpenPopup.form.buttons">
|
||||
<button type="button" class="oe_button oe_formopenpopup-form-save">Save</button>
|
||||
<button type="button" class="oe_button oe_formopenpopup-form-close">Cancel</button>
|
||||
<button type="button" class="oe_button oe_abstractformpopup-form-close">Cancel</button>
|
||||
</t>
|
||||
<t t-extend="ListView.row">
|
||||
<!-- adds back padding to row being rendered after edition, if necessary
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Bulgarian 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-02-06 17:33+0100\n"
|
||||
"PO-Revision-Date: 2012-05-16 09:33+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: Bulgarian <bg@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-05-17 04:49+0000\n"
|
||||
"X-Generator: Launchpad (build 15259)\n"
|
||||
|
||||
#. openerp-web
|
||||
#: addons/web_calendar/static/src/js/calendar.js:11
|
||||
msgid "Calendar"
|
||||
msgstr "Календар"
|
||||
|
||||
#. openerp-web
|
||||
#: addons/web_calendar/static/src/js/calendar.js:466
|
||||
#: addons/web_calendar/static/src/js/calendar.js:467
|
||||
msgid "Responsible"
|
||||
msgstr "Отговорник"
|
||||
|
||||
#. openerp-web
|
||||
#: addons/web_calendar/static/src/js/calendar.js:504
|
||||
#: addons/web_calendar/static/src/js/calendar.js:505
|
||||
msgid "Navigator"
|
||||
msgstr "Навигатор"
|
||||
|
||||
#. openerp-web
|
||||
#: addons/web_calendar/static/src/xml/web_calendar.xml:5
|
||||
#: addons/web_calendar/static/src/xml/web_calendar.xml:6
|
||||
msgid " "
|
||||
msgstr ""
|
||||
@@ -238,6 +238,10 @@
|
||||
/* apply block formatting context */
|
||||
overflow: hidden;
|
||||
}
|
||||
.openerp .oe_kanban_no_group .oe_kanban_quick_create {
|
||||
width: 200px;
|
||||
padding: 10px;
|
||||
}
|
||||
.openerp .oe_kanban_quick_create input {
|
||||
display: block;
|
||||
/* margins within width */
|
||||
|
||||
@@ -11,10 +11,8 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
||||
default_nr_columns: 3,
|
||||
view_type: "kanban",
|
||||
init: function (parent, dataset, view_id, options) {
|
||||
this._super(parent);
|
||||
this.set_default_options(options);
|
||||
this.dataset = dataset;
|
||||
this.view_id = view_id;
|
||||
this._super(parent, dataset, view_id, options);
|
||||
_.defaults(this.options, {"quick_creatable": true});
|
||||
this.fields_view = {};
|
||||
this.fields_keys = [];
|
||||
this.group_by = null;
|
||||
@@ -360,6 +358,12 @@ instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({
|
||||
start: function() {
|
||||
var self = this,
|
||||
def = this._super();
|
||||
if (! self.view.group_by) {
|
||||
self.$element.addClass("oe_kanban_no_group");
|
||||
self.quick = new instance.web_kanban.QuickCreate(this, self.dataset, {}, false)
|
||||
.on('added', self, self.proxy('quick_created'));
|
||||
self.quick.replace($(".oe_kanban_no_group_qc_placeholder"));
|
||||
}
|
||||
this.$records = $(QWeb.render('KanbanView.group_records_container', { widget : this}));
|
||||
this.$records.appendTo(this.view.$element.find('.oe_kanban_groups_records'));
|
||||
this.$element.find(".oe_kanban_fold_icon").click(function() {
|
||||
@@ -369,9 +373,16 @@ instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({
|
||||
});
|
||||
this.$element.find('.oe_kanban_add').click(function () {
|
||||
if (self.quick) { return; }
|
||||
self.quick = new instance.web_kanban.QuickCreate(this)
|
||||
.on('added', self, self.proxy('quick_add'));
|
||||
var ctx = {};
|
||||
ctx['default_' + self.view.group_by] = self.value;
|
||||
self.quick = new instance.web_kanban.QuickCreate(this, self.dataset, ctx, true)
|
||||
.on('added', self, self.proxy('quick_created'))
|
||||
.on('close', self, function() {
|
||||
this.quick.destroy();
|
||||
delete this.quick;
|
||||
});
|
||||
self.quick.appendTo(self.$element.find('.oe_kanban_group_header'));
|
||||
self.quick.focus();
|
||||
});
|
||||
this.$records.find('.oe_kanban_show_more').click(this.do_show_more);
|
||||
if (this.state.folded) {
|
||||
@@ -440,20 +451,6 @@ instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Handles user event from nested quick creation view
|
||||
*
|
||||
* @param {String} name name to give to the new record
|
||||
*/
|
||||
quick_add: function (name) {
|
||||
var context = {};
|
||||
context['default_' + this.view.group_by] = this.value;
|
||||
// FIXME: what if name_create fails?
|
||||
new instance.web.Model(this.dataset.model).call(
|
||||
'name_create', [name], {context: new instance.web.CompoundContext(
|
||||
this.dataset.get_context(), context)})
|
||||
.then(this.proxy('quick_created'))
|
||||
},
|
||||
/**
|
||||
* Handles a non-erroneous response from name_create
|
||||
*
|
||||
@@ -461,10 +458,7 @@ instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({
|
||||
*/
|
||||
quick_created: function (record) {
|
||||
var id = record[0], self = this;
|
||||
this.quick.destroy();
|
||||
delete this.quick;
|
||||
new instance.web.Model(this.dataset.model).call(
|
||||
'read', [[id], this.view.fields_keys], {})
|
||||
this.dataset.read_ids([id], this.view.fields_keys)
|
||||
.then(function (records) {
|
||||
self.view.dataset.ids.push(id);
|
||||
self.do_add_records(records, 'prepend');
|
||||
@@ -682,16 +676,68 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({
|
||||
*/
|
||||
instance.web_kanban.QuickCreate = instance.web.Widget.extend({
|
||||
template: 'KanbanView.quick_create',
|
||||
|
||||
|
||||
/**
|
||||
* close_btn: If true, the widget will display a "Close" button able to trigger
|
||||
* a "close" event.
|
||||
*/
|
||||
init: function(parent, dataset, context, buttons) {
|
||||
this._super(parent);
|
||||
this._dataset = dataset;
|
||||
this._buttons = buttons || false;
|
||||
this._context = context || {};
|
||||
},
|
||||
start: function () {
|
||||
var self = this;
|
||||
var $input = this.$element.find('input');
|
||||
$input.focus();
|
||||
this.$element.on('submit', function () {
|
||||
self.trigger('added', $input.val());
|
||||
return false;
|
||||
self.$input = this.$element.find('input');
|
||||
self.$input.keyup(function(event){
|
||||
if(event.keyCode == 13){
|
||||
self.quick_add();
|
||||
}
|
||||
});
|
||||
$(".oe-kanban-quick_create_add", this.$element).click(function () {
|
||||
self.quick_add();
|
||||
});
|
||||
$(".oe-kanban-quick_create_close", this.$element).click(function () {
|
||||
self.trigger('close');
|
||||
});
|
||||
},
|
||||
focus: function() {
|
||||
this.$element.find('input').focus();
|
||||
},
|
||||
/**
|
||||
* Handles user event from nested quick creation view
|
||||
*/
|
||||
quick_add: function () {
|
||||
var self = this;
|
||||
this._dataset.call(
|
||||
'name_create', [self.$input.val(), new instance.web.CompoundContext(
|
||||
this._dataset.get_context(), this._context)])
|
||||
.pipe(function(record) {
|
||||
self.$input.val("");
|
||||
self.trigger('added', record);
|
||||
}, function(error, event) {
|
||||
event.preventDefault();
|
||||
return self.slow_create();
|
||||
});
|
||||
},
|
||||
slow_create: function() {
|
||||
var self = this;
|
||||
var pop = new instance.web.form.SelectCreatePopup(this);
|
||||
pop.select_element(
|
||||
self._dataset.model,
|
||||
{
|
||||
title: _t("Create: ") + (this.string || this.name),
|
||||
initial_view: "form",
|
||||
disable_multiple_selection: true
|
||||
},
|
||||
[],
|
||||
{"default_name": self.$input.val()}
|
||||
);
|
||||
pop.on_select_elements.add(function(element_ids) {
|
||||
self.$input.val("");
|
||||
self.trigger('added', element_ids);
|
||||
});
|
||||
return this._super();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
<t t-if="widget.view.group_by">
|
||||
<div class="oe_kanban_group_header">
|
||||
<div class="oe_kanban_fold_icon"></div>
|
||||
<div class="oe_kanban_add"></div>
|
||||
<t t-if="widget.view.options.quick_creatable">
|
||||
<div class="oe_kanban_add"></div>
|
||||
</t>
|
||||
<div class="oe_fold_column">
|
||||
<div t-attf-class="oe_kanban_group_title #{widget.undefined_title ? 'oe_kanban_group_title_undefined' : ''}">
|
||||
<t t-esc="widget.title"/>
|
||||
@@ -35,6 +37,9 @@
|
||||
<p t-if="widget.title" class="oe_kanban_group_title_vertical"><t t-esc="widget.title"/></p>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="! widget.view.group_by && widget.view.options.quick_creatable">
|
||||
<span class="oe_kanban_no_group_qc_placeholder"/>
|
||||
</t>
|
||||
</td>
|
||||
</t>
|
||||
<t t-name="KanbanView.group_records_container">
|
||||
@@ -63,8 +68,11 @@
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
<form t-name="KanbanView.quick_create" class="oe_kanban_quick_create">
|
||||
<input/>
|
||||
<button type="submit">Add</button>
|
||||
</form>
|
||||
<div t-name="KanbanView.quick_create" class="oe_kanban_quick_create">
|
||||
<input t-att-placeholder="_t('Type name to create')"/>
|
||||
<t t-if="widget._buttons">
|
||||
<button class="oe-kanban-quick_create_add">Add</button>
|
||||
<button class="oe-kanban-quick_create_close">Close</button>
|
||||
</t>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user