Skip to content

[16.0][ADD]sale_order_line_multi_warehouse: Split sale order in multiple pickings#3357

Merged
OCA-git-bot merged 1 commit intoOCA:16.0from
sygel-technology:16.0-add-sale_order_line_multi_warehouse
Jun 6, 2025
Merged

[16.0][ADD]sale_order_line_multi_warehouse: Split sale order in multiple pickings#3357
OCA-git-bot merged 1 commit intoOCA:16.0from
sygel-technology:16.0-add-sale_order_line_multi_warehouse

Conversation

@manuelregidor
Copy link
Copy Markdown
Contributor

@manuelregidor manuelregidor commented Oct 15, 2024

Split sale order lines into multiple sub-lines assigned to different warehouses. When a sale order is confirmed, multiple pickings can be created depending on the warehouses selected.

@ValentinVinagre @HaraldPanten @luis-ron

T-6563

@pedrobaeza
Copy link
Copy Markdown
Member

@manuelregidor
Copy link
Copy Markdown
Contributor Author

@pedrobaeza Not exactly. sale_sourced_by_line lets you select a warehouse in a sale order line. Our module lets you split a single sale order line into multiple sublines, each one related to a different warehouse.

@pedrobaeza
Copy link
Copy Markdown
Member

I think there's a shared code on how to do such split when confirming the sales order, so it should be at least an expansion module. cc @rousseldenis

@rousseldenis rousseldenis added this to the 16.0 milestone Oct 15, 2024
@HaraldPanten
Copy link
Copy Markdown
Contributor

I think there's a shared code on how to do such split when confirming the sales order, so it should be at least an expansion module. cc @rousseldenis

Hi Pedro, thanks for your comments.

Could you give us some examples of the shared code that you mention? The modules have different purposes and we don't want to create a "too complex" module, but we are open to improve our work. You know...

@pedrobaeza
Copy link
Copy Markdown
Member

I was just talking from the "feature" perspective, as both should split the pickings (at procurement level). I haven't dug deeper, as I'm not using any of them. If you think there's no overlap, OK then.

@HaraldPanten
Copy link
Copy Markdown
Contributor

I was just talking from the "feature" perspective, as both should split the pickings (at procurement level). I haven't dug deeper, as I'm not using any of them. If you think there's no overlap, OK then.

@manuelregidor @ValentinVinagre Could you deeper analise Pedro's comments and verify that we're not overlaping anything? As we're not using sale_sourced_by_line maybe there's something that we are not taking in consideration.

Denis's comments would be appreciated, as well 😉

THX!

@manuelregidor
Copy link
Copy Markdown
Contributor Author

@pedrobaeza It is kind of similar from a concept perspective. However, in this proposal not only a sale order line can be assigned to a specific warehouse, but they can also be split into separate warehouses. Because of that, it has been necessary to create a new model (sale.order.line.warehouse). Its class instances are related to a sale order line, and a sale order line can have multiple instances of sale.order.line.warehouse, so the logic to separate the sale order into multiple warehouses follows a different and much more complex path, as it shifts from sale.order.line model to sale.order.line.warehouse model.

Basically, in module sale_sourced_by_line the way of groupping lines in multiple procurement groups is done in the sale order line level, so using the methods to apply additional rules (a warehouse assignment in this case) is enough to group the sale order lines into different pickings. In our proposal, we have to achieve the separation from another level.

That is why an expansion module would be possible, yet the methods in sale_sourced_by_line module would be strongly modified as they should be adapted to the sale.order.line.warehouse level. Another issue is that module sale_sourced_by_line depends on sale_procurement_group_by_line, which contains methods also used in this module; again, those inheritances would be pretty much ignored for the same reason.

@pedrobaeza
Copy link
Copy Markdown
Member

OK, thanks for the extra explanations.

Copy link
Copy Markdown
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

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

Functionaly tested and seems to work properly.

However, I would prefer to see an specific widget on the warehouse selection 😉

Copy link
Copy Markdown
Contributor

@ValentinVinagre ValentinVinagre left a comment

Choose a reason for hiding this comment

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

some changes

Comment thread sale_order_line_multi_warehouse/__manifest__.py Outdated
Comment thread sale_order_line_multi_warehouse/__manifest__.py
@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from 5d83672 to 729be7e Compare October 28, 2024 06:52
Copy link
Copy Markdown

@luis-ron luis-ron left a comment

Choose a reason for hiding this comment

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

Functional review: LGTM 👍🏻

Comment thread sale_order_line_multi_warehouse/README.rst
Comment thread sale_order_line_multi_warehouse/models/sale_order.py Outdated
@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from 729be7e to 5154504 Compare November 21, 2024 06:59
Copy link
Copy Markdown
Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

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

I would say this module can be great. i would not say this is much simpler than sale_sourced_by_line...

I haven't tested it functionally yet.

But some refinements in code should be done.

