Skip to Content
Menu
This question has been flagged
1 Reply
4070 Views

Hello, I want to inherit the 'account.voucher' python class so I wrote this to begin :

 class inherit_account_voucher(osv.osv):
    _name = 'account_voucher'
    _inherit = 'account.voucher'
    
    def button_proforma_voucher(self, cr, uid, ids, context=None):
        raise Warning('hello')
 return True

but I found this error :
 2015-07-07 09:48:41,205 25023 CRITICAL test openerp.service.server: Failed to initialize database `test`.
Traceback (most recent call last):
  File "/home/guillaume/Workspace/openerp/openerp/service/server.py", line 929, in preload_registries
    registry = RegistryManager.new(dbname, update_module=update_module)
  File "/home/guillaume/Workspace/openerp/openerp/modules/registry.py", line 370, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/guillaume/Workspace/openerp/openerp/modules/loading.py", line 351, in load_modules
    force, status, report, loaded_modules, update_module)
  File "/home/guillaume/Workspace/openerp/openerp/modules/loading.py", line 255, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/home/guillaume/Workspace/openerp/openerp/modules/loading.py", line 152, in load_module_graph
    models = registry.load(cr, package)
  File "/home/guillaume/Workspace/openerp/openerp/modules/registry.py", line 163, in load
    model = cls._build_model(self, cr)
  File "/home/guillaume/Workspace/openerp/openerp/models.py", line 603, in _build_model
    'You may need to add a dependency on the parent class\' module.' % (name, parent))
TypeError: The model "account_voucher" specifies an unexisting parent class "account.voucher"
You may need to add a dependency on the parent class' module.

I don't understand why ! ( The module account_voucher is installed )
Avatar
Discard
Best Answer

Hello Guillaume,

You just need to add the module as in dependency of your __openerp__.py file. For example like as follows,

'depends': ["account_voucher"]

Even if that module is installed, you need to add that module in your dependency !

--

Regards

Odoo Police ["Justice for all !"]

Avatar
Discard
Author

Thank You ! it's works !!

Your's welcome ! Odoo police is always in your service !

Related Posts Replies Views Activity
3
Apr 24
1010
0
May 24
46
1
Apr 24
1822
4
Sep 23
3084
2
Sep 23
5592