rem: moveline.remaining_qty,
uom: moveline.product_uom[1],
loc: moveline.location_id[1],
- stat: moveline.state
+ id: moveline.product_id[0],
},
classes: (moveline.qty_remaining < 0 ? 'oe_invalid' : '')
});
return rows;
},
+ renderElement: function(){
+ var self = this;
+ this._super();
+ this.$('.js_pack_scan').click(function(){
+ var id = parseInt($(this).attr('op-id'));
+ console.log('Id:',id);
+ self.getParent().scan_product_id(id);
+ });
+ },
});
module.PackageEditorWidget = instance.web.Widget.extend({
product: op.product_id[1],
uom: op.product_uom ? product_uom[1] : '',
qty: op.product_qty,
- }
+ },
+ classes: 'js_pack_op '+ (op.id === model.get_selected_operation() ? 'oe_selected' : ''),
+ att_op_id: op.id,
});
});
return rows;
},
+ renderElement: function(){
+ var self = this;
+ this._super();
+ var model = this.getParent();
+ this.$('.js_pack_op').click(function(){
+ self.$('.js_pack_op').removeClass('oe_selected');
+ $(this).addClass('oe_selected');
+ model.set_selected_operation(parseInt($(this).attr('op-id')));
+ });
+ },
});
module.PackageSelectorWidget = instance.web.Widget.extend({
this.pickings = [];
this.movelines = null;
this.operations = null;
+ this.selected_operation = { id: null, picking_id: null};
this.packages = null;
this.barcode_scanner = new module.BarcodeScanner();
this.picking_type_id = params.context.active_id || 0;
}else{
this.loaded = this.load();
}
+
+ window.pickwidget = this;
},
// load the picking data from the server. If picking_id is undefined, it will take the first picking
});
},
- scan: function(ean){
+ scan: function(ean){ //scans a barcode, sends it to the server, then reload the ui
var self = this;
new instance.web.Model('stock.picking')
.call('get_barcode_and_return_todo_stuff', [self.picking.id, ean])
.then(function(){
+ self.reset_selected_operation();
+ return self.refresh_ui(self.picking.id);
+ });
+ },
+ scan_product_id: function(product_id){ //performs the same operation as a scan, but with product id instead
+ var self = this;
+ new instance.web.Model('stock.picking')
+ .call('get_product_id_and_return_todo_stuff', [self.picking.id, product_id])
+ .then(function(){
+ self.reset_selected_operation();
return self.refresh_ui(self.picking.id);
});
},
}
ops.push(op);
});
+ console.log('Current Operations:',ops);
return ops;
},
+ get_selected_operation: function(){
+ if( this.selected_operation.picking_id === this.picking.id && this.selected_operation.id ){
+ return this.selected_operation.id;
+ }else{
+ this.selected_operation.picking_id = this.picking.id;
+ var ops = this.get_current_operations();
+ if(ops.length === 0){
+ this.selected_operation.id = null;
+ }else{
+ this.selected_operation.id = ops[ops.length - 1].id;
+ }
+ return this.selected_operation.id;
+ }
+ },
+ reset_selected_operation: function(){
+ if(this.selected_operation.picking_id === this.picking.id){
+ this.selected_operation.id = null;
+ }
+ },
+ set_selected_operation: function(id){
+ this.selected_operation.picking_id = this.picking.id;
+ this.selected_operation.id = id;
+ },
set_operation_quantity: function(quantity){
var self = this;
- var ops = this.get_current_operations();
- if( !ops || ops.length === 0){
+ var op = this.get_selected_operation();
+ if( !op ){
return;
}
- var op = ops[ops.length-1];
if(quantity === '++'){
quantity = op.product_qty + 1;
<col class='oe_pick_col_small'></col>
<col class='oe_pick_col_small'></col>
<col class='oe_pick_col_expand'></col>
- <col class='oe_pick_col_expand'></col>
+ <col class='oe_pick_col_small'></col>
</colgroup>
<thead>
<th class='oe_centeralign'>Rem</th>
<th class='oe_centeralign'>UoM</th>
<th>Location</th>
- <th>Status</th>
+ <th>Scan</th>
</tr>
</thead>
<td class='oe_centeralign'> <t t-esc="row.cols.rem" /> </td>
<td class='oe_centeralign'> <t t-esc="row.cols.uom" /> </td>
<td> <t t-esc="row.cols.loc" /> </td>
- <td> <t t-esc="row.cols.stat" /> </td>
+ <td><span class='oe_row_button oe_expanded js_pack_scan' t-att-op-id='row.cols.id'>➔</span></td>
</tr>
</t>
</tbody>
<tbody>
<t t-foreach="widget.get_rows()" t-as="row">
- <tr t-att-class="row.classes">
+ <tr t-att-class="row.classes" t-att-op-id="row.att_op_id">
<td> <t t-esc="row.cols.product" /> </td>
<td class='oe_centeralign'> <t t-esc="row.cols.qty" /> </td>
<td class='oe_centeralign'> <t t-esc="row.cols.uom" /> </td>