How to import date with xml ?

Asked by Aksana Ivanova

I need to import some data to my module during the installation. i've prepared the xml file:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="1">
        <record id="calendario_2014" model="sncp.comum.calendario">
            <field name="name">2014</field>
            <field name="state">0</field>
        </record>
        <record id="feriado_1" model="sncp.comum.feriados">
            <field name="ano_id" ref="calendario_2014"/>
            <field name="data" eval="2014-01-01"/>
            <field name="name">Ano novo</field>
            <field name="tipo">fix</field>
        </record>
    </data>
</openerp>
the error is: invalid input syntax for type date: "2012"

i change the line to: <field name="data" eval="'2014-01-01'"/>
the error is: int() argument must be a string or a number, not 'NoneType'

i change the line to <field name="data">2014-01-01</field>
TypeError: int() argument must be a string or a number, not 'NoneType'

i change the line to: <field name="data">"2014-01-01"</field>
ValueError: time data '"2014-01-01"' does not match format '%Y-%m-%d'

i change the line to: <field name="data">'2014-01-01'</field>
ValueError: time data "'2014-01-01'" does not match format '%Y-%m-%d'

i tried a lot ov other combinations but cant resolve this problem.
if i delete this row, the rest of the code import fine.

Anybody know how to import fields.date in xml import?
thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Aksana Ivanova
Solved:
Last query:
Last reply:
Revision history for this message
Aksana Ivanova (aksana-ivanova) said :
#1

I solved the problem