Odoo Help


How fix "Field(s) `date_stop` failed against a constraint: Error!" loading account module with demo data?

Paty L L
on 9/9/14, 2:17 PM 3,183 views

On september 8 I cloned odoo 8 (git clone -b 8.0  https://github.com/odoo/odoo.git)  and ran setup.py install, then configured openerp-server.conf  and some details on dependencies. Now its working almost right.

Problem is when I try to install account module with demo data (I created database with demonstration data) it reports violation on restriction while loading account_demo.xml file.

Field(s) `date_stop` failed against a constraint: Error!
The period is invalid. Either some periods are overlapping or the period's dates are not matching the scope of the fiscal year." while parsing /home/openerp/odoo8169/odoo/addons/account/demo/account_demo.xml:30, near
<record id="period_1" model="account.period">
            <field eval="'01/'+time.strftime('%Y')" name="code"/>
            <field eval="'X 01/'+time.strftime('%Y')" name="name"/>
            <field name="fiscalyear_id" ref="data_fiscalyear"/>
            <field eval="time.strftime('%Y')+'-01-01'" name="date_start"/>
            <field eval="time.strftime('%Y')+'-01-31'" name="date_stop"/>
            <field name="company_id" ref="base.main_company"/>

I can see the first period (opening period 2014 ) overlaps date_stop with date_start on second period (01/2014) as both are 01-01, but this is a normal situation as long as I know.

Have any of you faced this problem? Thanks for your comments.


Now I gave following to problem into account/account.py. I realized the False response was in method _check_year_limit, when testing pids = self.search(cr, uid, [('date_stop','>=',obj_period.date_start),('date_start','',obj_period.id)]) for period in self.browse(cr, uid, pids): if period.fiscalyear_id.company_id.id==obj_period.fiscalyear_id.company_id.id: ... it found similar period. So, looking at the log, I decided comment out the loading of ## 'account_pre_install.yml', file in 'data': [ section of __openerp__.py All this in module account. In summary, I avoided loading of account_pre_install.yml file for account module, start a fresh database and load account module. It loaded everything ok. What I dont know is why fiscal periods are loading twice.

Paty L L
on 9/9/14, 5:39 PM
Andrea Alessandrini
On 2/15/17, 11:04 AM

as said in https://github.com/odoo/odoo/issues/4085
Same error during install a fresh database with demo data using latest odoo source.
In Odoo 9, they just simply delete the periods in demo files. Seems will never fix in Odoo 8.
Found a workaround according to Paty is to comment out the loading of ## 'account_pre_install.yml' in "openerp.py"

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

1 follower(s)


Asked: 9/9/14, 2:17 PM
Seen: 3183 times
Last updated: 2/15/17, 11:04 AM