← Back to team overview

openerp-india team mailing list archive

[Bug 904228] [NEW] Tigered store field can not be overrided 6.0/6.1

 

Public bug reported:

Hello,

A really annoying bug on store function field:

Lets take this line of hr_timesheet_task module on the project.project object:
 store = {
                'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks'], 20),
                'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours','state', 'work_ids'], 20),
                'hr.analytic.timesheet': (_get_project_work, ['task_id','unit_amount','product_uom_id','account_id'], 20),
                'account.analytic.line': (_get_analytic_line, ['unit_amount','product_uom_id','account_id'], 20),
            }),

We just extend the fields that should trigger the store fields
computation.

First we have to redefine function in our module:

    def _get_project_task(self, cr, uid, ids, context=None):
        return super(project, self)._get_project_task(cr, uid, ids, context)

The problem appears when I create a new task that trigger the _get_project_task function.
Self is not a subtype of project but it is an instance of project.task. So it raise :

TypeError: super(type, obj): obj must be an instance or subtype of type

Nicolas

** Affects: openobject-server
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/904228

Title:
  Tigered store field can not be overrided 6.0/6.1

Status in OpenERP Server:
  New

Bug description:
  Hello,

  A really annoying bug on store function field:

  Lets take this line of hr_timesheet_task module on the project.project object:
   store = {
                  'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks'], 20),
                  'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours','state', 'work_ids'], 20),
                  'hr.analytic.timesheet': (_get_project_work, ['task_id','unit_amount','product_uom_id','account_id'], 20),
                  'account.analytic.line': (_get_analytic_line, ['unit_amount','product_uom_id','account_id'], 20),
              }),

  We just extend the fields that should trigger the store fields
  computation.

  First we have to redefine function in our module:

      def _get_project_task(self, cr, uid, ids, context=None):
          return super(project, self)._get_project_task(cr, uid, ids, context)

  The problem appears when I create a new task that trigger the _get_project_task function.
  Self is not a subtype of project but it is an instance of project.task. So it raise :

  TypeError: super(type, obj): obj must be an instance or subtype of
  type

  Nicolas

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/904228/+subscriptions


Follow ups

References