Odoo Help

1

How to update language settings using xml?

By
Dariusz Kubiak
on 7/2/13, 5:29 AM 2,148 views

I want to update some configuration setting using XML while installing a module, but instead of update it tries to insert a new record.

How to update a record in OpenERP using XML?

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="0">
        <record id="2" model="res.lang">
            <field name="grouping">[3,0]</field>
            <field name="decimal_point">,</field>
            <field name="thousands_sep">.</field>
        </record>
    </data>
</openerp>

I add the file to __openerp__.py in the module

...
    'data': [
        'data/my_config.xml',
    ],
...
2
Sandy Carter
On 12/17/13, 2:03 PM

You have to create a link to the polish language in ir.model.data before you can access it.

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="1">

       <!-- Create link to the language with name "lang_pl" in ir.model.data -->
       <record id="mymodule_lang_pl" model="ir.model.data">
            <field name="name">lang_pl</field>
            <field name="noupdate">TRUE</field>
            <field name="module">mymodule</field>
            <field name="model">res.lang</field>
            <field name="res_id" model="res.lang" search="[('code', '=', 'pl_PL')]"/>
       </record>

        <!-- Access link by name "lang_pl" -->
        <record id="lang_pl" model="res.lang">
            <field name="grouping">[3,0]</field>
            <field name="decimal_point">,</field>
            <field name="thousands_sep">.</field>
        </record>

    </data>
</openerp>

Make sure that at time of module install, the language exists in res.lang

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/2/13, 5:29 AM
Seen: 2148 times
Last updated: 4/29/15, 4:55 AM