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_order_line_input: Migration to version 17.0 #3232

Merged
merged 18 commits into from
Sep 25, 2024

Conversation

juanjosesegui-tecnativa

@Tecnativa TT50121

@OCA-git-bot
Copy link
Contributor

Hi @smaciaosi, @dreispt, @ckolobow,
some modules you are maintaining are being modified, check this out!

@pedrobaeza
Copy link
Member

Please check CI. Remember to pass pre-commit always before submitting. It can be trigger automatically if you do pre-commit install -f in the repository.

@pedrobaeza
Copy link
Member

/ocabot migration sale_order_line_input

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Jul 12, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Jul 12, 2024
89 tasks
@juanjosesegui-tecnativa juanjosesegui-tecnativa force-pushed the 17.0-mig-sale_order_line_input branch from 47f5a37 to 0753f33 Compare July 15, 2024 06:38
@pedrobaeza
Copy link
Member

@sbidoul I see the problem comes from this commit that entered the other day:

OCA/OCB@85b2ede

The DB should have pg_trgm extension installed.

@juanjosesegui-tecnativa juanjosesegui-tecnativa force-pushed the 17.0-mig-sale_order_line_input branch 3 times, most recently from edcb089 to a65b589 Compare July 16, 2024 08:00
@dreispt
Copy link
Member

dreispt commented Jul 16, 2024

@sbidoul @pedrobaeza It seems it has been fixed in the meanwhile: odoo/odoo#173101
I'm shocked at how lightly an additional system dependency was introduced, that would break most Odoo installations out there...

@pedrobaeza
Copy link
Member

Yes, it has been tracked in OCA/oca-ci#74, but they have found and solved soon the problem. It was not their intention to have the extra dependency when optimizing it. Anyway, it's very interesting to have the extension on production databases to benefit from these optimizations.

Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

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

Also rebase to fix the CI

groups="product.group_stock_packaging"
optional="show"
/>
<field
name="product_packaging_id"
attrs="{'invisible': [('product_id', '=', False)]}"
column_invisible="product_id == False"
Copy link
Member

Choose a reason for hiding this comment

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

It's probably valid in the views, but better state it as:

Suggested change
column_invisible="product_id == False"
column_invisible="not product_id"

'required': [('display_type', '=', False)],
}"
readonly="product_uom_readonly"
required="display_type == False"
Copy link
Member

Choose a reason for hiding this comment

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

same here. we want to coherce any falsey value not just False:

                    required="not display_type"

Comment on lines 81 to 82
readonly="product_updatable == False"
required="display_type == False"
Copy link
Member

Choose a reason for hiding this comment

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

                    readonly="not product_updatable"
                    required="not display_type"

Comment on lines 59 to 60
readonly="product_updatable == False"
required="display_type == False"
Copy link
Member

Choose a reason for hiding this comment

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

                    readonly="not product_updatable"
                    required="not display_type"

@@ -47,18 +48,16 @@
context="{'res_partner_search_mode': 'customer', 'default_is_company': True, 'default_customer_rank': 1}"
options='{"always_reload": True}'
required="1"
attrs="{'readonly': [('order_partner_id', '!=', False), ('order_id', '!=', False)]}"
readonly="'order_id', 'order_partner_id'"
Copy link
Member

Choose a reason for hiding this comment

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

You have to do a python statement equivalent to the former attr readonly domain.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like pre-commit brought changes to another module in the repo. It would be prefereble to have them in another commit at least (or even in another repo!)

@juanjosesegui-tecnativa juanjosesegui-tecnativa force-pushed the 17.0-mig-sale_order_line_input branch 3 times, most recently from 0a2272f to 3c14d1e Compare July 25, 2024 15:13
@pedrobaeza
Copy link
Member

What is missing here?

@juanjosesegui-tecnativa juanjosesegui-tecnativa force-pushed the 17.0-mig-sale_order_line_input branch from 3c14d1e to bb663fa Compare July 25, 2024 17:11
@juanjosesegui-tecnativa
Copy link
Author

What is missing here?

codecov/patch was returning an error for the _onchange_order_partner_id function because it was not fully covered by the test. I have modified it, and it is now correct.

