Odoo Help


XML insert instead of update. Is it a bug???

Dariusz Kubiak
on 7/5/13, 1:20 PM 2,788 views

I want to update company name with a new module installation. I have company_data.xml

<?xml version="1.0" encoding="utf-8"?>
    <data noupdate="0">
      <record model="res.company" id="1">
        <field name="name">New name</field>

But instead of update the name it adds a new company with id=2. If I change the name value again AND id value 1 or 2 in XML then reinstall the module, it changes only the name of company id 2.

Why it doesn't change the name of company with id 1??? IS IT A BUG???


Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 7/6/13, 2:38 AM

Try this:

<record id="base.main_company" model="res.company">
    <field name="name">Your Company Name</field>
    <field name="partner_id" ref="base.main_partner"/>
    <field name="rml_header1">Your Company Tagline</field>
    <field name="currency_id" ref="base.EUR"/>

Woks well! Than you :)

I create a new company named "Second Company”. It has id=3. How do I refere this company? It's not base.main_company. Using id=3 doesn't work - it adds a new record again. <record id="3" model="res.company"> <field name="name">Second Company 3</field> </record>

Macopedia Sp. z o.o, Dariusz Kubiak
on 7/8/13, 6:13 AM

Every record in xml is overwritten by it's ID (In our case it is base.main_company).

Sudhir Arya (ERP Harbor Consulting Services)
on 7/8/13, 7:09 AM

My goal is to make configuration file in a separate module to update all settings at once (eg. in res.company, res.lang for Polish and more). Can I make it putting all settings to one XML? Polish language has id=2 1. When I update the settings like this: <record model="res.lang" id="2"> IntegrityError: null value in column "name" violates not-null constraint because it tryies to add new record, 2. or this: <record model="res.lang" id="base.main_company"> AssertionError: External ID conflict, main_company already refers to a res.company record, you can't define a res.lang record with this

Macopedia Sp. z o.o, Dariusz Kubiak
on 7/8/13, 9:53 AM

The ID is not '1', or '2', or '3'. That is the DATABASE ID. You don't get XML ID's for records you create via the UI. The ID is "base.main_company" for the main company because it was created via CSV or XML import from a module. If you want your companies to have XML ID's you either need to create them from a module or export them once you have entered them via the user interface.

Ray Carnes
on 10/23/15, 4:02 PM

Grover Menacho

--Grover Menacho--
WebVision Enterprise Systems
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Odoo Developer

Grover Menacho
On 7/5/13, 1:53 PM

That id="1" doesn't mean that you are going to update that name to the id="1", it's saying that your xml view's name is "1". I'm not sure about this but you can try writing.

<record model="res.company" id="custom_module_company_name">
    <field name="id">1</field>
    <field name="name">New name</field>

Maybe that could work.

Thx for answer! Still add a new company...

Macopedia Sp. z o.o, Dariusz Kubiak
on 7/8/13, 5:34 AM

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.


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

0 follower(s)


Asked: 7/5/13, 1:20 PM
Seen: 2788 times
Last updated: 3/16/15, 8:10 AM