[19.0][MIG] website_sale_secondary_unit: Migration to 19.0 - #1298
[19.0][MIG] website_sale_secondary_unit: Migration to 19.0#1298CarlosRoca13 wants to merge 44 commits into
Conversation
|
/ocabot migration website_sale_secondary_unit For being testable, I think you should include the temporary reference. |
carlos-lopez-tecnativa
left a comment
There was a problem hiding this comment.
LGTM. I left a comment and hope it can be implemented.
Before V19, the Add to Cart button in the shop was not enabled by default and could be enabled through the Customize options.
But in V19, I noticed that it is enabled by default, and there is no option to hide it.
With this option enabled, when a product has variants, a modal is displayed to select the variant. In this context, no secondary units are displayed. It would be great if we could select the secondary units here as well.
Imagine that in my product, I set Allow to Sell in Unit of Measure to False and use only secondary units. In this case, the first secondary unit is currently selected, but it does not check whether it is published or not. If the first secondary unit is unpublished, I think this is incorrect behavior.
For me, the expected behavior would be to select the first published secondary unit.
| product = self.env["product.product"].browse(product_id) | ||
| if not product.allow_uom_sell: | ||
| secondary_uom = ( | ||
| product.sale_secondary_uom_id or product.secondary_uom_ids[:1] |
There was a problem hiding this comment.
I’m not sure if this should be done in this part of the code or somewhere else, but I think you should filter to only include published records. I noticed that you have the _get_website_secondary_uoms function, which performs this filtering. Could this function be used in all places?
| product.sale_secondary_uom_id or product.secondary_uom_ids[:1] | |
| product.sale_secondary_uom_id or product._get_website_secondary_uoms()[:1] |
| @@ -0,0 +1,3 @@ | |||
| To define the secondary units, you should activate *Units of Measure* in | |||
There was a problem hiding this comment.
| To define the secondary units, you should activate *Units of Measure* in | |
| To define the secondary units, you should activate *Units of Measure & Packagings* in |
| <field name="domain_force">[('website_published', '=', True)]</field> | ||
| <field | ||
| name="groups" | ||
| eval="[(4, ref('base.group_public')), (4, ref('base.group_portal'))]" |
There was a problem hiding this comment.
| eval="[(4, ref('base.group_public')), (4, ref('base.group_portal'))]" | |
| eval="[Command.link(ref('base.group_public')), Command.link(ref('base.group_portal'))]" |
| admin = cls.env.ref("base.user_admin") | ||
| admin.group_ids |= cls.env.ref("uom.group_uom") | ||
| # Force VAT to avoid error in the module that makes it required. | ||
| admin.partner_id.vat = "TEST12345678" |
There was a problem hiding this comment.
I think it would be better to set a valid VAT number to prevent errors similar to #1285
|
Perhaps the simplest solution to what @carlos-lopez-tecnativa mentions, to address something that no one has requested over the course of several versions, is to bring back the option to hide the shopping cart button. |
But I think it should be an extra module |
|
Isn't possible to add the secondary units to that screen that is also included in the main |
|
I'm working on adding it |
|
Please add in the main PR comment on which PR it depends as reference. |
fa75be5 to
a170f80
Compare
carlos-lopez-tecnativa
left a comment
There was a problem hiding this comment.
LGTM.
Just a side note, to avoid going out of scope for the migration, but I think this issue could also be handled in this module because the feature is added by website_sale.
When I finish a sale order with a line that has a secondary unit, then go to My Account and reorder the same order, the quantities are changed. I suspect that, in this flow, the backend uses the default secondary unit or the first secondary unit. However, I would expect it to use the same secondary unit as the original order.
Could you add this to the ROADMAP? Or do you think this behavior could be fixed in this PR?
…ice when product has secondary units defined
…ucts when "Add to cart" view is enabled.
As the product.secondary.unit view has been isolated, we have to inherit from that one.
…play unpublished secondary units. TT31018
complementary to OCA@3fa2331
Before this changes, the change in the value of the secondary unit input field didn't launch the execution of the onchanges of the real input field. Adding this changes, we achieve to capture the event of the new input field to launch the onchanges of the real input field. cc @Tecnativa TT29708
For mobile users adding an extra column in the cart summary makes that the others content won't fit very well, specially for products with long names. As we can infer the sale line information without the secondary units computation computation column we choose to hide it if the screen is too small as Odoo does with the product image column. TT37137
Currently translated at 100.0% (15 of 15 strings) Translation: e-commerce-15.0/e-commerce-15.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-15-0/e-commerce-15-0-website_sale_secondary_unit/es/
Currently translated at 100.0% (15 of 15 strings) Translation: e-commerce-15.0/e-commerce-15.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-15-0/e-commerce-15-0-website_sale_secondary_unit/it/
…antity description and delete column in purchase summary There were two quantity columns in the purchase summary, one with the secondary unit quantity and one with the product quantity. A quantity column in the purchase summary has been removed to give more clarity to the view. When product names or units of measure have a considerable number of characters, having two columns causes a crowding of the view and therefore a feeling of content clutter. Instead, their content has been moved so that both the secondary unit quantity and the quantity of product purchased appear in the same column. We have also added the option to hide the name of the secondary unit of measure in the secondary unit description template in case it matches the unit of measure of the product as depending on where it is being called from it can be redundant. TT45032
Currently translated at 100.0% (15 of 15 strings) Translation: e-commerce-15.0/e-commerce-15.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-15-0/e-commerce-15-0-website_sale_secondary_unit/it/
Currently translated at 100.0% (15 of 15 strings) Translation: e-commerce-15.0/e-commerce-15.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-15-0/e-commerce-15-0-website_sale_secondary_unit/es/
- Switch to setUpClass for avoiding repeat the same setup for each test. - Include context keys for avoiding mail operations overhead.
Currently translated at 100.0% (15 of 15 strings) Translation: e-commerce-15.0/e-commerce-15.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-15-0/e-commerce-15-0-website_sale_secondary_unit/it/
- Replaced the popover implementation with notifications, following the update in odoo/odoo#133990. - Removed the Unit from the displayed price. Previously, Odoo showed the price per unit, making it appropriate to include the UoM. However, as it now displays the total, the UoM is unnecessary.
Currently translated at 100.0% (14 of 14 strings) Translation: e-commerce-17.0/e-commerce-17.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-17-0/e-commerce-17-0-website_sale_secondary_unit/it/
Currently translated at 35.7% (5 of 14 strings) Translation: e-commerce-18.0/e-commerce-18.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_secondary_unit/fr/
Currently translated at 85.7% (12 of 14 strings) Translation: e-commerce-18.0/e-commerce-18.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_secondary_unit/es/
Currently translated at 35.7% (5 of 14 strings) Translation: e-commerce-18.0/e-commerce-18.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_secondary_unit/ca/
Currently translated at 100.0% (14 of 14 strings) Translation: e-commerce-18.0/e-commerce-18.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_secondary_unit/it/
Currently translated at 35.7% (5 of 14 strings) Translation: e-commerce-18.0/e-commerce-18.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_secondary_unit/de/
Currently translated at 100.0% (15 of 15 strings) Translation: e-commerce-18.0/e-commerce-18.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_secondary_unit/it/
Currently translated at 100.0% (15 of 15 strings) Translation: e-commerce-18.0/e-commerce-18.0-website_sale_secondary_unit Translate-URL: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_secondary_unit/es/
…duct configurator
a170f80 to
b3e0cc1
Compare
|
@carlos-lopez-tecnativa solved |
carlos-lopez-tecnativa
left a comment
There was a problem hiding this comment.
LGTM, thanks for the improvements.


cc @Tecnativa TT64166
This PR depends of:
ping @pilarvargas-tecnativa @carlos-lopez-tecnativa