[ADD]search function to filter on location in barcode interface
bzr revid: csn@openerp.com-20140304164446-cdjnb5nt0bkiq8cj
This commit is contained in:
parent
992408c79f
commit
90fcbbbb97
|
@ -26,21 +26,31 @@ function openerp_picking_widgets(instance){
|
|||
template: 'PickingEditorWidget',
|
||||
init: function(parent,options){
|
||||
this._super(parent,options);
|
||||
this.search_result = '';
|
||||
},
|
||||
get_rows: function(){
|
||||
var model = this.getParent();
|
||||
var rows = [];
|
||||
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_uom_qty,
|
||||
qty: packopline.product_qty,
|
||||
rem: packopline.remaining_qty,
|
||||
uom: packopline.product_uom[1],
|
||||
uom: packopline.product_uom_id[1],
|
||||
lot: packopline.lot_id[1],
|
||||
pack: packopline.package_id[1],
|
||||
container: packopline.result_package_id[1],
|
||||
loc: packopline.location_id[1],
|
||||
dest: packopline.location_dest_id[1],
|
||||
id: packopline.product_id[0],
|
||||
},
|
||||
classes: (moveline.qty_remaining < 0 ? 'danger' : '')
|
||||
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,
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -54,10 +64,13 @@ function openerp_picking_widgets(instance){
|
|||
console.log('Id:',id);
|
||||
self.getParent().scan_product_id(id);
|
||||
});
|
||||
|
||||
//remove navigtion bar from default openerp GUI
|
||||
$('td.navbar').html('<div></div>');
|
||||
},
|
||||
on_searchbox: function(query){
|
||||
this.search_result = query;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
module.PackageEditorWidget = instance.web.Widget.extend({
|
||||
|
@ -413,6 +426,9 @@ function openerp_picking_widgets(instance){
|
|||
this.$('.js_pick_prev').click(function(){ self.picking_prev(); });
|
||||
this.$('.js_pick_next').click(function(){ self.picking_next(); });
|
||||
this.$('.js_pick_menu').click(function(){ self.menu(); });
|
||||
this.$('.oe_searchbox').keyup(function(event){
|
||||
self.on_searchbox($(this).val());
|
||||
});
|
||||
|
||||
this.hotkey_handler = function(event){
|
||||
if(event.keyCode === 37 ){ // Left Arrow
|
||||
|
@ -451,6 +467,11 @@ function openerp_picking_widgets(instance){
|
|||
}).fail(function(error) {console.log(error);});
|
||||
|
||||
},
|
||||
on_searchbox: function(query){
|
||||
var self = this;
|
||||
self.picking_editor.on_searchbox(query);
|
||||
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)
|
||||
refresh_ui: function(picking_id){
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
<th>Destination Location</th>
|
||||
<th>Lot</th>
|
||||
<th>Pack</th>
|
||||
<th>Container</th>
|
||||
<th>Scan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -75,10 +76,11 @@
|
|||
<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 t-esc="row.cols.loc" /> </td>
|
||||
<td> <t t-esc="row.cols.loc" /> </td>
|
||||
<td> <t t-esc="row.cols.loc" /> </td>
|
||||
<td> <t t-esc="row.cols.loc" /> </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> <t t-esc="row.cols.lot" /> </td>
|
||||
<td> <t t-esc="row.cols.pack" /> </td>
|
||||
<td> <t t-esc="row.cols.container" /> </td>
|
||||
<td><span class='btn btn-default js_pack_scan' t-att-op-id='row.cols.id'>➔</span></td>
|
||||
</tr>
|
||||
</t>
|
||||
|
@ -240,8 +242,10 @@
|
|||
<button type="button" class='btn btn-info js_pick_print'> Print </button>
|
||||
</div>
|
||||
<h2 class="oe_pick_app_header" t-esc='widget.get_header()' />
|
||||
<div class='oe_placeholder_picking_editor'/>
|
||||
<input type='text' class="oe_searchbox align-center" placeholder='Filter by location...'/>
|
||||
<button type="button" class='btn btn-default js_pick_pack pull-right'> Put in Pack </button>
|
||||
<div class='oe_placeholder_picking_editor'/>
|
||||
|
||||
<!-- <div class='oe_placeholder_package_editor'></div> -->
|
||||
</div>
|
||||
<!-- <div class="col-md-4">
|
||||
|
|
Loading…
Reference in New Issue