inheritance - Could I inherit from a custom module in odoo? -
i have custom module in odoo called "x_vehicles"
could possible inherit module overwrite create method??
i've code
class extend_vehicle(models.model): _inherit = 'x_vehicle' @api.model def create(self, vals): # something... return super(extend_vehicle, self).write(vals)
but error
2016-07-04 15:05:20,488 9217 error pro werkzeug: error on request: traceback (most recent call last): file "/users/jose/work/odoo/env/lib/python2.7/site-packages/werkzeug/serving.py", line 177, in run_wsgi execute(self.server.app) file "/users/jose/work/odoo/env/lib/python2.7/site-packages/werkzeug/serving.py", line 165, in execute application_iter = app(environ, start_response) file "/users/jose/work/odoo/openerp/service/server.py", line 246, in app return self.app(e, s) file "/users/jose/work/odoo/openerp/service/wsgi_server.py", line 184, in application return application_unproxied(environ, start_response) file "/users/jose/work/odoo/openerp/service/wsgi_server.py", line 170, in application_unproxied result = handler(environ, start_response) file "/users/jose/work/odoo/openerp/http.py", line 1493, in __call__ return self.dispatch(environ, start_response) file "/users/jose/work/odoo/openerp/http.py", line 1467, in __call__ return self.app(environ, start_wrapped) file "/users/jose/work/odoo/env/lib/python2.7/site-packages/werkzeug/wsgi.py", line 588, in __call__ return self.app(environ, start_response) file "/users/jose/work/odoo/openerp/http.py", line 1642, in dispatch ir_http = request.registry['ir.http'] file "/users/jose/work/odoo/openerp/http.py", line 363, in registry return openerp.modules.registry.registrymanager.get(self.db) if self.db else none file "/users/jose/work/odoo/openerp/modules/registry.py", line 355, in update_module) file "/users/jose/work/odoo/openerp/modules/registry.py", line 386, in new openerp.modules.load_modules(registry._db, force_demo, status, update_module) file "/users/jose/work/odoo/openerp/modules/loading.py", line 334, in load_modules force, status, report, loaded_modules, update_module) file "/users/jose/work/odoo/openerp/modules/loading.py", line 237, in load_marked_modules loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks) file "/users/jose/work/odoo/openerp/modules/loading.py", line 132, in load_module_graph models = registry.load(cr, package) file "/users/jose/work/odoo/openerp/modules/registry.py", line 169, in load model = cls._build_model(self, cr) file "/users/jose/work/odoo/openerp/models.py", line 591, in _build_model original_module = pool[name]._original_module if name in parents else cls._module file "/users/jose/work/odoo/openerp/modules/registry.py", line 84, in __getitem__ return self.models[model_name] keyerror: 'x_vehicle'
i don't know if need extend other model or special...
please, me??
edit: maybe name "custom module" i've made mistake... it's module built inside odoo, not external module. don't have code of module. built tool odoo provides.
i can't extract structure because it's little bit complicated extract functionality, so, need try inherit module
i'll hope more specific
edit 2: think here problem... if try install module inherit functionality, in tab "technical data" can see model unknown... don't know why...
also, actual openerp.py file
{ ... 'category': 'automation', 'version': '1', # module necessary 1 work correctly 'depends': ['base','x_vehicle'], # loaded 'data': [ ] }
yes possible.
open __openerp__.py
file , update following key
"depends" : [ 'base', 'list_of_core_module', 'your_custom_module_name' ],
where
list_of_core_module sale, purchase, account etc...,
your_custom_module_name have declared x_vehicles class
restart server , upgrade current module work on.
Comments
Post a Comment