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

Hi everyone,

I have a field:

current_roomtype_id = fields.Many2one(related='current_room_id.roomtype_id', store=True, track_visibility='onchange', readonly=True)

Every current_room_id has a not null roomtype_id, so this field should never be null, but in some cases (cannot track it down!) Odoo stores 'null' in this field, and there are no information in chatter when and how it was changed even though I put track_visibility='onchange'.

Anyone has any ideas?

アバター
破棄
著作者 最善の回答

The issue was with a OCA module: Auditlog
If I remove the rule for this model - it works just fine and related fields are stored.
If I add rule with Type=Full log - some related fields are not stored!

Made a bug report in Github:

\https://github.com/OCA/server-tools/issues/1676

アバター
破棄
最善の回答
current_roomtype_id = fields.Many2one('model_name',related='current_room_id.roomtype_id',
store=True, track_visibility='onchange', readonly=True)

Hi, 

You are missing model name in defination of Many2one field, 

please try this

current_roomtype_id = fields.Many2one('model_name',related='current_room_id.roomtype_id',
store=True, track_visibility='onchange', readonly=True)

Thanks !!!  

Aswini @ iWesabe




アバター
破棄
著作者

Thanks for your idea, I've just tried this - still not working.

I've also tried to remove readonly=True from field definition - also not working.

If I duplicate this database - the problem stays, however if I create a new database - there's no problem. Trying to figure out what's the difference.