Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
4261 Zobrazení

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
Zrušit
Autor Nejlepší odpověď

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
Zrušit
Nejlepší odpověď
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
Zrušit
Autor

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.