@juanjosesegui-tecnativa juanjosesegui-tecnativa force-pushed the 17.0-mig-sale_order_line_input branch from bb663fa to b8d138c Compare July 30, 2024 10:45
Copy link

@sanderlienaerts sanderlienaerts left a comment

Choose a reason for hiding this comment

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

An error occurred during functional tests.

  1. Open the Sales Order Lines list view
  2. Create a new sale order line
  3. Select a product first

After selecting the product, the error below occurs. Seems related to product_supplierinfo_for_customer_sale. Can you confirm? Disabling the module does not fix the issue.

Traceback (most recent call last):
  File "/opt/odoo/odoo/models.py", line 5856, in ensure_one
    _id, = self._ids
ValueError: not enough values to unpack (expected 1, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 1764, 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 1791, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo/http.py", line 1995, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 222, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo/http.py", line 741, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 24, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 20, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 468, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/addons/web/models/models.py", line 1073, in onchange
    todo = [
  File "/opt/odoo/addons/web/models/models.py", line 1076, in <listcomp>
    if field_name not in done and snapshot0.has_changed(field_name)
  File "/opt/odoo/addons/web/models/models.py", line 1189, in has_changed
    return self[field_name] != self.record[field_name]
  File "/opt/odoo/odoo/models.py", line 6638, in __getitem__
    return self._fields[key].__get__(self, self.env.registry[self._name])
  File "/opt/odoo/odoo/fields.py", line 1152, in __get__
    self.recompute(record)
  File "/opt/odoo/odoo/fields.py", line 1367, in recompute
    apply_except_missing(self.compute_value, recs)
  File "/opt/odoo/odoo/fields.py", line 1340, in apply_except_missing
    func(records)
  File "/opt/odoo/odoo/fields.py", line 1389, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo/models.py", line 4882, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo/fields.py", line 102, in determine
    return needle(*args)
  File "/opt/odoo/addons/sale_management/models/sale_order_line.py", line 16, in _compute_name
    super()._compute_name()
  File "/mnt/data/odoo-addons-dir/product_supplierinfo_for_customer_sale/models/sale_order_line.py", line 42, in _compute_name
    super(SaleOrderLine, item)._compute_name()
  File "/opt/odoo/addons/sale/models/sale_order_line.py", line 319, in _compute_name
    lang = line.order_id._get_lang()
  File "/opt/odoo/addons/sale/models/sale_order.py", line 1948, in _get_lang
    self.ensure_one()
  File "/opt/odoo/odoo/models.py", line 5859, in ensure_one
    raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: sale.order()

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPCError@http://oca-sale-workflow-17-0-pr3232-b8d138ccacb4.runboat.odoo-community.org/web/assets/302b793/web.assets_web.min.js:2883:324
    makeErrorFromResponse@http://oca-sale-workflow-17-0-pr3232-b8d138ccacb4.runboat.odoo-community.org/web/assets/302b793/web.assets_web.min.js:2886:175
    @http://oca-sale-workflow-17-0-pr3232-b8d138ccacb4.runboat.odoo-community.org/web/assets/302b793/web.assets_web.min.js:2890:34

@pedrobaeza
Copy link
Member

@sanderlienaerts the problem seems to be with module product_supplierinfo_for_customer_sale. Uninstall it for your tests.

Copy link
Contributor

@carlos-lopez-tecnativa carlos-lopez-tecnativa left a comment

Choose a reason for hiding this comment

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

@juanjosesegui-tecnativa as a suggestion, you could use this module to facilitate the migration of attrs to Python expressions

/>
<field
name="product_packaging_qty"
invisible="'|', not product_id, not product_packaging_id"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check this expression is wrong, convert to python expression

Suggested change
invisible="'|', not product_id, not product_packaging_id"
invisible="not product_id or not product_packaging_id"

context="{'res_partner_search_mode': 'customer', 'default_is_company': True, 'default_customer_rank': 1}"
options='{"always_reload": True}'
required="1"
readonly="('order_partner_id', '!=', False), ('order_id', '!=', False)"
Copy link
Contributor

Choose a reason for hiding this comment

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

check expression

decoration-bf="(not display_type and invoice_status == 'to invoice')"
string="Delivered"
invisible="state != 'sale'"
readonly="'qty_delivered_method' != 'manual'"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it must be evaluated as an expression instead of a string.

Suggested change
readonly="'qty_delivered_method' != 'manual'"
readonly="qty_delivered_method != 'manual'"

<field
name="price_total"
widget="monetary"
invisible="(is_downpayment),('tax_calculation_rounding_method', '=' ,'round_globally')"
Copy link
Contributor

Choose a reason for hiding this comment

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

and here

@dreispt
Copy link
Member

dreispt commented Aug 27, 2024

@juanjosesegui-tecnativa as a suggestion, you could use this module to facilitate the migration of attrs to Python expressions

That work has potential to be converted into a great contribution to https://github.com/OCA/odoo-module-migrator
cc @legalsylvain

@juanjosesegui-tecnativa juanjosesegui-tecnativa force-pushed the 17.0-mig-sale_order_line_input branch 2 times, most recently from 5bbdbdb to 882a124 Compare August 28, 2024 15:24
carlosdauden and others added 3 commits September 25, 2024 12:57
[UPD] README.rst

[UPD] Update sale_order_line_input.pot
[UPD] Update sale_order_line_input.pot

[UPD] README.rst

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-12.0/sale-workflow-12.0-sale_order_line_input
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_order_line_input/
Rad0van and others added 12 commits September 25, 2024 12:57
[UPD] Update sale_order_line_input.pot

[UPD] README.rst
to solve a pypi upload issue
Since v13 the customer field on res.partner model has been disappeared,
so when we try to add a value on the field order_partner_id we get an
error.

sale_order_line_input 13.0.1.1.0
[MIG] sale_order_line_input: Migration to 14.0
[UPD] Update sale_order_line_input.pot

[UPD] README.rst

[IMP] update dotfiles [ci skip]

[UPD] README.rst

[UPD] README.rst
Currently translated at 100.0% (22 of 22 strings)

Translation: sale-workflow-16.0/sale-workflow-16.0-sale_order_line_input
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_order_line_input/it/
decoration-info="invoice_status =='to invoice'"
decoration-warning="state =='draft'"
decoration-muted="state =='cancel'"
decoration-success="order_locked == True"
Copy link
Member

Choose a reason for hiding this comment

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

I'd simply change this to decoration-success="invoice_status =='invoiced'" and get rid of the order_locked stuff

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, because the locked field of sale.order is a flag that is controlled by the setting of blocking confirmed sales orders, so it is not valid to use it as a flag. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

I have added the changes and also reverted the pre-commit changes in another module.

@pilarvargas-tecnativa pilarvargas-tecnativa force-pushed the 17.0-mig-sale_order_line_input branch from 882a124 to 3f99e05 Compare September 25, 2024 15:00
@pilarvargas-tecnativa
Copy link
Contributor

An error occurred during functional tests.

  1. Open the Sales Order Lines list view
  2. Create a new sale order line
  3. Select a product first

After selecting the product, the error below occurs. Seems related to product_supplierinfo_for_customer_sale. Can you confirm? Disabling the module does not fix the issue.

You can try again, it should be solved. Thanks

@pilarvargas-tecnativa
Copy link
Contributor

@carlos-lopez-tecnativa Can you check again? Thanks

Copy link
Member

Choose a reason for hiding this comment

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

Some changes from other module slipped into your PR

Copy link
Contributor

Choose a reason for hiding this comment

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

removed

@pilarvargas-tecnativa pilarvargas-tecnativa force-pushed the 17.0-mig-sale_order_line_input branch from 3f99e05 to 38f6cd2 Compare September 25, 2024 15:53
Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

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

Test and code 👍

Copy link
Contributor

@carlos-lopez-tecnativa carlos-lopez-tecnativa left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 17.0-ocabot-merge-pr-3232-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 6c52379 into OCA:17.0 Sep 25, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

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

@pedrobaeza pedrobaeza deleted the 17.0-mig-sale_order_line_input branch September 25, 2024 17:58
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.