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

[17.0] [MIG] sale_packaging_default: Migration to 17.0 #3334

Open
wants to merge 25 commits into
base: 17.0
Choose a base branch
from

Conversation

bizzappdev
Copy link
Contributor

No description provided.

yajo and others added 25 commits September 28, 2024 18:42
This module simplifies and emphasizes the usage of packaging in sales orders.

- Packaging fields in sale order lines appear before product quantity fields.
- When selecting a product to sell, its default packaging is added automatically.

Why is this module useful? Packaging usage in Odoo is designed to be computed
automatically when you choose the final amount of products to sell. Although
you can still do that, with this module the natural usage is inverted: it's
easier for you to select the packaging and quantity first, and then the final
amount of products is computed automatically.

@moduon MT-3695
Currently translated at 100.0% (4 of 4 strings)

Translation: sale-workflow-16.0/sale-workflow-16.0-sale_packaging_default
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_packaging_default/es/
When creating SO from mobile view or from "Commercial Quotations" menu installed by `sale_order_product_picker`, the pop-up form view that appears when clicking on the line kanban kard didn't have the fields in the correct order.

@moduon MT-3930
…ckaging

Before this patch, we had this problem:

1. Add new SO line.
2. Set a packaging and a packaging qty. The UoM qty is computed. Good.
3. Set UoM qty to zero. Packaging and packaging qty remain with previous value. Bad.

When user sets UoM to zero, Odoo should remove any packaging information.

Notice that, when adding a new line, that qty will be zero at the beginning, but we will want to still get the defaults. Thus, this change is only applied when the user *is* actually setting that value, and not on any other circumstance. I needed to override the `onchange()` method to propagate that information.

@moduon MT-3930
…ker`

Make sure that, when adding a new line that inherits the product by a `default_product_id` context, there is no warning about wrong amount of products.

@moduon MT-4369
Currently translated at 100.0% (4 of 4 strings)

Translation: sale-workflow-16.0/sale-workflow-16.0-sale_packaging_default
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_packaging_default/it/
It turns out that, since product packagings can be sorted, and can already be set as `sales=True`, we can safely consider that the 1st packaging with that field on is the default one for sales.

We loose the ability to set one product with sales packagings to not have a default one, but we win in the sense that we don't diverge from Odoo CE DB model.

That advantage means that the "packaging_default" family of modules are now just a plug-in that will emphasize the usage of packagings in the sale process, but other modules that use the same data model can reason similarly without depending directly on these ones.

@moduon MT-4396
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-16.0/sale-workflow-16.0-sale_packaging_default
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_packaging_default/
Add _get_default_packaging. Allows replicating the same logic when needed.
Currently translated at 100.0% (2 of 2 strings)

Translation: sale-workflow-16.0/sale-workflow-16.0-sale_packaging_default
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_packaging_default/es/
When changing the line product, before this patch we had upstream Odoo behavior unchanged: keep the uom qty and recompute the packaging qty accordingly.

This gave a poor UX because, when using this addon, you expect packaging qty to have priority over uom qty. Thus, if you changed from selling 2 packagings of one product packaged by default in 6-packs (thus 12 units) to another product with a default sales packaging of 3-packs, you expect to be still selling 2 packagings (thus 6 units).

@moduon MT-5444
@bizzappdev bizzappdev force-pushed the 17.0-mig-sale_packaging_default-BAD-RUS branch from af59c18 to 4a0292a Compare September 28, 2024 13:24
@bizzappdev bizzappdev marked this pull request as ready for review September 29, 2024 15:08
@yvaucher
Copy link
Member

/ocabot migration sale_packaging_default

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Sep 30, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Sep 30, 2024
83 tasks
Copy link
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.

LGTM

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.

9 participants