Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix auto registration of job methods and channels
The automatic registration of job methods and their defaut channel has been a bit chaotic. The initial version for the new Odoo API could crashing as soon as a method was decorated by @Property. There is such a property in the code code, the method '_cache'. The problem of the crash was that, the introspection basically uses a 'getattr' on every attribute of the instance. The '_cache' method could then be called on an empty recordset, which is not supported by '_cache'. A first correction (49d8f37) was to naively skip the '_cache' method from the introspection. In any case, it is wrong to access the property of an instance only to instrospect its members. That's why the correction 4ebb245 changed the inspection from the instance to the class. Properties are no longer accessed, however this correction was not correct for Python 3. When members of the class are introspected, they are neither bound neither unbound methods. they are mere functions. The change here is to lookup for functions. _register_job must now takes the model as input argument, because there is no way to get the name of the model from the function. Closes OCA#64 Follows OCA#50
- Loading branch information