Community mailing list archives

community@mail.odoo.com

Re: Issue faced during Custom Module Upgradation from Odoo 7 to Odoo 9

by
Nitish Raina
- 04/11/2016 09:12:45
Hello Guys,

In order to fix AttributeError: 'module' object has no attribute 'function' ,  I made following changes in the code from
'no_of_observations': fields.function(fnct_no_of_observation, method=True, string='No. of observations', type='integer', store=True),
to

'no_of_observations': fields.Integer(string= 'No. of observations', store= True, compute= '_fnct_no_of_observation')

def _fnct_no_of_observation(self):
        """
        This function count number of child's in the observations and set the count.
        """
        x = {}
        no_of_observation=0
        for record in self.browse(cr, uid, ids):
            no_of_observation=len(record.child_test_entry_observations_id)
            x[record.id] = no_of_observation
        return x

But it is leading to the following error :

 __getattr__
 return self._attrs[name]
RuntimeError: maximum recursion depth exceeded.

Furthermore, if I changes return self._attrs[name] to return self.args[name] , following error shows up :

__getattr__
raise AttributeError(name)
AttributeError: to_field

Can anyone please let me know what can be probable solution for this ?

Thanks,
Nitish Raina