template: 'PickingEditorWidget',
init: function(parent,options){
this._super(parent,options);
- this.search_result = '';
},
get_rows: function(){
var model = this.getParent();
var self = this;
_.each( model.packoplines, function(packopline){
- var select_search_src = (packopline.location_id[1] && packopline.location_id[1].indexOf(self.search_result) !== -1);
- var select_search_dst = (packopline.location_dest_id[1] && packopline.location_dest_id[1].indexOf(self.search_result) !== -1);
rows.push({
cols: { product: packopline.product_id[1],
qty: packopline.product_qty,
dest: packopline.location_dest_id[1],
id: packopline.product_id[0],
},
- classes: (packopline.qty_remaining < 0 ? 'danger' : '') + (self.search_result === '' || select_search_src || select_search_dst ? '' : 'hidden'),
- highlight_src: self.search_result !== '' && select_search_src,
- highlight_dst: self.search_result !== '' && select_search_dst,
+ classes: (packopline.qty_remaining < 0 ? 'danger' : ''),
});
});
$('td.navbar').html('<div></div>');
},
on_searchbox: function(query){
- this.search_result = query;
+ var self = this;
+ if (query !== '') {
+ this.$('.js_loc:not(.js_loc:contains('+query+'))').removeClass('warning');
+ this.$('.js_loc:contains('+query+')').addClass('warning');
+ this.$('.js_pack_op_line:not(.js_pack_op_line:has(.js_loc:contains('+query+')))').addClass('hidden');
+ this.$('.js_pack_op_line:has(.js_loc:contains('+query+'))').removeClass('hidden');
+ }
+ if (query === '') {
+ this.$('.js_loc').removeClass('warning');
+ this.$('.js_pack_op_line.hidden').removeClass('hidden');
+ }
return true;
}
});
on_searchbox: function(query){
var self = this;
self.picking_editor.on_searchbox(query);
- self.refresh_ui(self.picking);
+ // self.refresh_ui(self.picking);
},
// reloads the data from the provided picking and refresh the ui.
// (if no picking_id is provided, gets the first picking in the db)
<tbody>
<t t-foreach="widget.get_rows()" t-as="row">
- <tr t-att-class="row.classes">
+ <tr t-att-class="row.classes + 'js_pack_op_line'">
<td> <input type="checkbox"/></td>
<td> <t t-esc="row.cols.product" /> </td>
<td class='text-center'> <t t-esc="row.cols.qty" /> <t t-esc="row.cols.uom" /> </td>
<td class='text-center'> <t t-esc="row.cols.rem" /> </td>
- <!-- <td class='text-center'> </td> -->
- <td t-att-class="(row.highlight_src === true ? 'warning':'') "> <t t-esc="row.cols.loc" /> </td>
- <td t-att-class="(row.highlight_dst === true ? 'warning':'') "> <t t-esc="row.cols.dest" /> </td>
+ <td class="js_loc"> <t t-esc="row.cols.loc" /> </td>
+ <td class="js_loc"> <t t-esc="row.cols.dest" /> </td>
<td> <t t-esc="row.cols.lot" /> </td>
<td> <t t-esc="row.cols.pack" /> </td>
<td> <t t-esc="row.cols.container" /> </td>