action_split has obvious bug and behavior not as expected
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Committed
|
Wishlist
|
OpenERP Publisher's Warranty Team |
Bug Description
The expected behavior of action_split on stock.stock_move imho would be that the original move quantity is reduced by quantity if quantity < move.quantity and there are split off moves for as many as quantity allows, each of the split off moves having a a quantity equal (or less for the last split off move if any remainder) to the split_by_quantity.
However the actual behavior is that:
if quantity >= move.qty
- the original move is set to split_by_qty and its move.id is returned as res[0]
- there are additional new split of moves for as many as quantity - split_by_qty (for the original move) allows and for the remainder. Their these ids are also returned.
if quantity < move.qty
- the system splits of moves and returns their ids but NEVER TOUCHES THE ORIGINAL MOVE. The original move is also not returned and remains having the old quantity.
There is also an obvious bug in that the uos_qty is not set correctly for the remainder.
I would suggest suggest the following changes in the code (indicated by the remarsk):
def action_split(self, cr, uid, ids, quantity, split_by_qty=1, prefix=False, with_lot=True, context=None):
""" Split Stock Move lines into production lot which specified split by quantity.
@param cr: the database cursor
@param uid: the user id
@param ids: ids of stock move object to be splited
@param split_by_qty : specify split by qty
@param prefix : specify prefix of production lot
@param with_lot : if true, prodcution lot will assign for split line otherwise not.
@param context: context arguments
@return: Splited move lines
"""
if context is None:
context = {}
if quantity <= 0:
raise osv.except_
res = []
for move in self.browse(cr, uid, ids, context=context):
if split_by_qty <= 0 or quantity == 0:
uos_qty = split_by_qty / move.product_qty * move.product_
}
for idx in range(int(
if not idx and move.product_
if with_lot:
if quantity_rest > 0:
idx = int(quantity/
if not idx and move.product_
if with_lot:
# added to modify behavior to always update original move by reducing it with quantity if quantity < move qty
if quantity < move.product_qty:
return res
Related branches
- Naresh(OpenERP) (community): Approve
-
Diff: 16 lines (+6/-0)1 file modifiedstock/stock.py (+6/-0)
Changed in openobject-addons: | |
assignee: | OpenERP R&D Addons Team 2 (openerp-dev-addons2) → OpenERP Publisher's Warranty Team (openerp-opw) |
tags: | added: maintenance |
Changed in openobject-addons: | |
status: | Confirmed → Fix Committed |
Changed in openobject-addons: | |
status: | Fix Committed → New |
status: | New → Fix Committed |
Hello Jeroen Vet,
I have checked your Issue with latest revision and also with stable. But at my end it's running fine as expected. That's why I have attached the video. Would you please check it And notify us where you have faced the problem.
Correct me If I am wrong!
Thank you and waiting for your reply!