Comment thread sale_order_line_multi_warehouse/models/sale_order.py Outdated
Comment thread sale_order_line_multi_warehouse/models/sale_order_line.py Outdated
Comment thread sale_order_line_multi_warehouse/models/sale_order_line.py Outdated
Comment thread sale_order_line_multi_warehouse/models/sale_order_line.py Outdated
Comment thread sale_order_line_multi_warehouse/models/sale_order_line.py Outdated
Comment thread sale_order_line_multi_warehouse/wizard/so_multi_warehouse_change_wizard.py Outdated
Comment thread sale_order_line_multi_warehouse/wizard/so_multi_warehouse_change_wizard.py Outdated
Comment thread sale_order_line_multi_warehouse/wizard/so_multi_warehouse_change_wizard.py Outdated
@rousseldenis
Copy link
Copy Markdown
Contributor

Using float_compare everywhere a field with decimal precision is used should be done.

@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from 5154504 to ef873e0 Compare November 21, 2024 10:06
@manuelregidor
Copy link
Copy Markdown
Contributor Author

@rousseldenis Thanks for your feedback. I'll have a look as soon as I can.

@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch 2 times, most recently from d0ba73e to f803265 Compare November 22, 2024 13:11
Copy link
Copy Markdown
Contributor

@Tisho99 Tisho99 left a comment

Choose a reason for hiding this comment

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

LGTM

@manuelregidor
Copy link
Copy Markdown
Contributor Author

@rousseldenis @pedrobaeza This module is not compatible with sale_procurement_group_by_line. In the future, we could develope a module to make them compatible. However, we'd like to know what's the best way to proceed in these situations, as we cannot include sale_procurement_group_by_line in the "excludes" list in manifest. Thank you.

@pedrobaeza
Copy link
Copy Markdown
Member

Well, I know by experience that such future may not come. On other modules, I did some checks against config["test_enable"] and detect if there's an injected context to only activate the behavior in other cases, but I know others like Roussel doesn't like this. What I totally dislike is to have more splits in the CI (we already have 2 splits) to test them apart.

@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from f803265 to a15ac53 Compare December 9, 2024 10:51
Copy link
Copy Markdown

@Daniel-Melian Daniel-Melian left a comment

Choose a reason for hiding this comment

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

Functionally reviewed LGTM.

@ValentinVinagre
Copy link
Copy Markdown
Contributor

@rousseldenis Could you give us some advice? We are waiting to finalize this PR based on your comments.
Thanks 😄

@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from a15ac53 to 26dc5d5 Compare February 17, 2025 16:19
@manuelregidor
Copy link
Copy Markdown
Contributor Author

@rousseldenis I've removed the incompatibility with sale_procurement_group_by_line from the manifest and explained in roadmap why both modules should be used together. I don't think there's need to create a system parameter to activate the features provided by this module as there is already a field in company to activate them.

Comment thread sale_order_line_multi_warehouse/models/sale_order.py Outdated
Comment thread sale_order_line_multi_warehouse/models/sale_order.py Outdated
Comment thread sale_order_line_multi_warehouse/models/sale_order_line.py Outdated
Copy link
Copy Markdown
Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

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

Some comments.

Testing the wizard could be great

@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from 26dc5d5 to 417cdc7 Compare February 18, 2025 11:34
@manuelregidor
Copy link
Copy Markdown
Contributor Author

@rousseldenis Changes applied. New test has been added too.

Comment thread sale_order_line_multi_warehouse/wizard/so_multi_warehouse_change_wizard.py Outdated
@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from 417cdc7 to b5c1f4f Compare February 18, 2025 13:03
Comment thread sale_order_line_multi_warehouse/wizard/so_multi_warehouse_change_wizard.py Outdated
@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from b5c1f4f to 6bfab75 Compare February 18, 2025 14:01
@manuelregidor
Copy link
Copy Markdown
Contributor Author

@rousseldenis I applied the changes you suggested and added a new test. Could have a look, please? Thank you.

@ValentinVinagre
Copy link
Copy Markdown
Contributor

@rousseldenis There is currently a very similar case to this module in https://github.com/OCA/sale-workflow/pull/3598/files. The solution has been to change the OCA CI in the repository for the incompatible modules. Don't you think that would be the solution to apply? I mean that it avoids creating parameters in odoo, etc. only by not adapting the CI.
If you agree, we will apply it.

@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from 6bfab75 to 2758c41 Compare March 6, 2025 09:31
@manuelregidor manuelregidor force-pushed the 16.0-add-sale_order_line_multi_warehouse branch from 2758c41 to 2c0e531 Compare May 7, 2025 06:57
@manuelregidor
Copy link
Copy Markdown
Contributor Author

@rousseldenis @Daniel-Melian Tests passed. Could you have a look? Thank you

@HaraldPanten
Copy link
Copy Markdown
Contributor

@rousseldenis you asked for changes some weeks ago. Could you have a look?

THX!

@rousseldenis
Copy link
Copy Markdown
Contributor

/ocabot merge nobump

@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-3357-by-rousseldenis-bump-nobump, awaiting test results.

@OCA-git-bot
Copy link
Copy Markdown
Contributor

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

@OCA-git-bot OCA-git-bot merged commit ade84ed into OCA:16.0 Jun 6, 2025
13 checks passed
@HaraldPanten HaraldPanten deleted the 16.0-add-sale_order_line_multi_warehouse branch June 13, 2025 13:19
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.

10 participants