Do not write metadata on ir.note when writing on only the unread field

issue9245
review305371002
This commit is contained in:
Nicolas Évrard committed 2020-04-21 14:06:10 +02:00
1 parent cd97362e08
commit 820b71b0ee
1 file changed
+4 -2
+4 -2
View File
@@ -101,11 +101,13 @@ class Note(ResourceMixin, ModelSQL, ModelView):
@classmethod
def write(cls, notes, values, *args):
# Avoid changing write meta data if only unread is set
if args or values.keys() != ['unread']:
if args or set(values.keys()) != {'unread'}:
super(Note, cls).write(notes, values, *args)
else:
# Check access write and clean cache
ModelStorage.write(notes, values)
# Use __func__ to directly access ModelStorage's write method and
# pass it the right class
ModelStorage.write.__func__(cls, notes, values)
cls.set_unread(notes, 'unread', values['unread'])