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

I've extended the project module with a many2many field for subtypes. The field will be used to set the tasks users following sub types. When I create a new project it sets the correct default values, but not on existing. Is there a way to set default values for existing projects.  


def _get_user_default_subtypes(self):
return self.env['mail.message.subtype'].sudo().search([('res_model', '=', False)]).ids
user_subtype_ids = fields.Many2many('mail.message.subtype', 'project_user_subtype_rel', 'project_id', 'subtype_id', string='Users Subtypes', default=_get_user_default_subtypes)

I don't want to do this on hand for 140+ projects :/



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

Hi,
Default works at the creation time.
It is better to do this in an onchange function, if you have any other field.
Or
Try to update existing records with a temporary function.
Or
Import the data using an excel/csv file

Thanks

อวตาร
ละทิ้ง
ผู้เขียน

yeah I thought that I'll have to make a method that fills this values.

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ค. 17
11131
0
ก.ค. 22
1536
1
ม.ค. 22
11248
2
ม.ค. 21
5868
4
ก.พ. 20
4180