Comment 0 for bug 1314496

Revision history for this message
Prajul P T (prajul07) wrote :

Gamification module in OpenERP 8 is showing key error when using functional fields.

To reproduce this error,

1) Create a new goal definition with "Computation Method" as "Automatic: sum on a field", "Model" as "sale.order.line" and "Field to Sum" as "product_uom_qty"
2) Create a new Challenges with "Periodicity" as "Monthly", "Start Date and End Date" as "04/01/2014 and 05/20/2014" respectively. Add the new goal definition in Goal with "Target value to reach" as 10000.
3) When the scheduler "Run Goal Challenge Checker" is run, its giving an error in server log as

2014-04-30 06:57:17,074 11901 ERROR OpenERP_8_30_apr openerp.addons.base.ir.ir_cron: Call of self.pool.get('gamification.challenge')._cron_update(cr, uid, *()) failed in Job 6
Traceback (most recent call last):
  File "/home/prajul/workspace/OpenERP_8_30_apr/openerp-8.0dev-20140416-230101/openerp/addons/base/ir/ir_cron.py", line 138, in _callback
    getattr(model, method_name)(cr, uid, *args)
  File "/home/prajul/workspace/OpenERP_8_30_apr/openerp-8.0dev-20140416-230101/openerp/addons/gamification/models/challenge.py", line 287, in _cron_update
    self.write(cr, uid, planned_challenge_ids, {'state': 'inprogress'}, context=context)
  File "/home/prajul/workspace/OpenERP_8_30_apr/openerp-8.0dev-20140416-230101/openerp/addons/gamification/models/challenge.py", line 253, in write
    self.generate_goals_from_challenge(cr, uid, ids, context=context)
  File "/home/prajul/workspace/OpenERP_8_30_apr/openerp-8.0dev-20140416-230101/openerp/addons/gamification/models/challenge.py", line 429, in generate_goals_from_challenge
    goal_obj.update(cr, uid, [new_goal_id], context=context)
  File "/home/prajul/workspace/OpenERP_8_30_apr/openerp-8.0dev-20140416-230101/openerp/addons/gamification/models/goal.py", line 282, in update
    res = obj.read_group(cr, uid, domain, [field_name], [''], context=context)
  File "/home/prajul/workspace/OpenERP_8_30_apr/openerp-8.0dev-20140416-230101/openerp/osv/orm.py", line 2401, in read_group
    for gb in groupby_list]
  File "/home/prajul/workspace/OpenERP_8_30_apr/openerp-8.0dev-20140416-230101/openerp/osv/orm.py", line 2273, in _read_group_process_groupby
    field_type = self._all_columns[split[0]].column._type
KeyError: ''