changeset d0018accb7b1 in modules/web_user:default
details: https://hg.tryton.org/modules/web_user?cmd=changeset&node=d0018accb7b1
description:
        Add support for avatar

        issue10085
        review343561002
diffstat:

 user.py            |   5 +++--
 view/user_form.xml |  19 ++++++++++++-------
 2 files changed, 15 insertions(+), 9 deletions(-)

diffs (51 lines):

diff -r 40b13f6f4af8 -r d0018accb7b1 user.py
--- a/user.py   Thu Mar 18 21:28:50 2021 +0100
+++ b/user.py   Sun Mar 28 19:20:37 2021 +0200
@@ -26,7 +26,8 @@
 from trytond.config import config
 from trytond.exceptions import RateLimitException
 from trytond.model import (
-    ModelView, ModelSQL, DeactivableMixin, fields, Unique, Exclude)
+    ModelView, ModelSQL, DeactivableMixin, fields, Unique, Exclude,
+    avatar_mixin)
 from trytond.pool import Pool
 from trytond.pyson import Eval
 from trytond.report import Report, get_email
@@ -63,7 +64,7 @@
     return urllib.parse.parse_qsl(urllib.parse.urlsplit(url).query)
 
 
-class User(DeactivableMixin, ModelSQL, ModelView):
+class User(avatar_mixin(100), DeactivableMixin, ModelSQL, ModelView):
     'Web User'
     __name__ = 'web.user'
     _rec_name = 'email'
diff -r 40b13f6f4af8 -r d0018accb7b1 view/user_form.xml
--- a/view/user_form.xml        Thu Mar 18 21:28:50 2021 +0100
+++ b/view/user_form.xml        Sun Mar 28 19:20:37 2021 +0200
@@ -2,13 +2,18 @@
 <!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
 this repository contains the full copyright notices and license terms. -->
 <form>
-    <label name="party"/>
-    <field name="party"/>
-    <newline/>
-    <label name="email"/>
-    <field name="email"/>
-    <label name="active"/>
-    <field name="active"/>
+    <group col="4" colspan="3" yalign="0" id="header">
+        <label name="party"/>
+        <field name="party"/>
+        <label name="active"/>
+        <field name="active"/>
+
+        <label name="email"/>
+        <field name="email" widget="email"/>
+        <newline/>
+    </group>
+    <field name="avatar" widget="image" height="100" width="100" xexpand="0"/>
+
     <label name="password"/>
     <field name="password" widget="password"/>
     <button name="reset_password" colspan="2"/>

Reply via email to