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] website_sale_secondary_unit: Migration to version 17.0 #1003

Merged
merged 32 commits into from
Jan 14, 2025

Conversation

carlos-lopez-tecnativa
Copy link
Contributor

TT52395

@Tecnativa @pedrobaeza @sergio-teruel @pilarvargas-tecnativa @chienandalu @CarlosRoca13 could you please review this

sergio-teruel and others added 30 commits January 9, 2025 08:06
As the product.secondary.unit view has been isolated, we have to
inherit from that one.
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 53.3% (8 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/
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/
@carlos-lopez-tecnativa carlos-lopez-tecnativa force-pushed the 17.0-mig-website_sale_secondary_unit branch 2 times, most recently from a7b529a to a306615 Compare January 10, 2025 16:17
Copy link
Contributor

@CarlosRoca13 CarlosRoca13 left a comment

Choose a reason for hiding this comment

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

Thanks for the work 😄

When trying to remove a line of the cart with secondary units I'm getting next error, can you take a look?

Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 1783, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/opt/odoo/odoo/http.py", line 1810, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo/http.py", line 2014, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/addons/website/models/ir_http.py", line 235, in _dispatch
    response = super()._dispatch(endpoint)
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 221, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo/http.py", line 757, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/mnt/data/odoo-addons-dir/website_sale_secondary_unit/controllers/main.py", line 34, in cart_update_json
    return super().cart_update_json(
  File "/opt/odoo/odoo/http.py", line 757, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/addons/website_sale/controllers/main.py", line 899, in cart_update_json
    values['notification_info'] = self._get_cart_notification_information(order, [values['line_id']])
  File "/mnt/data/odoo-addons-dir/website_sale_secondary_unit/controllers/main.py", line 52, in _get_cart_notification_information
    for line in res["lines"]:
KeyError: 'lines'

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (http://oca-e-commerce-17-0-pr1003-a3066151f1fd.runboat.odoo-community.org/web/assets/1/4e5c03a/web.assets_frontend_lazy.min.js:4720:163)
        at XMLHttpRequest.<anonymous> (http://oca-e-commerce-17-0-pr1003-a3066151f1fd.runboat.odoo-community.org/web/assets/1/4e5c03a/web.assets_frontend_lazy.min.js:4724:13)

@carlos-lopez-tecnativa carlos-lopez-tecnativa force-pushed the 17.0-mig-website_sale_secondary_unit branch from a306615 to e78f349 Compare January 10, 2025 16:33
@carlos-lopez-tecnativa
Copy link
Contributor Author

Thanks for the work 😄

When trying to remove a line of the cart with secondary units I'm getting next error, can you take a look?

Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 1783, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/opt/odoo/odoo/http.py", line 1810, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo/http.py", line 2014, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/addons/website/models/ir_http.py", line 235, in _dispatch
    response = super()._dispatch(endpoint)
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 221, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo/http.py", line 757, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/mnt/data/odoo-addons-dir/website_sale_secondary_unit/controllers/main.py", line 34, in cart_update_json
    return super().cart_update_json(
  File "/opt/odoo/odoo/http.py", line 757, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/addons/website_sale/controllers/main.py", line 899, in cart_update_json
    values['notification_info'] = self._get_cart_notification_information(order, [values['line_id']])
  File "/mnt/data/odoo-addons-dir/website_sale_secondary_unit/controllers/main.py", line 52, in _get_cart_notification_information
    for line in res["lines"]:
KeyError: 'lines'

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (http://oca-e-commerce-17-0-pr1003-a3066151f1fd.runboat.odoo-community.org/web/assets/1/4e5c03a/web.assets_frontend_lazy.min.js:4720:163)
        at XMLHttpRequest.<anonymous> (http://oca-e-commerce-17-0-pr1003-a3066151f1fd.runboat.odoo-community.org/web/assets/1/4e5c03a/web.assets_frontend_lazy.min.js:4724:13)

Solved, please try again

Copy link
Contributor

@CarlosRoca13 CarlosRoca13 left a comment

Choose a reason for hiding this comment

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

Thanks! 😄

@carlos-lopez-tecnativa carlos-lopez-tecnativa force-pushed the 17.0-mig-website_sale_secondary_unit branch from e78f349 to c905ee2 Compare January 13, 2025 16:04
@carlos-lopez-tecnativa
Copy link
Contributor Author

@pilarvargas-tecnativa I have applied your suggestion. Could you please update your review? Thanks!

- 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.
@carlos-lopez-tecnativa carlos-lopez-tecnativa force-pushed the 17.0-mig-website_sale_secondary_unit branch from c905ee2 to 09b889c Compare January 13, 2025 17:25
@pedrobaeza
Copy link
Member

/ocabot migration website_sale_secondary_unit
/ocabot merge nobump

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Jan 14, 2025
@OCA-git-bot
Copy link
Contributor

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

@OCA-git-bot OCA-git-bot mentioned this pull request Jan 14, 2025
28 tasks
@OCA-git-bot OCA-git-bot merged commit e998390 into OCA:17.0 Jan 14, 2025
7 checks passed
@OCA-git-bot
Copy link
Contributor

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

@pedrobaeza pedrobaeza deleted the 17.0-mig-website_sale_secondary_unit branch January 14, 2025 07:31
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.