[6.1][7.0][trunk][stock] Move destination and action_done bug

Bug #1160927 reported by Yann Papouin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

This bug can be observed when the fix for following bug is applied:
https://bugs.launchpad.net/openobject-addons/+bug/1137541:
  [6.1][7.0][trunk][stock] Move destination and partial picking

When doing a partial picking, a new move is created when the quantity quantity received/sent is lesser than the expected one.
For eg: You are waiting for 10xPCE, you received 6xPCE:

  A: stock.move with 10xPCE -> state ASSIGNED

after the partial picking, it gives:

  A: stock.move with 4xPCE -> state ASSIGNED
  B: stock.move with 6xPCE -> state DONE

But if you take a look "stock_move.action_done", you will see that a force_assign is done on the destination move and this is a wrong thing to because 6xPCE != 10xPCE

    if move.move_dest_id.state in ('waiting', 'confirmed'):
        self.force_assign(cr, uid, [move.move_dest_id.id], context=context)

This part of code was Ok before because the move_dest_id was not copied in the newly create move.

Fix proposal:
Replace "force_assign" with "check_assign" AND doing it AFTER the move state is set to done.
see screenshot attached

Revision history for this message
Yann Papouin (yann-papouin) wrote :
description: updated
Revision history for this message
Yann Papouin (yann-papouin) wrote :

The "check_assign" behavior seems to randomly works for me so I just added a force_assign when all moves attached to a specific move via move_dest_id are 'done' or 'cancel':

for move_dest_id in self.browse(cr, uid, move_dest_ids, context=context):

    force_assignment = True
    parent_moves_ids = self.search(cr, uid, [('move_dest_id', '=', move_dest_id.id)])
    for parent_move in self.browse(cr, uid, parent_moves_ids, context=context):
        if parent_move.state not in ('done','cancel'):
          force_assignment = False
          break

    if force_assignment:
        self.force_assign(cr, uid, [move_dest_id.id], context=context)
    else:
        self.check_assign(cr, uid, [move_dest_id.id], context=context)

    if move_dest_id.picking_id:
        wf_service.trg_write(uid, 'stock.picking', move_dest_id.picking_id.id, cr)
    if move_dest_id.auto_validate:
        self.action_done(cr, uid, [move_dest_id.id], context=context)

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Yaan,

Could not get you correctly, because partial picking wizard will call the do_partial method.

When you partially picked the 6 qty of your picking then it will generated the backorder of the original picking with 6 qty with done state and remain 4 qty as a available state because when you process any move its always on available state.

Please provide the proper steps or use case, So I can understand it better.

Thank you!

Amit Parik (amit-parik)
Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Yann Papouin (yann-papouin) wrote :

This bug can be observed when the fix for following bug is applied:
https://bugs.launchpad.net/openobject-addons/+bug/1137541:
  [6.1][7.0][trunk][stock] Move destination and partial picking

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Yaan,

Would you please provide the proper use case or video, So I can test it at me end.

Thanks in advance!

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for OpenERP Addons because there has been no activity for 60 days.]

Changed in openobject-addons:
status: Incomplete → Expired
Revision history for this message
Yann Papouin (yann-papouin) wrote :

A fix for this bug (rev 7253) has been committed for 6.1 back-ported from 7.0

[MERGE] OPW 577110: stock.move: only auto-validate next move if there are no other pending upstream moves
Backport of 7.0 fix at revision 8023 <email address hidden>

Changed in openobject-addons:
status: Expired → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.