changeset 76a2462ece62 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=76a2462ece62
description:
        Do not set empty avatar when generating one

        As the method is called on write and is also calling write via save, we 
must
        ensure to save only when an avatar is filled to break the loop.

        issue10914
        review363041002
diffstat:

 trytond/model/avatar.py |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r b64005c6aaa9 -r 76a2462ece62 trytond/model/avatar.py
--- a/trytond/model/avatar.py   Sat Oct 30 02:20:23 2021 +0200
+++ b/trytond/model/avatar.py   Sat Oct 30 02:25:37 2021 +0200
@@ -62,7 +62,9 @@
             if not records:
                 return
             for record in records:
-                record.avatar = generate(size, getattr(record, field))
+                avatar = generate(size, getattr(record, field))
+                if avatar:
+                    record.avatar = avatar
             cls.save(records)
 
         if default:

Reply via email to