Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3994 มุมมอง

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!

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มิ.ย. 15
3473
0
มิ.ย. 15
3089
0
มิ.ย. 15
6181
Loading wrong configuration file? แก้ไขแล้ว
1
เม.ย. 15
8379
2
มี.ค. 15
17371