Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
506 Lượt xem

You changed a x_name field value in Odoo Studio and it looks fine in the interface...

But when you call the API, you still get the original value set at creation?

The likely cause: the field option is marked as "Translatable".

When a field is translatable, you are only modifying the translated version for your current UI language, not the actual value stored in the database.

So what happens:

  • The interface displays: "Product A"
  • But the API still returns: "Prod-" (the original value in the default language)

How to fix it:

Go to the field properties in Studio and uncheck "Translatable".

Your field will now behave correctly and show the updated value consistently across the UI and API.

Important: you'll need to manually update existing records to correct the value stored in the original (untranslated) field.

---------

Le champ x_name ne se met pas à jour dans l’API versus l'affichage Odoo ?Voici pourquoi.


Vous avez modifié la valeur d’un champ x_name dans Odoo Studio et tout semble correct dans l’interface…

Mais en appelant l’API, vous récupérez toujours la première valeur saisie lors de la création de l’enregistrement ?

La cause probable : l’option “Traduisible” est activée sur ce champ.

Lorsqu’un champ est traduisible, vous ne modifiez que la version traduite dans la langue de l’interface, pas la valeur réelle stockée dans la base de données.

Résultat :

  • L’interface affiche : "Produit A"
  • Mais l’API renvoie toujours : "Prod-" (la valeur d’origine non traduite)

Solution :

Dans Studio, accédez aux propriétés du champ et décochez “Traduisible”.

La valeur sera alors cohérente dans l’interface et dans l’API.

Attention : il faudra corriger manuellement les enregistrements existants, car la vraie valeur de x_name reste inchangée jusqu’à modification explicite.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Quick recap of the issue and fix:

  • What’s happening:
    When a field is marked Translatable, the value you change via the UI only affects the current user’s language translation.
    The original (default) value in the database remains unchanged, so API calls (which usually fetch the default language) return the old/original value.
  • How to fix:
    1. In Odoo Studio, edit the field properties and uncheck “Translatable”.
    2. After that, the field will have a single value stored and shown everywhere (UI + API).
    3. For existing records, you might need a script to update the default language value manually, because it remains outdated.
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 25
851
1
thg 3 23
4362
Editing Fields Đã xử lý
2
thg 11 20
3183
Editing Fields Đã xử lý
2
thg 11 20
7804
0
thg 6 15
6067