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

I tried to set a default status value to "Draft" when creating a new record, but the status is always blank. If I set the status manually, it worked. Here is the my command. Am I missing something?

class custom_purchase(models.Model):
_name = 'custom.purchase'

name = fields.Char(string="Name")
tanggal = fields.Date(string="Tanggal")
status = fields.Selection([('draft','Draft'),('approve','Approve'),('done','Done')], default='draft')
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Try upgrade restart server and update module, perhaps the default has not been updated yet

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Restarted Odoo service, ran Update App List, ran Apply Upgrade, upgraded the module, and it worked! Thanks!

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
4
ต.ค. 25
3058
2
ก.ย. 25
1932
4
ก.ย. 25
7067
0
ส.ค. 25
929
4
พ.ค. 25
3832