Odoo Help


This community 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.


Integrity Error on module installation

Victor Godayer
on 4/14/14, 11:04 AM 1,393 views


I'm trying to install a module with a model that has a many2one field to the model ir.cron.

On installation, the process is stopped due to integrity error. It tells the object concerned is : [object with reference: ir.cron - ir.cron]

But I am trying to install a module, so I don't understand how I could get this error.

Here is my model :

_columns = {
    'name': fields.char('Follow-Up Action', size=64, required=True),
    'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of follow-up lines."),
    'delay': fields.integer('Due Days', help="The number of days after the due date of the invoice to wait before sending the reminder.  Could be negative if you want to send a polite alert beforehand.", required=True),
    'followup_id': fields.many2one('account_followup.followup', 'Follow Ups', required=True, ondelete="cascade"),
    'cron_id': fields.many2one('ir.cron', 'Cron Job', readonly=True, help="Scheduler which runs for automated sending",),

EDIT I have restarted the server with the param -u my_module -d my database The server gave me an error related to the subscription module :

File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20131016_232725-py2.7.egg/openerp/addons/subscription/subscription.py", line 89, in _auto_end
super(subscription_subscription, self)._auto_end(cr, context=context)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20131016_232725-py2.7.egg/openerp/osv/orm.py", line 3232, in _auto_end
cr.execute('ALTER TABLE "%s" ADD FOREIGN KEY ("%s") REFERENCES "%s" ON DELETE %s' % (t, k, r, d))
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20131016_232725-py2.7.egg/openerp/sql_db.py", line 161, in wrapper
return f(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20131016_232725-py2.7.egg/openerp/sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
IntegrityError: insert or update on table "subscription_subscription" violates foreign key constraint "subscription_subscription_cron_id_fkey"

DETAIL: Key (cron_id)=(96) is not present in table "ir_cron".

Should I consider commenting the method _auto_end of this module ?

Thanks for your help

Di you have any "defaults" for that field? Please post your code.

GH Mediacloud, Grover Menacho
on 4/14/14, 11:09 AM

No, I've only readonly=True in my osv model

Victor Godayer
on 4/14/14, 11:11 AM

Okay, but please post your code, community can't help you if doesn't know what you are doing.

GH Mediacloud, Grover Menacho
on 4/14/14, 11:26 AM

Do you any advice about the situation ? Cheers

Victor Godayer
on 4/14/14, 12:10 PM

On PGAdmin or Psql do this 'DELETE FROM subscription_subscription WHERE cron_id=96' maybe something didn't worked properly

GH Mediacloud, Grover Menacho
on 4/14/14, 12:41 PM

That did the trick ! Thanks a lot for your help

Victor Godayer
on 4/14/14, 12:50 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 4/14/14, 11:04 AM
Seen: 1393 times
Last updated: 3/16/15, 8:10 AM