Odoo Help

Welcome!

This community 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.

0

How inherit account.voucher python class ?

By
Guillaume Seran
on 7/7/15, 6:01 AM 701 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 )
2
Odoo Police
On 7/7/15, 6:08 AM

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 !"]

Thank You ! it's works !!

Guillaume Seran
on 7/7/15, 6:18 AM

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

Odoo Police
on 7/7/15, 6:56 AM

Your Answer

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/7/15, 6:01 AM
Seen: 701 times
Last updated: 7/7/15, 6:18 AM