Skip to content

[17.0][18.0] stock_picking_group_by_partner_by_carrier: Problem due to the serialization of the super call in _create_backorder #2001

@pedrobaeza

Description

@pedrobaeza

Steps to reproduce:

  • Install stock_picking_group_by_partner_by_carrier and stock_picking_batch.
  • Create 2 pickings.
  • Add both to the same batch.
  • Assign and put a partial done quantity.
  • Validate the batch picking and do backorders.

Result: The first picking is removed from the batch picking, while it shouldn't.

These steps can be seen in this test reproducing the scenario:

https://github.com/OCA/stock-logistics-workflow/actions/runs/15872247400/job/44751372455?pr=1997#step:8:732

Why is this happening? The module stock_picking_group_by_partner_by_carrier is serializing the super call of _create_backorder:

https://github.com/Tecnativa/stock-logistics-workflow/blob/63969b7ef7a9d3534c7e4a4c222a292b6882be3a/stock_picking_group_by_partner_by_carrier/models/stock_picking.py#L93

but the module stock_picking_batch is performing a condition reviewing if you are backordering the whole batch picking (the part any(p not in self for p in picking.batch_id.picking_ids - pickings_to_detach)):

https://github.com/odoo/odoo/blob/d83801027c9a88b6e4db8166b6e2aad41ed760b9/addons/stock_picking_batch/models/stock_picking.py#L178

as we are not passing to super the whole recordset, then each picking except the last are detached from the batch picking.

As I don't know the involved module, I can't suggest a solution for not having to serialize the super call. One I'm thinking on is to prepare a dictionary to pass by context with each picking d True/False as values for being checked in the other methods.

Please check @sebalix, as you were the one introducing the problem in b4bcddf

Other contributors: @jbaudoux @rousseldenis

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions