Skip to content

stock_picking_group_by_partner_by_carrier & delivery: wrong sale_id #1833

@jbaudoux

Description

@jbaudoux

As the module merges pickings from different sales orders, a new sale_ids field is incremented. The standard field sale_id represents the first sales order that created the procurement group.
Many odoo delivery modules relies on the sale_id field. The OCA delivery_packag_fee also: https://github.com/OCA/delivery-carrier/blob/16.0/delivery_package_fee/models/stock_picking.py#L23

If you partially deliver but you don't deliver anything from the initial SO that created the procurement group, the shipping will be declared for that original SO (deliver_... modules) and delivery fee will be added on the original SO where there is nothing to invoice (in standard odoo, a sales order with only delivery fees to invoice is not marked as to invoice).

I think stock_picking_group_by_partner_by_carrier is lacking the update of sale_id (as well as likely sale_ids) on action_done before the call to send_to_shipper.

Maybe there is also an issue if you add a move in the delivered picking and it doesn't get added to one of the delivered SO but to the original SO.

Needs to be tested if this suspected issue can be reproduced and confirmed

@sebalix @rousseldenis

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugno staleUse this label to prevent the automated stale action from closing this PR/Issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions