2013-06-26 08:30:39 +00:00
|
|
|
|
|
|
|
function openerp_picking_widgets(instance){
|
|
|
|
var module = instance.stock;
|
|
|
|
|
|
|
|
module.PickingEditorWidget = instance.web.Widget.extend({
|
|
|
|
template: 'PickingEditorWidget',
|
2013-06-26 13:11:31 +00:00
|
|
|
init: function(parent,options){
|
|
|
|
this._super(parent,options);
|
|
|
|
},
|
2013-06-26 08:30:39 +00:00
|
|
|
get_header: function(){
|
2013-06-26 13:11:31 +00:00
|
|
|
return this._header || 'Picking: INTERNAL/00112';
|
2013-06-26 08:30:39 +00:00
|
|
|
},
|
|
|
|
get_rows: function(){
|
2013-06-26 14:14:21 +00:00
|
|
|
var model = this.getParent();
|
|
|
|
var rows = [];
|
|
|
|
console.log('Parent:', this.getParent());
|
|
|
|
|
|
|
|
_.each( model.movelines, function(moveline){
|
|
|
|
console.log('Moveline:',moveline);
|
|
|
|
rows.push({
|
|
|
|
cols: { product: moveline.product_id[1],
|
|
|
|
qty: moveline.product_qty,
|
|
|
|
rem: moveline.qty_remaining,
|
|
|
|
uom: moveline.product_uom[1],
|
|
|
|
loc: moveline.location_id[1],
|
|
|
|
stat: moveline.state
|
|
|
|
},
|
|
|
|
classes: (moveline.qty_remaining < 0 ? 'oe_invalid' : '')
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return rows;
|
2013-06-26 08:30:39 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
module.PackageEditorWidget = instance.web.Widget.extend({
|
|
|
|
template: 'PackageEditorWidget',
|
|
|
|
get_header: function(){
|
2013-06-26 13:11:31 +00:00
|
|
|
return this._header || 'Package: 032 ';
|
2013-06-26 08:30:39 +00:00
|
|
|
},
|
|
|
|
get_rows: function(){
|
2013-06-26 13:11:31 +00:00
|
|
|
return this._rows || [
|
2013-06-26 08:30:39 +00:00
|
|
|
{ cols: { product:'abc', qty:1, uom: 5, }, },
|
2013-06-26 13:11:31 +00:00
|
|
|
{ cols: { product:'dec', qty:2, uom: 5, }, classes: '' },
|
2013-06-26 08:30:39 +00:00
|
|
|
{ cols: { product:'qcr', qty:4, uom: 5, }, },
|
|
|
|
];
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
module.PackageSelectorWidget = instance.web.Widget.extend({
|
|
|
|
template: 'PackageSelectorWidget',
|
|
|
|
get_header: function(){
|
2013-06-26 13:11:31 +00:00
|
|
|
return this._header || 'Package Selector';
|
2013-06-26 08:30:39 +00:00
|
|
|
},
|
|
|
|
get_rows: function(){
|
2013-06-26 13:11:31 +00:00
|
|
|
return this._rows || [
|
|
|
|
{ cols: { pack:'abc', qty:12 }, },
|
|
|
|
{ cols: { pack:'def', qty:500 }, classes: '' },
|
|
|
|
{ cols: { pack:'ghi', qty:1 }, },
|
2013-06-26 08:30:39 +00:00
|
|
|
];
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
module.PickingMainWidget = instance.web.Widget.extend({
|
|
|
|
template: 'PickingMainWidget',
|
2013-06-26 09:20:29 +00:00
|
|
|
init: function(parent,params){
|
|
|
|
this._super(parent,params);
|
2013-06-26 14:14:21 +00:00
|
|
|
var self = this;
|
|
|
|
|
|
|
|
this.picking = null;
|
|
|
|
this.movelines = null;
|
|
|
|
|
|
|
|
window.pickwidget = this;
|
2013-06-26 13:11:31 +00:00
|
|
|
|
|
|
|
console.log('Action params:', params);
|
|
|
|
|
2013-06-26 14:14:21 +00:00
|
|
|
this.loaded = new instance.web.Model('stock.picking.in')
|
2013-06-26 13:11:31 +00:00
|
|
|
.query()
|
|
|
|
.all()
|
2013-06-26 14:14:21 +00:00
|
|
|
.then(function(picking_in){
|
|
|
|
self.picking = picking_in[0];
|
|
|
|
console.log('Picking In:',picking_in);
|
|
|
|
|
|
|
|
return new instance.web.Model('stock.move').call('read',[self.picking.move_lines, []]);
|
|
|
|
}).then(function(movelines){
|
|
|
|
self.movelines = movelines;
|
|
|
|
console.log('Move Lines:',movelines);
|
2013-06-26 13:11:31 +00:00
|
|
|
});
|
2013-06-26 08:30:39 +00:00
|
|
|
|
|
|
|
},
|
|
|
|
start: function(){
|
|
|
|
var self = this;
|
|
|
|
instance.webclient.set_content_full_screen(true);
|
|
|
|
|
2013-06-26 14:38:15 +00:00
|
|
|
this.$('.js_pick_quit').click(function(){ self.quit(); });
|
|
|
|
|
2013-06-26 14:14:21 +00:00
|
|
|
$.when(this.loaded).done(function(){
|
|
|
|
var picking_editor = new module.PickingEditorWidget(self);
|
|
|
|
picking_editor.replace(self.$('.oe_placeholder_picking_editor'));
|
|
|
|
|
|
|
|
var package_editor = new module.PackageEditorWidget(self);
|
|
|
|
package_editor.replace(self.$('.oe_placeholder_package_editor'));
|
2013-06-26 08:30:39 +00:00
|
|
|
|
2013-06-26 14:14:21 +00:00
|
|
|
var package_selector = new module.PackageSelectorWidget(self);
|
|
|
|
package_selector.replace(self.$('.oe_placeholder_package_selector'));
|
|
|
|
});
|
2013-06-26 08:30:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
return this._super();
|
|
|
|
},
|
2013-06-26 14:14:21 +00:00
|
|
|
scan: function(ean){
|
|
|
|
new instance.web.Model('stock.picking')
|
|
|
|
.call('get_barcode_and_return_todo_stuff', [this.picking.id, ean])
|
|
|
|
.then(function(results){
|
|
|
|
console.log('STUFF TODO:', arguments);
|
|
|
|
});
|
|
|
|
},
|
2013-06-26 14:38:15 +00:00
|
|
|
quit: function(){
|
|
|
|
console.log('Quit');
|
|
|
|
instance.webclient.set_content_full_screen(false);
|
|
|
|
window.location = '/'; // FIXME THIS IS SHIT NIV WILL KILL YOU (BY MULTIPLE FACE-STABBING) IF YOU MERGE THIS IN TRUNK
|
|
|
|
},
|
2013-06-26 08:30:39 +00:00
|
|
|
});
|
|
|
|
}
|