2d08f97c0778469b409fca23f2be5f5a98ce3df8
Jsonb data structure of model_terms translated fields' columns
'{
"en_US": "<div>Apple</div>"
"fr_FR": "<div>Pomme</div><div>Banane</div>"
"_fr_FR": "<div>Pomme</div>"
}'::jsonb
"column" IS NULL OR "column"->>'en_US' IS NOT NULL
"column"->>'lang'
1. stores last confirmed value
2. logically fallbacks to
COALESCE(
"column"->>'lang',
"column"->>'en_US'
)
"column"->>'_lang'
1. stores translations and the last written html/xml structure
2. shares the same html/xml structure with other "column"->>'_lang'
3. logically fallbacks to
COALESCE(
"column"->>'_lang',
"column"->>'lang',
"column"->>'_en_US',
"column"->>'en_US'
)
Context:
1. `delay_translations`(new) only write values to _langs while keeping
translations for langs when the written value has at least one translatable term
2. `check_translations`(new) read _langs values to create translation mapping
for the translation dialog
3. `edit_translations` read values whose translatable terms are wrapped by
`<span></span>` with term information for the TRANSLATE mode of website
Potential issue
since the record value of a model terms translated field is logical content
dependent (check_translations, edit_translations), all computed field computed
from any model terms translated field should also be marked.
@api.depends_context('lang', 'edit_translations', 'check_translations')
Data flow for column value, cache value and record value
(make sure the window is wide enough to see the graph)
+- - - - - - - - - - - - - - - - - - - - - - - - - - - -+
' Record(str): '
' '
' +---------------------------------------------------+ ' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
' | "<div><span data-oe-model='model' | ' { read fr_FR {
' | data-oe-id='id' ...>French</span></div>" | ' <------------ } context.get('edit_translations') } <+
' +---------------------------------------------------+ ' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ |
' +---------------------------------------------------+ ' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ |
' | "<div>French</div>" | ' { read fr_FR { |
' | | ' <------------ } context.get('check_translations') } <+
' +---------------------------------------------------+ ' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ |
+~~~~~~~~~~~~+ ' +---------------------------------------------------+ ' |
{ read fr_FR { ------------> ' | "<a>French</a>" | ' |
+~~~~~~~~~~~~+ ' +---------------------------------------------------+ ' |
^ ' ' |
| +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+ |
| |
| |
| |
| +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+ |
| ' Cache(dict): ' |
| ' ' |
| ' +---------------------------------------------------+ ' |
| ' | | ' -----------------------------------------------------+
| ' | "_fr_FR": "<div>French</div>" | '
| ' | | ' <----------------------------------------------------+
| ' +---------------------------------------------------+ ' |
| ' +---------------------------------------------------+ ' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
+------------------------- ' | | ' { fetch fr_FR {
' | "fr_FR": "<a>French</a>" | ' } context.get('edit_translations') }
+------------------------> ' | | ' { or context.get('check_translations') {
| ' +---------------------------------------------------+ ' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
+~~~~~~~~~~~~~~~~~+ ' ' ^
{ fetch fr_FR { +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+ COALESCE( |
+~~~~~~~~~~~~~~~~~+ "c"->>'_fr_FR', |
^ "c"->>'fr_FR', |
| COALESCE( "c"->>'_en_US', |
| "c"->>'fr_FR', +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+ "c"->>'en_US' |
| "c"->>'en_US' ' Database(jsonb): ' ) |
| ) ' ' |
| ' +---------------------------------------------------+ ' |
| ' | "_fr_FR": "<div>French</div>" | ' -----------------------------------------------------+
| ' +---------------------------------------------------+ ' |
| ' +---------------------------------------------------+ ' |
+------------------------- ' | "fr_FR": "<a>French</a>" | ' -----------------------------------------------------+
| ' +---------------------------------------------------+ ' |
| ' +---------------------------------------------------+ ' |
| ' | "_en_US": "<div>English</div>" | ' -----------------------------------------------------+
| ' +---------------------------------------------------+ ' |
| ' +---------------------------------------------------+ ' |
+------------------------- ' | "en_US": "<div>English1</div><div>English2</div>" | ' -----------------------------------------------------+
' +---------------------------------------------------+ '
' '
+- - - - - - - - - - - - - - - - - - - - - - - - - - - -+
Task: 3043340
Part-of: odoo/odoo#139819
…
…
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%