Please to not send me links to .po files or to documentation on how to do it through the interface etc. This is only the question: how to do it through python code in Odoo 16? I would love the following to work, but it does not work in Odoo 16, or it does not work with HTML fields. Whatever I do, all previously translated terms are replaced when I set a new value of translatable field in python code.
en_term = "invoice"
es_term = "factura"
record.with_context(lang="en_US").name = en_term
record.with_context(lang="es_ES").name = es_term
It's weird, I can read a term in a language (name = record.with_context(lang="es_ES").name), replace a letter (e.i. "a" by "o"), write it back, and it will override/remove *all* other translations and replace the term just with the newly modified one!
Is there any way to work around this? Any help appreciated.