تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
5058 أدوات العرض

Hi,

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.

الكاتب

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

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

الكاتب

Do you any advice about the situation ? Cheers

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

الكاتب

That did the trick ! Thanks a lot for your help

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يوليو 24
1966
1
يناير 24
5163
2
مارس 23
2761
3
يونيو 20
10566
2
مارس 20
9022