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

I don't understand why my default values that I set in models I inherits from somewhere elses doesn't work. In other words, default="DEFAULT TEXT" doesn't work in entities I will eventually inherits from. 

Why isn't working... and what would be the alternative? I tried setting only the the default property on the destination model, but odoo complains this is not valid. Any other idea?

Thanks

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

 Regarding:what would be the alternative

Override the default_get Like:

def default_get(self,cr,uid,fields,context):
res=super(multi_package_shipment_wizard,self).default_get(cr,uid,fields,context)
#Now update the res here.


In ODOO Admin can also set the default value of fields from   Setting->Technical->Actions->User defined Defaults .
For example for setting default account_id in account.invoice :

  1. Go to Setting->Technical->Actions->User defined Defaults.

  2. Create a record  for your model.

  3. Inside name place your filed name(account_id).

  4. Inside model place your model name(account.invoice).

  5. inside Default value  place the default value (id_number) 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ม.ค. 23
2227
1
ส.ค. 22
4913
1
ก.พ. 21
1914
1
ม.ค. 19
3725
0
ธ.ค. 18
5168