Skip to content

Conversation

@KangOl
Copy link
Contributor

@KangOl KangOl commented Sep 30, 2025

Make the function idempotent.

It was silently break the translations.

❯ psql -d test-19 -c 'select name from res_country where id=1;'
┌──────────────────────┐
│         name         │
├──────────────────────┤
│ {"en_US": "Andorra"} │
└──────────────────────┘
(1 row)

Time: 1.353 ms

❯ ./odoo-bin shell --upgrade-path ../../upgrade-util/src -d test-19 --log-handler=:CRITICAL
env: <odoo.orm.environments.Environment object at 0x1134feda0>
odoo: <module 'odoo' (<_frozen_importlib_external._NamespaceLoader object at 0x10e171060>)>
openerp: <module 'odoo' (<_frozen_importlib_external._NamespaceLoader object at 0x10e171060>)>
self: res.users(1,)

In [1]: from odoo.upgrade import util

In [2]: util.convert_field_to_translatable(env.cr, "res.country", "name")

In [3]: env.cr.commit()

In [4]:
Do you really want to exit ([y]/n)? ^D

❯ psql -d test-19 -c 'select name from res_country where id=1;'
┌─────────────────────────────────┐
│              name               │
├─────────────────────────────────┤
│ {"en_US": {"en_US": "Andorra"}} │
└─────────────────────────────────┘
(1 row)

Time: 1.360 ms

❯

Make the function idempotent.

It was silently break the translations.

```
❯ psql -d test-19 -c 'select name from res_country where id=1;'
┌──────────────────────┐
│         name         │
├──────────────────────┤
│ {"en_US": "Andorra"} │
└──────────────────────┘
(1 row)

Time: 1.353 ms

❯ ./odoo-bin shell --upgrade-path ../../upgrade-util/src -d test-19 --log-handler=:CRITICAL
env: <odoo.orm.environments.Environment object at 0x1134feda0>
odoo: <module 'odoo' (<_frozen_importlib_external._NamespaceLoader object at 0x10e171060>)>
openerp: <module 'odoo' (<_frozen_importlib_external._NamespaceLoader object at 0x10e171060>)>
self: res.users(1,)

In [1]: from odoo.upgrade import util

In [2]: util.convert_field_to_translatable(env.cr, "res.country", "name")

In [3]: env.cr.commit()

In [4]:
Do you really want to exit ([y]/n)? ^D

❯ psql -d test-19 -c 'select name from res_country where id=1;'
┌─────────────────────────────────┐
│              name               │
├─────────────────────────────────┤
│ {"en_US": {"en_US": "Andorra"}} │
└─────────────────────────────────┘
(1 row)

Time: 1.360 ms

❯
```
@robodoo
Copy link
Contributor

robodoo commented Sep 30, 2025

Pull request status dashboard

@KangOl
Copy link
Contributor Author

KangOl commented Sep 30, 2025

upgradeci retry with always only crm

@KangOl
Copy link
Contributor Author

KangOl commented Sep 30, 2025

@robodoo r+ priority

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