Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
4269 Widoki

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?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź
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




Awatar
Odrzuć
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.