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.


how to update portal_wizard_user?

Landis Arnold
on 11/6/13, 1:07 PM 2,387 views

I am getting an error in my server log that "wizard_id" violates "not null constraint" . When I look in more detail i see that this is related to the following bad query:

delete from portal_wizard where id IN (1,2,3,4,5)

Traceback (most recent call last): File"...openerp/server/openerp/sql)db.py", line 226, in execute res = self._obj.execute(query,params) IntegrityError: null value in column "wizard_id" violates not-null constraint CONTEXT: SQL statement "UPDATE ONLY "public"."portal_wizard_user" SET "wizard_id" = NULL WHRE $1 OPERATOR(pg_catalog.=) "wizard id"

Seems to be a Cron Related error, which is also causing OpenERP to possibly think I have too many users. Can I manually delete the few records I have in "portal_wizard_user" data table? How to rectify if not?

Wolfgang Taferner
On 11/23/13, 1:10 PM

This is actually a bug in the core portal module where ondelete='cascade' on the field wizard_id in the transient model portal.wizard.user is missing (one way to resolve) and throws an exception each time autovacuum tries to perform.

Until this is fixed you can actually add it directly in your_core_addons_path/portal/wizard/portal_wizard.py

or you make your own inherited wizard python file in your own module (so you do not have to touch the core) and redefine the related field.

You can find the code beneath (for the inheritance in your own module)...it is easier directly in the core...there you just need to add the ondelete to the field wizard_id (as you see it in the code below)

from osv import fields, orm

class portal_wizard(orm.TransientModel):
    _inherit = "portal.wizard.user"

    _columns = {
        'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True, ondelete='cascade'),

Thank you Wolfgang. Do you see the bug bein repaired sometime. I very much am interested in making my own module, but not ready fo that just yet. I believe that you are saying to add the code you are posting here to the portal_wizard.py file. Will look at the file now and see if I can find the code or insertion point. Very much appreciate your post. This has been irritating me for some time.

Landis Arnold
on 11/24/13, 1:13 PM

Well, I got an error telling me I needed to add a parent class: (I can't seem to paste the full error)... I tried to put the code near the beginning of the file just before similarly called: "from openerp.osv import fields, osv". Maybe I will make a Portal User again.. might fix it.

Landis Arnold
on 11/24/13, 1:31 PM

I have no idea what you have done, but revert it and just try to fix it in the core module by adding the ondelete="cascade" to the field wizard_id. You need to restart the server and upgrade the module portal after changing the code before it may take effect. I updated my answer to be more precise.

TaPo-IT OG, Wolfgang Taferner
on 11/24/13, 2:11 PM

I did revert, then got sidetracked long enough for your comment to come (and then some). Do I do this update in portal_wizard.py or do I need to do so somehow in the postgres database itself? I will assume in portal_wizard.py. I then assume the "upgrade" is in the settings for Module.. I get that part. Will try to report next

Landis Arnold
on 11/24/13, 2:55 PM

In portal.wizard.py I found this line: _columns = { 'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True), (why no Carriage Returns in Comments here?) I will change to something like (??) : _columns = { 'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True,ondelete="cascade) (ondelete fixed, edited for parenthesis, rebooting now)

Landis Arnold
on 11/24/13, 3:36 PM

Working so far. I have a few warnings re openerp.connector (magentoerpconnect) which seem unrelated. No Errors or Tracebacks through the whole reboot and upgrade cycle though. Thank you very much Wolfgang! Will do a full reboot now just to see that I can.

Landis Arnold
on 11/24/13, 3:51 PM

Great, nice to hear that you fixed it in your code and got it working. Please mark the answer as correct in order to help others too.

TaPo-IT OG, Wolfgang Taferner
on 11/25/13, 1:58 AM

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: 11/6/13, 1:07 PM
Seen: 2387 times
Last updated: 5/31/16, 6:36 PM