mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[ADD][web_x2many_add_button_position] Move Add an item button (#578)
This commit is contained in:
committed by
Pedro M. Baeza
parent
cde08afb75
commit
7999843f1b
@@ -0,0 +1,23 @@
|
||||
/* Copyright 2017 Onestein
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||
|
||||
openerp.web_x2many_add_button_position = function(instance) {
|
||||
instance.web.form.AddAnItemList.include({
|
||||
pad_table_to: function() {
|
||||
var self = this;
|
||||
this._super.apply(this, arguments);
|
||||
if (this.view.fields_view.arch.attrs.editable &&
|
||||
this.view.fields_view.arch.attrs.editable == 'top') {
|
||||
this.move_add_item_button();
|
||||
this.$current.find('.' + this._add_row_class + ' a').click(function() {
|
||||
self.move_add_item_button();
|
||||
});
|
||||
}
|
||||
},
|
||||
move_add_item_button: function() {
|
||||
$btn_row = this.$current.find('.' + this._add_row_class).parent();
|
||||
$btn_row.detach();
|
||||
this.$current.find('tr:first').before($btn_row);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user