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

in create python code in my modulue here is code

    from osv import osv , fields
     class asset_allocation(osv.osv):
   _name = 'asset.allocation'
   _description = 'Asset Allocation'
   _columns = {
    'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True),
    'employee_id': fields.many2one('hr.employee', 'Employee', required=True),
    'asset_status': fields.date.time( 'Status', required=True,),
    'note': fields.text('Note'),
     }

     asset_allocation()

Error

Unresolved import: fields

Undefined variable from import: osv

อวตาร
ละทิ้ง

in Openerp 7 you can't directly import osv for that you need to follow this from openerp.osv import osv, fields

คำตอบที่ดีที่สุด

You've used bad syntax. Correct way is:

from openerp.osv import fields, osv
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 15
7732
0
มี.ค. 15
4229
5
ม.ค. 24
16292
4
มี.ค. 15
6063
1
มี.ค. 15
4547