Commit Graph
7 Commits
Author SHA1 Message Date
Leonardo Pavan Rocha c53724ebc3 [IMP] *: adds generic user avatar
Description of the issue/feature this PR addresses:
It is currently quite difficult to differentiate users. Most of the time, people
don't take the time to upload an actual avatar so everybody looks the same. This
PR generates a custom avatar with the users initials and random color to
differentiate them. For res.users, res.partner and hr.employee, image fields now
hold the binary image and avatar are used to show the image or svg.

Current behavior before PR:
Avatar had only random colors and was being saved in database, being inefficient

Desired behavior after PR is merged:
A new mixin defines image fields and in case no image is set, it generates an
SVG image with the user's initials and random color.

closes odoo/odoo#69819

Task: 2404630
Related: odoo/enterprise#18199
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-06-01 14:36:23 +00:00
Julien Castiaux 90b52d144a [REF] base: Use Command helper for x2many
Task: 2366606
2020-11-30 10:16:09 +00:00
51b36c3dbb [IMP] base: add default image for users + placeholder if unassigned
1/ When the new database is created without demo data, the admin has a
   'silhouette' as a default picture. When a new user is created without
   picture given by the current user, the new user will have a 'silhouette'
   as a default profile picture.

2/ web: image for fa-user-slash. This image will be used when a record is
   unassigned.

3/ web, *: Change placeholder by default when record is unassigned.
   We want to have a fa-user-slash icon when a record is unassigned instead
   of 'placeholder.png'. A method is created in the BaseModel to have a
   generic method to change easily the placeholder for other models.

4/ Adapt kanban test to keep the same behaviour. Attention the behaviour is
   a bit different. Because, now the default image is given by the server to
   change easily the default image when a record doesn't have an image.
   Thus, we don't say if it's the default placeholder, but we can say it's
   not the same image of the record (in this test, the record, it's the
   partner).

5/ misc: display 'Unassigned' in the hover on kanban cards if record is unassigned

closes odoo/odoo#41356

Taskid: 2060206
Related: odoo/enterprise#7758
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: jdoutreloux <jud@odoo.com>
Co-authored-by: Yannick Tivisse <yti@odoo.com>
2020-01-21 09:22:46 +00:00
Sébastien Theys 1e9772889b [IMP] *: use image.mixin when appropriate
The following models are already using big images, or they might need big images
in the future:

- partner
- hr employee
- shop category
- lunch product
- gamification badge and karma rank

PR: #34925
2019-08-02 16:47:58 +00:00
Yannick Tivisse 265263dbce [FIX] base: Set a default email address for admin
Purpose
=======

Currently, as the admin as no email address, it's now impossible to install
the mail module without demo data, because of the following data:

        <record model="mail.message" id="module_install_notification" context="{'mail_notify_noemail': True}">
            <field name="model">mail.channel</field>
            <field name="res_id" ref="mail.channel_all_employees"/>
            <field name="message_type">email</field>
            <field name="subtype_id" ref="mail.mt_comment"/>
            <field name="subject">Welcome to Odoo!</field>
            <field name="body"><![CDATA[<p>Welcome to the #general channel.</p>
            <p>This channel is accessible to all users to <b>easily share company information</b>.</p>]]></field>
        </record>

Because when creating a mail.message a user error is raised if no email address is found.

    @api.model
    def _get_default_from(self):
        if self.env.user.email:
            return formataddr((self.env.user.name, self.env.user.email))
        raise UserError(_("Unable to post message, please configure the sender's email address."))

In a general way, all the users should have an email address.
2018-08-24 11:05:22 +02:00
Raphael Collet 2f7c03d9ca [IMP] base: add regular user admin as uid 2
User 1 simply becomes a technical user (inactive, no password).
2018-08-23 21:38:57 +02:00
Thibault Delavallée 22f02af6bf [SPLIT] base: split base_data 2017-11-27 11:15:13 +01:00