Skip to Content
Menu
This question has been flagged
3 Replies
3875 Views

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?

Avatar
Discard
Author Best Answer

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

Avatar
Discard
Best Answer
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




Avatar
Discard
Author

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.