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

Inheritance : Global Name not defined issue v7

By
Yassine TEIMI
on 12/29/14, 5:27 PM 886 views

I am overriding a method of account.voucher that uses resolve_o2m_operations, wich is a global method I guess, it's declared at the end of the file, outside any class, so it's global and apllicable to all classes. The problem is when overriding the method, it gives me : Global name resolve_o2m_operations not defined, how to define it in the the new class where I'm overrding ? I tried to put the method on the new file containing the overriden method ... any solution please

Can you post a part of your code ?

Med Said BARA
on 12/30/14, 3:40 AM

Thanks said for your interest, It's solved.

Yassine TEIMI
on 12/30/14, 5:33 AM
0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 12/30/14, 12:37 AM

@Yassine, I'm assuming you are using a new module and new py file.  In that file, add the following somewhere near the beginning: from account_voucher.account_voucher import resolve_o2m_operations

Following my last post, I just needed to add : addons.account_voucher_account_voucher import resole_o2m_operations, and it works. Thanks Ivan !! you inspired me !

Yassine TEIMI
on 12/30/14, 5:32 AM

@Yassine are you using any of the saas branch? If so, yes, it need the addons in front.

Ivan
on 12/30/14, 6:40 AM

Yes, i'm deploying openerp on my dedicated server.

Yassine TEIMI
on 12/30/14, 7:44 AM
0
Yassine TEIMI
On 12/30/14, 5:14 AM

@Ivan : Yes I'm using a new module : account_payment_bl, with files : __init__.py ;  __openerp__.py ; account_voucher.py ; voucher_bl_view.xml   

On the file __init__.py I put : import account_voucher, so as to import account_voucher.py

When I put from "account_voucher.account_voucher import resolve_o2m_operations" it drives me to that error : 

File "/opt/openerp/server/openerp/modules/loading.py", line 350, in load_modules force, status, report, loaded_modules, update_module) File "/opt/openerp/server/openerp/modules/loading.py", line 256, in load_marked_modules loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks) File "/opt/openerp/server/openerp/modules/loading.py", line 159, in load_module_graph load_openerp_module(package.name) File "/opt/openerp/server/openerp/modules/module.py", line 405, in load_openerp_module __import__('openerp.addons.' + module_name) File "/opt/openerp/server/openerp/modules/module.py", line 133, in load_module mod = imp.load_module('openerp.addons.' + module_part, f, path, descr) File "/opt/openerp/server/openerp/addons/account_payment_bl/__init__.py", line 22, in <module> import account_voucher File "/opt/openerp/server/openerp/addons/account_payment_bl/account_voucher.py", line 2, in <module> from account_voucher.account_voucher import resolve_o2m_operations ImportError: No module named account_voucher

I made in blod caracter the most interesting part of the error, why it's not considering account_voucher as a module ?

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

2 follower(s)

Stats

Asked: 12/29/14, 5:27 PM
Seen: 886 times
Last updated: 3/16/15, 8:10 AM