Cannot return outgoing moves if there are chained moves (including MTO products, products in a lot, settings with chained warehouse locations...)

Bug #944025 reported by fgi (OpenERP)
44
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Committed
Medium
OpenERP Publisher's Warranty Team

Bug Description

Return products (of a lot)

"Warning !
There are no products to return (only lines in Done state and not fully returned yet can be returned)!"

Steps to find the bug:

- Create a new product:
Stockable / Make to order / Buy
Check the boxes for the incoming and the outgoing traceability (Track Incoming/Outcoming Lots)

- Create a Sale Order for x PRODUCT
- Run the scheduler
- Confirm the Request for Quotation
- Receive the product
- Process the reception
- Create a new production lot
- Process the internal move (toward this new lot)
- Deliver the product (from this lot) -> State: done
- Click on Return Products

-> Window with the error message

Tags: maintenance

Related branches

Changed in openobject-addons:
status: New → Confirmed
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Low
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

This is not a low priority bug it block all the logistical process.
It should be tagged as high.

Regards

Nicolas

Changed in openobject-addons:
importance: Low → Medium
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Additional information on this:

* If the sale order includes MTO and MTS products and you try to return the delivery, only the MTS products are proposed. You don't get the error messages, but some lines are lacking in the form.

I have dug into this and the problem is that stock_move has a pair of attributes move_history_ids and move_history_ids2 which are used for two completely different things:

* for MTO products, the purchase_order will handle the MTO procurement by creating a stock_move from the supplier location to the stock location, and this move will have move_dest_id set to the stock_move from stock location to warehouse out location (methods _prepare_order_line_move and _create_pickings) . When the move is done (method action_done in stock/stock.py), any move refered to by move_dest_id is added to move_history_ids. As this is a m2m relation, the purchase move is also refered to by move_history_ids2 of the original stock->out move

* when handling shipping returns, the same move_history_ids/move_history_ids2 attributes are used to record partial returns for a delivery of a product. If the user shipped 5 items, and the customer returns 2 of them, the stock move for the return will be linked to the outgoing move using the move_history_ids relation. The wizard checks that the number of returned items is lower than the number of shipped items (by checking the outgoing move's move_history_ids2) and only proposes to create return moves for the remaining quantity.

Taken in isolation, both behaviours are ok. But when the returned good was MTO, the outgoing move already has a move_history_ids2 relation refering to the provider -> stock move, generally with exactly the shipped quantity. The return wizard gets confused and "thinks" that this refers to returned goods, and will refuse to return more than the shipped quantity.

We need to be able to tell these different move apart, for example by using different relations for purchase and returns or by flagging the moves as returns or purchases. Maybe the second option is already available indirectly by looking at the picking for example, in which case the return wizard needs to use this information.

Changed in openobject-addons:
assignee: OpenERP R&D Addons Team 2 (openerp-dev-addons2) → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Additional information:

products in MTO are not the only one concerned by this. Any stock.move with the move_dest_id column filled in will trigger the filling of move_history_ids when the action_done method is called. This means that if there are any chained moves in the processing of a shippment, it will not be possible to process returns in the final outgoing move.

Examples of configurations generating this situation:

* if a stock.location has a chained location with a chaining type different from "automatic"
* if the stock_location addon is used to configure push or pull flows
* mrp also generates moves with move_dest_id set

I'm changing the title of the bug report to reflect this.

summary: - Bug for return products (of a lot)
+ Cannot return outgoing moves if there are chained moves (including MTO
+ products, products in a lot, pr
summary: Cannot return outgoing moves if there are chained moves (including MTO
- products, products in a lot, pr
+ products, products in a lot
summary: Cannot return outgoing moves if there are chained moves (including MTO
- products, products in a lot
+ products, products in a lot, settings with chained warehouse
+ locations...)
Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello FGI, Nicolas and Alexandre,

Issue has been fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575526-pso with rev-no: 6836

It will be merged soon with Stable 6.1.

Thank you for reporting and contribution,
Priyesh

Changed in openobject-addons:
status: Confirmed → Fix Committed
Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

I will also fix this issue in 6.0 and will let you know the updates on it, soon.

Thanks,
Priyesh

Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello FGI, Nicolas and Alexandre,

Issue of preventing user to add more products than available to return has been fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-575526-pso with rev-no: 5253 for stable 6.0.

Issue of return of only one product is possible is not producible in 6.0 as there is constraint defined for picking name in stable 6.0.

It will be available soon in Stable 6.0

Thank you for reporting,
Priyesh

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

This has been fixed in OpenERP 6.1 as of revision [1]. It will be merged in trunk along with the next batch of forward-port between 6.1 and trunk. The fix for 6.0 is being reviewed as well.

[1] rev 6839 rev-id: <email address hidden>

Changed in openobject-addons:
milestone: none → 6.1
Revision history for this message
Elias (rtxehi) wrote :

When will this be pushed into the official 6.0 and 6.1 branches?

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

This patch is released in official 6.1 branch, state should be changed

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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