Skip to content

Conversation

@thni-odoo
Copy link
Contributor

Currently we are not updating the dependencies for custom compute fields which leads to test crawler failure when it tries to access the view and give: KeyError: 'old_field_name'

Full error

2023-12-11 06:32:37,756 926 ERROR thni_14.0 odoo.addons.base.maintenance.migrations.base.testsodoo.upgrade.base.tests.test_mock_crawl: Adding menu ('account.menu_action_move_out_invoice_type', 126, 'Accounting > Customers > Invoices', 206) to the failing menus 
Traceback (most recent call last):
  File "/tmp/tmpmzpbd93k/migrations/base/tests/test_mock_crawl.py", line 238, in crawl_menu
    self.mock_action(action_vals)
  File "/tmp/tmpmzpbd93k/migrations/base/tests/test_mock_crawl.py", line 394, in mock_action
    mock_method(model, view, fields_list, domain, group_by)
  File "/tmp/tmpmzpbd93k/migrations/base/tests/test_mock_crawl.py", line 423, in mock_view_form
    [data] = record.read(fields_list)
  File "/home/odoo/src/odoo/14.0/odoo/models.py", line 3024, in read
    f = self._fields[dotname.split('.')[0]]
KeyError: 'invoice_payment_state'

@robodoo
Copy link
Contributor

robodoo commented Dec 11, 2023

@thni-odoo thni-odoo force-pushed the master-rename_depends-thni branch from f0db070 to 8312f53 Compare December 11, 2023 07:55
@thni-odoo thni-odoo changed the title [FIX] util/fields : update depends on rename [FIX] util/fields: update depends on rename Dec 11, 2023
@KangOl
Copy link
Contributor

KangOl commented Dec 11, 2023

Don't inject variables into the SQL via .format().
And you can't blindly replace the value into the depends column. It's a comma separated list of dotted path to fields.

@KangOl
Copy link
Contributor

KangOl commented Dec 11, 2023

upgradeci retry with always only crm

@thni-odoo thni-odoo force-pushed the master-rename_depends-thni branch from 8312f53 to 73e4424 Compare December 12, 2023 09:20
@thni-odoo
Copy link
Contributor Author

@KangOl Changes Done!

@KangOl
Copy link
Contributor

KangOl commented Dec 12, 2023

No. As said, you can't just blindly replace the matching part without verifying it apply on the correct model.

Actually, it should be part of the _update_field_usage_multi function, like done with adapt_related. I don't think a dedicated method is needed, but you should use the same technique as adapt_related and use _adapt_one_domain to correctly rename the field names.

@thni-odoo thni-odoo force-pushed the master-rename_depends-thni branch from 73e4424 to 77baefd Compare December 22, 2023 11:57
@thni-odoo
Copy link
Contributor Author

upgradeci retry

@thni-odoo
Copy link
Contributor Author

@KangOl Changes are done as suggested currently i have made a method can you please suggest me where to embed the code.

@thni-odoo
Copy link
Contributor Author

@KangOl Gentle Reminder !

@thni-odoo thni-odoo force-pushed the master-rename_depends-thni branch 4 times, most recently from c8b6b0f to 979179d Compare January 19, 2024 11:56
@thni-odoo
Copy link
Contributor Author

@KangOl Suggested Changes Done!

@thni-odoo
Copy link
Contributor Author

@KangOl Gentle Reminder!

1 similar comment
@thni-odoo
Copy link
Contributor Author

@KangOl Gentle Reminder!

We needs to update custom fields `depends` definition.
@KangOl KangOl force-pushed the master-rename_depends-thni branch from 979179d to 1b48b12 Compare February 12, 2024 12:45
@KangOl
Copy link
Contributor

KangOl commented Feb 12, 2024

@robodoo r+

robodoo pushed a commit that referenced this pull request Feb 12, 2024
We needs to update custom fields `depends` definition.

closes #21

Signed-off-by: Christophe Simonis (chs) <[email protected]>
robodoo pushed a commit that referenced this pull request Feb 12, 2024
We needs to update custom fields `depends` definition.

closes #21

Signed-off-by: Christophe Simonis (chs) <[email protected]>
@robodoo robodoo closed this in c852d63 Feb 12, 2024
@robodoo robodoo added the 17.2 label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants