sale-workflow icon indicating copy to clipboard operation
sale-workflow copied to clipboard

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

Open manuelregidor opened this issue 1 year ago • 22 comments

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

manuelregidor avatar Oct 15 '24 06:10 manuelregidor

Isn't this the same as https://github.com/OCA/sale-workflow/tree/16.0/sale_sourced_by_line ?

pedrobaeza avatar Oct 15 '24 06:10 pedrobaeza

@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.

manuelregidor avatar Oct 15 '24 06:10 manuelregidor

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

pedrobaeza avatar Oct 15 '24 06:10 pedrobaeza

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...

HaraldPanten avatar Oct 15 '24 07:10 HaraldPanten

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.

pedrobaeza avatar Oct 15 '24 07:10 pedrobaeza

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!

HaraldPanten avatar Oct 15 '24 07:10 HaraldPanten

@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.

manuelregidor avatar Oct 15 '24 08:10 manuelregidor

OK, thanks for the extra explanations.

pedrobaeza avatar Oct 15 '24 08:10 pedrobaeza

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

rousseldenis avatar Nov 21 '24 08:11 rousseldenis

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

manuelregidor avatar Nov 21 '24 10:11 manuelregidor

@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.

manuelregidor avatar Nov 25 '24 11:11 manuelregidor

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.

pedrobaeza avatar Nov 25 '24 11:11 pedrobaeza

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.

And the solution that introduce a configuration parameter to activate the feature avoid both :-)

rousseldenis avatar Dec 09 '24 13:12 rousseldenis

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.

And the solution that introduce a configuration parameter to activate the feature avoid both :-)

I don't know exactly what you mean by "introduce a configuration parameter". There is already a configuration field in res.company to activate the features introduced by this module. What kind of additional parameter do we need here? Thank you.

manuelregidor avatar Dec 11 '24 06:12 manuelregidor

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.

And the solution that introduce a configuration parameter to activate the feature avoid both :-)

I don't know exactly what you mean by "introduce a configuration parameter". There is already a configuration field in res.company to activate the features introduced by this module. What kind of additional parameter do we need here? Thank you.

@rousseldenis Could you give us more details, please?

HaraldPanten avatar Dec 23 '24 08:12 HaraldPanten

@rousseldenis Could you give some feedback to us? We're not sure about how to continue with that.

THX!

HaraldPanten avatar Jan 13 '25 14:01 HaraldPanten

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

ValentinVinagre avatar Feb 12 '25 12:02 ValentinVinagre

@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.

manuelregidor avatar Feb 17 '25 16:02 manuelregidor

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

manuelregidor avatar Feb 18 '25 11:02 manuelregidor

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

manuelregidor avatar Feb 25 '25 07:02 manuelregidor

@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.

ValentinVinagre avatar Feb 28 '25 10:02 ValentinVinagre

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

manuelregidor avatar May 07 '25 07:05 manuelregidor

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

THX!

HaraldPanten avatar May 26 '25 15:05 HaraldPanten

/ocabot merge nobump

rousseldenis avatar Jun 06 '25 08:06 rousseldenis

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 avatar Jun 06 '25 08:06 OCA-git-bot

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

OCA-git-bot avatar Jun 06 '25 08:06 OCA-git-bot