Commit 87c3e7e
committed
[FIX] util.convert_field_to_translatable
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
❯
```
closes #329
Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>1 parent c985898 commit 87c3e7e
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1081 | 1081 | | |
1082 | 1082 | | |
1083 | 1083 | | |
1084 | | - | |
| 1084 | + | |
1085 | 1085 | | |
1086 | 1086 | | |
1087 | 1087 | | |
| |||
0 commit comments