summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2014-11-03 12:35:23 +0100
committerFrédéric van der Essen <fvdessen@gmail.com>2014-11-26 11:46:16 +0100
commit35bfcbf74cba6c540e44b6551f4bc7fd2edee1a2 (patch)
tree4bb9909ceabfd122d0d2767981ecc1ad61efdbf8 /addons
parent372a3fade2378e06e8eb36dbe6a81945e5ab9486 (diff)
[IMP] stock picking front-end: when Todo is in ]0,1[, automatically set scanned to Todo when clicking on +
Diffstat (limited to 'addons')
-rw-r--r--addons/stock/stock.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 8a59171a4a8..cae63e1981e 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -2282,6 +2282,7 @@ class stock_move(osv.osv):
def action_done(self, cr, uid, ids, context=None):
""" Process completely the moves given as ids and if all moves are done, it will finish the picking.
"""
+ print "Action done"
context = context or {}
picking_obj = self.pool.get("stock.picking")
quant_obj = self.pool.get("stock.quant")
@@ -3945,19 +3946,14 @@ class stock_pack_operation(osv.osv):
new_lot_id = self.pool.get('stock.production.lot').create(cr, uid, val, context=context)
self.write(cr, uid, id, {'lot_id': new_lot_id}, context=context)
- def _search_and_increment(self, cr, uid, picking_id, domain, filter_visible=False, visible_op_ids=False, weight=1, increment=True, context=None):
- '''Search for an operation with given 'domain' in a picking, if it exists increment the qty (+weight) otherwise create it
+ def _search_and_increment(self, cr, uid, picking_id, domain, filter_visible=False, visible_op_ids=False, weight=-1, increment=True, context=None):
+ '''Search for an operation with given 'domain' in a picking, if it exists increment the qty (+weight if weight != -1, +1 otherwise) otherwise create it
:param domain: list of tuple directly reusable as a domain
context can receive a key 'current_package_id' with the package to consider for this operation
- weight is used for weighted products for which quantity != 1 (not per unit but e.g. per kg)
+ weight is used for weighted products for which quantity != 1 (not per unit but e.g. per kg). Weight == -1 when buttons - or + are pressed.
returns True
'''
- print "Search and increment " + str(weight)
- if increment:
- print "INCREMENT"
- else:
- print "NOT INCREMENT"
if context is None:
context = {}
@@ -3976,7 +3972,13 @@ class stock_pack_operation(osv.osv):
op_obj = self.browse(cr, uid, operation_id, context=context)
qty = op_obj.qty_done
if increment:
- qty += weight
+ if weight == -1: # button + pressed
+ if op_obj.product_qty != qty:
+ qty = min(qty+1, op_obj.product_qty);
+ else:
+ qty += 1
+ else: # Weigth scanned
+ qty += weight;
else:
if qty == 0 and op_obj.product_qty == 0:
#we have a line with 0 qty set, so delete it