changeset 19441ba25afd in trytond:6.0
details: https://hg.tryton.org/trytond?cmd=changeset&node=19441ba25afd
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
        (grafted from 76a2462ece62a646eddbff8e99ded8e84f5b76cf)
diffstat:

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

diffs (14 lines):

diff -r 2e696b998711 -r 19441ba25afd 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