Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0] Add compatibility module for stock_picking_type_shipping_policy and... #27

Merged
merged 2 commits into from
Jul 6, 2020

Conversation

guewen
Copy link
Member

@guewen guewen commented May 1, 2020

... stock_picking_group_by_partner_by_carrier (of OCA/stock-logistics-workflow).

In stock_picking_group_by_partner_by_carrier, the override of the method
_search_picking_for_assignation adds a domain on:

("move_type", "=", self.group_id.move_type)

(self is the move to assign in a picking).

When the move_type of the procurement group is "direct", the transfer is
normally created with the move_type "direct": when a first move is
assigned to a picking and none is found, it creates one with type
"direct", the second move should find the same and be assigned to it.

This is not what happens, with stock_picking_type_shipping_policy
configured to "force_all_product_ready", as it changes the way the first
stock.picking is created:

def _get_new_picking_values(self):
    res = super()._get_new_picking_values()
    picking_type = self.mapped("picking_type_id")
    if picking_type.shipping_policy == "force_as_soon_as_possible":
        res["move_type"] = "direct"
    elif picking_type.shipping_policy == "force_all_products_ready":
        res["move_type"] = "one"
    return res

The first stock.picking is created with a move_type of "one", so when
the second move search a stock.picking, it can't find it as it looks for
a "direct" one.

This glue module changes the domain of the grouping to take into account the
picking type's shipping policy when both modules are installed.

@guewen guewen changed the title Add compatibility module for stock_picking_type_shipping_policy and... [13.0] Add compatibility module for stock_picking_type_shipping_policy and... May 1, 2020
... stock_picking_group_by_partner_by_carrier (of
OCA/stock-logistics-workflow).

In stock_picking_group_by_partner_by_carrier, the override of the method
_search_picking_for_assignation adds a domain on:

("move_type", "=", self.group_id.move_type)

(self is the move to assign in a picking).

When the move_type of the procurement group is "direct", the transfer is
normally created with the move_type "direct": when a first move is
assigned to a picking and none is found, it creates one with type
"direct", the second move should find the same and be assigned to it.

This is not what happens, with stock_picking_type_shipping_policy
configured to "force_all_product_ready", as it changes the way the first
stock.picking is created:

    def _get_new_picking_values(self):
        res = super()._get_new_picking_values()
        picking_type = self.mapped("picking_type_id")
        if picking_type.shipping_policy == "force_as_soon_as_possible":
            res["move_type"] = "direct"
        elif picking_type.shipping_policy == "force_all_products_ready":
            res["move_type"] = "one"
        return res

The first stock.picking is created with a move_type of "one", so when
the second move search a stock.picking, it can't find it as it looks for
a "direct" one.

This glue module changes the domain of the grouping to take into account the
picking type's shipping policy when both modules are installed.
Copy link
Contributor

@sebalix sebalix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, 👍

Copy link
Member

@jgrandguillaume jgrandguillaume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT

@jgrandguillaume
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 13.0-ocabot-merge-pr-27-by-jgrandguillaume-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Jul 6, 2020
Signed-off-by jgrandguillaume
@OCA-git-bot
Copy link
Contributor

It looks like something changed on 13.0 in the meantime.
Let me try again (no action is required from you).
Prepared branch 13.0-ocabot-merge-pr-27-by-jgrandguillaume-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit cd9d84f into OCA:13.0 Jul 6, 2020
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at d24b9c1. Thanks a lot for contributing to OCA. ❤️

sebalix pushed a commit to sebalix/wms that referenced this pull request Jul 21, 2020
…t-transfer

[13.0][IMP] shopfloor: location content transfer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants