[IMP] Push apply has to take into account routes from categories

bzr revid: jco@openerp.com-20130911095605-5g21o94170cpll48
This commit is contained in:
Josse Colpaert
2013-09-11 11:56:05 +02:00
parent c00bce6038
commit cac70450e0
2 changed files with 10 additions and 9 deletions
+2 -1
View File
@@ -605,7 +605,8 @@
<notebook>
<page string="Products">
<field name="pack_operation_exist" invisible="1"/>
<button name="action_pack" string="Create Package" type="object" attrs="{'invisible': ['|',('pack_operation_exist', '=', False),('state', 'not in', ('draft','assigned','confirmed'))]}"/>
<button name="action_pack" string="Create Package" type="object" attrs="{'invisible': ['|',('pack_operation_exist', '=', False),('state', 'not in', ('draft','assigned','confirmed'))]}"
groups="stock.group_tracking_lot"/>
<button name="do_split" string="Split" groups="base.group_no_one" type="object" attrs="{'invisible': ['|',('pack_operation_exist', '=', False),('state','!=','assigned')]}"/>
<field name="pack_operation_ids" attrs="{'invisible': [('pack_operation_exist', '=', False)]}">
<tree editable="top">
+8 -8
View File
@@ -244,16 +244,16 @@ class stock_move(osv.osv):
}
def _push_apply(self, cr, uid, moves, context):
categ_obj = self.pool.get("product.category")
push_obj = self.pool.get("stock.location.path")
for move in moves:
if not move.move_dest_id:
for route in move.product_id.route_ids:
found = False
for rule in route.push_ids:
if rule.location_from_id.id == move.location_dest_id.id:
self.pool.get('stock.location.path')._apply(cr, uid, rule, move, context=context)
found = True
break
if found: break
categ_id = move.product_id.categ_id.id
routes = [x.id for x in move.product_id.route_ids] + categ_obj.calculate_total_routes(cr, uid, [categ_id], False, False, context=context)[categ_id]
rules = push_obj.search(cr, uid, [('route_id', 'in', routes), ('location_from_id', '=', move.location_dest_id.id)], context=context)
if rules:
rule = push_obj.browse(cr, uid, rules[0], context=context)
push_obj._apply(cr, uid, rule, move, context=context)
return True
# Create the stock.move.putaway records