[FIX] if necessary, add padding when rendering a given row in an editable list.

otherwise there are columns missing, and the list looks broken

lp bug: https://launchpad.net/bugs/893055 fixed

bzr revid: xmo@openerp.com-20111123093313-8qair3pai8ms4ch7
This commit is contained in:
Xavier Morel 2011-11-23 10:33:13 +01:00
parent 1ca5b10918
commit d00008c994
2 changed files with 26 additions and 0 deletions

View File

@ -5,6 +5,7 @@
openerp.web.list_editable = function (openerp) {
var KEY_RETURN = 13,
KEY_ESCAPE = 27;
var QWeb = openerp.web.qweb;
// editability status of list rows
openerp.web.ListView.prototype.defaults.editable = null;
@ -350,6 +351,19 @@ openerp.web.list_editable = function (openerp) {
new_record: function () {
this.dataset.index = null;
this.render_row_as_form();
},
render_record: function (record) {
var index = this.records.indexOf(record);
// FIXME: context dict should probably be extracted cleanly
return QWeb.render('ListView.row', {
columns: this.columns,
options: this.options,
record: record,
row_parity: (index % 2 === 0) ? 'even' : 'odd',
view: this.view,
render_cell: $.proxy(this, 'render_cell'),
edited: !!this.edition_form
});
}
});
if (!openerp.web.list) {

View File

@ -1369,6 +1369,18 @@
<button type="button" class="oe_formopenpopup-form-save">Save</button>
<button type="button" class="oe_formopenpopup-form-close">Cancel</button>
</t>
<t t-extend="ListView.row">
<!-- adds front & back padding to row being rendered after edition, if
necessary (if not selectable add front padding and if not deletable
add back padding), otherwise the row being added is missing columns
-->
<t t-jquery="&gt; :first" t-operation="before">
<td t-if="edited and !options.selectable" class="oe-listview-padding"/>
</t>
<t t-jquery="&gt; :last" t-operation="after">
<td t-if="edited and !options.deletable" class="oe-listview-padding"/>
</t>
</t>
<t t-name="ListView.row.frame" t-extend="WidgetFrame">
<t t-jquery="tr">
$(document.createElement('t'))