Search code examples
invoiceodoo-14

Change field label/string


I'm trying to change field label/string on amount_by_group field that is showing total tax amount on Invoice form.

Tried to do it like this - using field attributes

<xpath expr="//field[@name='amount_by_group']" position="attributes">
    <attribute name="string">Porez</attribute>
</xpath>

No luck, also tried to replace field with the same field but with string defined

<xpath expr="//field[@name='amount_by_group']" position="replace">
    <field name="amount_by_group" widget="tax-group-custom-field" nolabel="1" colspan="2" attrs="{'invisible': [('amount_tax', '=', 0)]}" string="Tax"/>
</xpath>

I used methods described here (first two points in answer by Cybrosys) https://www.odoo.com/forum/help-1/change-field-label-through-python-149963

Does anybody have clue how to change that fields name? At the moment field label is "Neoporezivo" and I'd like to show it as "Porez".


Solution

  • What you tried is correct. It seems in your case, you have to update field translation.

    When we load a new language, Odoo translates terms based on .po file given the folder i18n in the related module.

    You can try first from the front end and if it works, you can override .po file.

    Try this:

    • Active developer mode.
    • Go to Settings > Translations > Translated Terms
    • Find your displayed term and edit it with your desired term.
    • Refresh your page and check your form. It should update with the desired term.

    EDIT:

    enter image description here