コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
6405 ビュー

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.

関連投稿 返信 ビュー 活動
2
5月 17
11067
0
7月 22
1492
1
1月 22
11176
2
1月 21
5815
4
2月 20
4080