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

i am learning module creation but stuck at a point. can some buddy help me out. odoo is saying syntax error at line 8. mean on title field

#this is teting learning module

# coding: utf-8

from openerp import models,fields, osv

class book(models.Model):

_name="book.book"

_description="simple book"

_coloumn={

title = fields.Char(string='Title', required=True)

desc = fields.text("Description"),

author = fields.char(string="Author", size=30, required=True)

}

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Ahmed,


_coloumn spell is wrong.

Try this :-

Old api :-

from openerp import models,fields, osv

class book(models.Model):

    _name="book.book"

    _description="simple book"

    _columns = {

        'title' : fields.char(string='Title', required=True),

        'desc': fields.text("Description"),

        'author': fields.char(string="Author", size=30, required=True),

    }


New Api :-

from openerp import models,fields, osv

class book(models.Model):

    _name="book.book"

    _description="simple book" 

       

    title =  fields.Char(string='Title', required=True)

    desc = fields.Text("Description")

    author =  fields.Char(string="Author", size=30, required=True)

 

Hope this useful to you.

Thanks,

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Created module , new moduel แก้ไขแล้ว
5
เม.ย. 19
5710
1
มี.ค. 15
8524
new module? แก้ไขแล้ว
10
พ.ค. 20
4477
Problem with inherited module แก้ไขแล้ว
6
ก.ค. 18
11579
3
เม.ย. 17
10079