Questionairres

Bug #563729 reported by FlxStuJha
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
JMA(Open ERP)

Bug Description

Hey Guys!

I've been working with Questionairres in CRM, and I've been receiving the following bug when trying to use a questionairre with a partner;

An unknown error has been reported.

You do not have a valid Open ERP maintenance contract !

If you are using Open ERP in production, it is highly suggested to subscribe
a maintenance program.

The Open ERP maintenance contract provides you a bugfix guarantee and an
automatic migration system so that we can fix your problems within a few
hours. If you had a maintenance contract, this error would have been sent
to the quality team of the Open ERP editor.

The maintenance program offers you:
* Automatic migrations on new versions,
* A bugfix guarantee,
* Monthly announces of potential bugs and their fixes,
* Security alerts by email and automatic migration,
* Access to the customer portal.

You can use the link bellow for more information. The detail of the error
is displayed on the second tab.

----

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 244, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 639, in execute
    return self._execute(db, uid, wiz_id, datas, action, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 619, in _execute
    return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/wizard/__init__.py", line 178, in execute
    res = self.execute_cr(cr, uid, data, state, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/wizard/__init__.py", line 168, in execute_cr
    next_state = result_def['next_state'](self, cr, uid, data, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/crm_telemarketing.zip/crm_telemarketing/wizard/direct_poll.py", line 83, in check
    partner_obj.write(cr, uid, [partner_id],{'answers_ids':[[6,0,temp]]}, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/crm_profiling/crm_profiling.py", line 191, in write
    return super(partner, self).write(cr, uid, ids, vals, context=context)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/orm.py", line 2479, in write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/fields.py", line 552, in set
    cr.execute('insert into '+self._rel+' ('+self._id1+','+self._id2+') values (%s, %s)', (id, act_nbr))
  File "/usr/lib/python2.5/site-packages/openerp-server/sql_db.py", line 76, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/openerp-server/sql_db.py", line 120, in execute
    res = self._obj.execute(query, params)
IntegrityError: null value in column "answer" violates not-null constraint

The problem here is that the errors are not consistent, sometimes it'll display an error, and sometimes it'll follow-up the questionairre to the next step, only to result in giving an error on the next answer.
Does anybody knows what I've been doing wrong, or what went wrong? Seems like a bug to me, because of the randomness of the error.

I'd like to see a solution to this problem

Thanks in Advance,
Jeff H

affects: account-banking → openobject-addons
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Jeff,

Would you please explain me the steps you followed?

Thanks.

Changed in openobject-addons:
assignee: nobody → JMA(Open ERP) (jma-openerp)
importance: Undecided → Low
Revision history for this message
FlxStuJha (jeffrey-hagendijk) wrote :

1. We create a first question within the questionnaire.
2. Next we create an answer to this question and link it to a next question.
3. This way we create a path which you will go through answering all of the questions.
4. Regarding on the answered questions, the partners will be placed in different categories.

Excuse us for taking a while to answer, we've been working on CRM & SRM and are about ready to go live (This is the last step we want to see done).

Revision history for this message
FlxStuJha (jeffrey-hagendijk) wrote :

Anybody?

Changed in openobject-addons:
status: New → Confirmed
Changed in openobject-addons:
milestone: none → 5.0.11
Revision history for this message
JMA(Open ERP) (jma-openerp) wrote :

Hello Jeff,

It has been fixed in stable_extra_addons by revision:
4340 <email address hidden>

It has been fixed in trunk_extra_addons by revision:
4557 <email address hidden>

Thank you.

Changed in openobject-addons:
status: Confirmed → Fix Released
Revision history for this message
FlxStuJha (jeffrey-hagendijk) wrote :

I wanted to apply the changes, but I can't find the given rev.
The bug I reported applies to CRM_Profiling, and not to account banking.

Basically I am still where I started at.

Revision history for this message
FlxStuJha (jeffrey-hagendijk) wrote :

Never mind my last post, I think I fixed it.

Revision history for this message
Erik (erik-koolen) wrote :

We found part of the solution: Instead of this:
----------------------------------------------------------------------------------------------------
 def next(self, cr , uid, data, context):

        answer = data['form']['answer']
        answer_obj = pooler.get_pool(cr.dbname).get('crm_profiling.answer')
        next_id = answer_obj.read(cr, uid, answer, ['next'], context)
        if not next_id:
            raise wizard.except_wizard(_('Error'), _('An error unknown'))

        x_form, x_fields = self.build_form(cr, uid, next_id['next'], context)
        _POLL_FORM.__init__(x_form)
        _POLL_FIELDS.__init__(x_fields)
        return {'answer':None}

We need the following:
----------------------------------------------------------------------------------------------------

 def next(self, cr , uid, data, context):

        answer = data['form']['answer']
        answer_obj = pooler.get_pool(cr.dbname).get('crm_profiling.answer')
        next_id = answer_obj.read(cr, uid, answer, ['next'], context)
        if not next_id:
            raise wizard.except_wizard(_('Error'), _('An error unknown'))

        x_form, x_fields = self.build_form(cr, uid, next_id['next'], context)
        _POLL_FORM.__init__(x_form)
        _POLL_FIELDS.__init__(x_fields)
        return {}

Revision history for this message
Erik (erik-koolen) wrote :

HI guys,

We also found a solution so you can enter the questionnaires you create from both the partner view and the case view.

This and the above change both need to be made in crm_telemarketing/wizard/direct_poll.py.

Instead of this:
-----------------------------------------------------------------------------
-----------------------
# Store the result on partner
        temp = []
        temp.append(answer)
        crm_obj = pooler.get_pool(cr.dbname).get('crm.case')
        partner = crm_obj.read(cr, uid, data['id'], ['partner_id'], context)

        if partner['partner_id']:
            partner_id = partner['partner_id'][0]
            query = "select answer from partner_question_rel where partner=%s"
            cr.execute(query, (partner_id,))
            for x in cr.fetchall():
                temp.append(x[0])

            partner_obj = pooler.get_pool(cr.dbname).get('res.partner')
            partner_obj.write(cr, uid, [partner_id],{'answers_ids':[[6,0,temp]]}, context)

We need the following:
-----------------------------------------------------------------------------
-----------------------
# Store the result on partner

        temp = []
        temp.append(answer)

        if data['model']=='res.partner' : #if in partner view
            crm_obj = pooler.get_pool(cr.dbname).get('res.partner')
            partner = crm_obj.read(cr, uid, data['id'], ['id'], context)
            p_id = partner['id']
        elif data['model']=='crm.case' : # if in case view
            crm_obj = pooler.get_pool(cr.dbname).get('crm.case')
            partner = crm_obj.read(cr, uid, data['id'], ['partner_id'], context)
            p_id = partner['partner_id']

        if p_id:
            partner_id = p_id
            query = "select answer from partner_question_rel where partner=%s"
            cr.execute(query, (partner_id,))
            for x in cr.fetchall():
                temp.append(x[0])

            partner_obj = pooler.get_pool(cr.dbname).get('res.partner')
            partner_obj.write(cr, uid, [partner_id],{'answers_ids':[[6,0,temp]]}, context)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.