[WIP]barcode interface, add a barcode to location and allow the use of scanner to filter by location
bzr revid: csn@openerp.com-20140307163747-cua6u44t6u6r8juh
This commit is contained in:
@@ -219,7 +219,6 @@ function openerp_picking_widgets(instance){
|
||||
this.pickings_by_type = {};
|
||||
this.pickings_by_id = {};
|
||||
this.picking_search_string = "";
|
||||
|
||||
},
|
||||
load: function(){
|
||||
var self = this;
|
||||
@@ -574,9 +573,21 @@ function openerp_picking_widgets(instance){
|
||||
var self = this;
|
||||
new instance.web.Model('stock.picking')
|
||||
.call('process_barcode_from_ui', [self.picking.id, ean])
|
||||
.then(function(){
|
||||
self.reset_selected_operation();
|
||||
return self.refresh_ui(self.picking.id);
|
||||
.then(function(result){
|
||||
if (typeof(result)!="boolean"){
|
||||
//check if we have receive a location as answer
|
||||
if (result.filter_loc !== undefined){
|
||||
self.$('.oe_searchbox').val(result.filter_loc);
|
||||
self.on_searchbox(result.filter_loc);
|
||||
}
|
||||
}
|
||||
else{
|
||||
return self.refresh_ui(self.picking.id);
|
||||
//TODO add a then to highlight the line that was scanned, do same to scan_product_id
|
||||
// .then(function(product_id){
|
||||
// self.
|
||||
// });
|
||||
}
|
||||
});
|
||||
},
|
||||
scan_product_id: function(product_id){ //performs the same operation as a scan, but with product id instead
|
||||
@@ -584,7 +595,6 @@ function openerp_picking_widgets(instance){
|
||||
new instance.web.Model('stock.picking')
|
||||
.call('process_product_id_from_ui', [self.picking.id, product_id])
|
||||
.then(function(){
|
||||
self.reset_selected_operation();
|
||||
return self.refresh_ui(self.picking.id);
|
||||
});
|
||||
},
|
||||
@@ -730,15 +740,6 @@ function openerp_picking_widgets(instance){
|
||||
return null;
|
||||
}
|
||||
},
|
||||
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 op = this.get_selected_operation();
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<tbody>
|
||||
<t t-foreach="widget.get_rows()" t-as="row">
|
||||
<tr t-att-class="row.classes + ' js_pack_op_line'" t-att-data-id="row.cols.id">
|
||||
<td> <span class='btn btn-default js_pack_scan' t-att-op-id='row.cols.product_id'>➔</span> <t t-esc="row.cols.product" /> </td>
|
||||
<td class="text-center"> <span class='btn btn-default pull-left js_pack_scan' t-att-op-id='row.cols.product_id'>➔</span> <t t-esc="row.cols.product" /> </td>
|
||||
<td class='text-center'><t t-esc="row.cols.rem" /> / <t t-esc="row.cols.qty" /> <t t-esc="row.cols.uom" /></td>
|
||||
<td class="js_loc"> <t t-esc="row.cols.loc" />
|
||||
<t t-if="row.cols.lot" ><span> : <t t-esc="row.cols.lot" /></span></t>
|
||||
|
||||
@@ -127,6 +127,7 @@ class stock_location(osv.osv):
|
||||
'scrap_location': fields.boolean('Is a Scrap Location?', help='Check this box to allow using this location to put scrapped/damaged goods.'),
|
||||
'removal_strategy_ids': fields.one2many('product.removal', 'location_id', 'Removal Strategies'),
|
||||
'putaway_strategy_ids': fields.one2many('product.putaway', 'location_id', 'Put Away Strategies'),
|
||||
'loc_barcode': fields.char('Location barcode'),
|
||||
}
|
||||
_defaults = {
|
||||
'active': True,
|
||||
@@ -137,6 +138,12 @@ class stock_location(osv.osv):
|
||||
'posz': 0,
|
||||
'scrap_location': False,
|
||||
}
|
||||
_sql_constraints = [('loc_barcode_company_uniq', 'unique (loc_barcode,company_id)', 'The barcode for a location must be unique per company !')]
|
||||
|
||||
def create(self, cr, uid, default, context=None):
|
||||
if not default.get('loc_barcode', False):
|
||||
default.update({'loc_barcode': default.get('complete_name', False)})
|
||||
return super(stock_location,self).create(cr, uid, default, context=context)
|
||||
|
||||
def get_putaway_strategy(self, cr, uid, location, product, context=None):
|
||||
pa = self.pool.get('product.putaway')
|
||||
@@ -1255,6 +1262,13 @@ class stock_picking(osv.osv):
|
||||
package_obj = self.pool.get('stock.quant.package')
|
||||
product_obj = self.pool.get('product.product')
|
||||
stock_operation_obj = self.pool.get('stock.pack.operation')
|
||||
stock_location_obj = self.pool.get('stock.location')
|
||||
#check if the barcode correspond to a location
|
||||
matching_location_ids = stock_location_obj.search(cr, uid, [('loc_barcode', '=', barcode_str)], context=context)
|
||||
if matching_location_ids:
|
||||
#if we have a location, return immediatly with the location name
|
||||
location = stock_location_obj.browse(cr, uid, matching_location_ids[0], context=None)
|
||||
return {'filter_loc': stock_location_obj._name_get(cr, uid, location, context=None)}
|
||||
#check if the barcode correspond to a product
|
||||
matching_product_ids = product_obj.search(cr, uid, ['|', ('ean13', '=', barcode_str), ('default_code', '=', barcode_str)], context=context)
|
||||
if matching_product_ids:
|
||||
@@ -1271,6 +1285,7 @@ class stock_picking(osv.osv):
|
||||
if matching_package_ids:
|
||||
stock_operation_obj._search_and_increment(cr, uid, picking_id, [('package_id', '=', matching_package_ids[0])], context=context)
|
||||
|
||||
return False
|
||||
|
||||
class stock_production_lot(osv.osv):
|
||||
_name = 'stock.production.lot'
|
||||
|
||||
@@ -375,6 +375,7 @@
|
||||
<field name="posx"/>
|
||||
<field name="posy"/>
|
||||
<field name="posz"/>
|
||||
<field name="loc_barcode"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator string="Removal Strategies" groups="stock.group_adv_location"/>
|
||||
|
||||
Reference in New Issue
Block a user