콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
4147 화면

Hi, 

Today I wanted to translate parts of my code from v7 to v8. For that I changed the call (osv.osv) to (models.Model) and also changed the way I created my fields removing _column. I did all that in order to have a compute  field instead of a fields.function

But I found out that when I try to add 

from openerp import models, fields, api

in the same file where I have

from openerp.osv import fields, osv

It messes everything up. For example under openerp fields Char fields exist, but on openerp.osv fields its only char (lowercase C)

I was also getting 'field not found errors' .

So the question would be, is it possible to have v7 and v8 code in the same .py?

If it is not, should I create a new .py file for my v8 code and call it in my __init__ file?

Thanks for any clarification

아바타
취소
베스트 답변

You need to have separate namespace for the overlapping modules that you are importing as in this example:

from openerp.osv import fields as fields7, osv

아바타
취소
작성자

Oh perfect! I didn't know about the 'as' . Thank you very much!

관련 게시물 답글 화면 활동
0
6월 15
3607
0
6월 15
3227
0
6월 15
6344
1
4월 15
8529
2
3월 15
17574