Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
In almost all uses of
Nonereturn value (missing model) is not handled. This usually leads to a very confusing exception later in other place in the form
AttributeError: 'NoneType' object has no attribute 'xxxxx'.
Sometimes, finding the error cause is not straightforward as the exception does not show the offending model name which may be from XML data or has been dynamically manipulated like in menu actions or just a missing dependency.
To find the problem, I have to set a conditional breakpoint for the None value at the exception line and look up in the stack for the model name.
Registry class has
__getitem__() method, I started to use
self.pool[model] in my code to get an exception that shows the model name immediately in the form
KeyError: 'model.name' instead of a confusing error later.
My question is, why OpenERP server and core modules use the
pool.get() method if the None value is not handled anyway?
OpenERP Since a begins uses self.pool.get(model).
First thing is to understand this ERP architecture,
here modular approach and dependencies are well maintained.
So when you try to use any dependent module you must have add in depends at __openerp__.py file. It mean depending module always be their no need to worry about âNoneâ .
Whenever you try self.pool.get(model), it mean as logically you try to use existing moduleâs model or dependent model. Here no need to worry about it return None.
Source : http://goo.gl/qdAPD4
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 8/18/13, 6:02 AM|
|Seen: 3389 times|
|Last updated: 7/3/15, 8:57 AM|