Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] mail, hr: avatar card preview #121943

Closed

Conversation

juliusc2066
Copy link
Contributor

@juliusc2066 juliusc2066 commented May 22, 2023

This commit adds the possibility to see additional information about a
user with a card that appears when hovering avatar user fields for a
set amount of time. This card contains the following information:

  • Avatar
  • Chat status
  • Name
  • Email
  • Button to send message

and with HR installed:

  • View profile Button
  • Job position
  • Department
  • Phone number
  • Advanced chat status (when hr_holidays is installed)

Task-3167110

@robodoo
Copy link
Contributor

robodoo commented May 22, 2023

@juliusc2066 juliusc2066 force-pushed the master-avatar-card-preview-juca branch from 645093c to 57d1769 Compare May 22, 2023 13:26
@C3POdoo C3POdoo added the RD research & development, internal work label May 22, 2023
@juliusc2066 juliusc2066 force-pushed the master-avatar-card-preview-juca branch 7 times, most recently from 652f5be to 824b5f7 Compare May 26, 2023 14:40
@juliusc2066 juliusc2066 force-pushed the master-avatar-card-preview-juca branch 5 times, most recently from 642bdf4 to b71dd5c Compare July 4, 2023 08:37
@juliusc2066 juliusc2066 marked this pull request as ready for review July 18, 2023 08:05
@juliusc2066 juliusc2066 force-pushed the master-avatar-card-preview-juca branch from b71dd5c to 89ad506 Compare July 18, 2023 08:05
@C3POdoo C3POdoo requested review from a team, FrancoisGe and kebeclibre and removed request for a team July 18, 2023 08:07
addons/hr/static/tests/helpers/model_definitions_setup.js Outdated Show resolved Hide resolved
addons/web/static/src/core/popover/popover_service.js Outdated Show resolved Hide resolved
addons/web/static/src/core/popover/popover_controller.js Outdated Show resolved Hide resolved
addons/hr/static/tests/web/m2x_avatar_user_tests.js Outdated Show resolved Hide resolved
addons/hr/static/tests/web/m2x_avatar_user_tests.js Outdated Show resolved Hide resolved
addons/hr/static/tests/web/m2x_avatar_user_tests.js Outdated Show resolved Hide resolved
@juliusc2066 juliusc2066 force-pushed the master-avatar-card-preview-juca branch from 89ad506 to afb4164 Compare July 19, 2023 08:52
@Polymorphe57
Copy link
Contributor

robodoo r+

hugocarlier pushed a commit to odoo-dev/odoo that referenced this pull request Nov 7, 2023
Impacted modules:
- resource
- hr
- hr_skills
- hr_holidays
- hr_homeworking

This commits introduces avatar card preview for resource.resource
and hr.employee(.public) records in a similar way to what has been done
in mail for res.users records (see odoo#121943 and
odoo#131355).

resource.resource
=================
The following field components are created to display the popover card
when clicking on the avatar of the resource.resource record:
- widget many2one_avatar_resource (based on many2one_avatar_user)
- widget many2many_avatar_resource (based on many2many_avatar_user)

The behavior implemented when clicking on a resource.resource record's
avatar is the following:
- If the resource is human, a popover card is displayed. A "Send
Message" button is displayed on the card if a user is associated to the
record.
- If the resource is material, no popover card is displayed.
nb: this behavior is modified in planning

The design of the popover card is for resource.resource records is
similar to the one initially implemented for res.users records.

The choice is made to override existing widget/components instead of
patching them as field dependencies need to be added for
resource.resource records to distinguish material from human
resources (and have the necessary information to determine if the
popover card has to be displayed for material resources).

Note: It is currently not possible to add _relatedFields_ option to M2O
fields due to framework restriction that could evolve in Odoo 18. The
behavior of the many2one_avatar_resource widget therefore exhibits the
following limitations:
- related field 'resource_type' that need to be fetched to determine if
an avatar is displayed or not needs to be added to the model whose views
will use this widget.
- a popover card is displayed even if the human resource has no user
linked to it. For the same reason, a related field user_id should be
added to other models which is not really desirable and could lead to
confusion.
This should be refactored when a support of the _relatedFields_ option
is added for M2O fields.

hr.employee
===========
The following widgets are patched to display the popover card
when clicking on the avatar of the hr.employee record:
- many2many_avatar_user
- many2one_avatar_user

The card displayed uses the same template as the one used for
resource.resource records.

task-3457031
hugocarlier pushed a commit to odoo-dev/odoo that referenced this pull request Nov 15, 2023
Impacted modules:
- resource
- hr
- hr_skills
- hr_holidays
- hr_homeworking

This commits introduces avatar card preview for resource.resource
and hr.employee(.public) records in a similar way to what has been done
in mail for res.users records (see odoo#121943 and
odoo#131355).

resource.resource
=================
The following field components are created to display the popover card
when clicking on the avatar of the resource.resource record:
- widget many2one_avatar_resource (based on many2one_avatar_user)
- widget many2many_avatar_resource (based on many2many_avatar_user)

The behavior implemented when clicking on a resource.resource record's
avatar is the following:
- If the resource is human, a popover card is displayed. A "Send
Message" button is displayed on the card if a user is associated to the
record.
- If the resource is material, no popover card is displayed.
nb: this behavior is modified in planning

The design of the popover card is for resource.resource records is
similar to the one initially implemented for res.users records.

The choice is made to override existing widget/components instead of
patching them as field dependencies need to be added for
resource.resource records to distinguish material from human
resources (and have the necessary information to determine if the
popover card has to be displayed for material resources).

Note: It is currently not possible to add _relatedFields_ option to M2O
fields due to framework restriction that could evolve in Odoo 18. The
behavior of the many2one_avatar_resource widget therefore exhibits the
following limitations:
- related field 'resource_type' that need to be fetched to determine if
an avatar is displayed or not needs to be added to the model whose views
will use this widget.
- a popover card is displayed even if the human resource has no user
linked to it. For the same reason, a related field user_id should be
added to other models which is not really desirable and could lead to
confusion.
This should be refactored when a support of the _relatedFields_ option
is added for M2O fields.

hr.employee
===========
The following widgets are patched to display the popover card
when clicking on the avatar of the hr.employee record:
- many2many_avatar_user
- many2one_avatar_user

The card displayed uses the same template as the one used for
resource.resource records.

task-3457031
hugocarlier pushed a commit to odoo-dev/odoo that referenced this pull request Dec 1, 2023
Impacted modules:
- hr
- hr_skills
- hr_holidays
- hr_homeworking
- resource_mail (new module)

This commits introduces avatar card preview for resource.resource
and hr.employee(.public) records in a similar way to what has been done
in mail for res.users records (see odoo#121943 and
odoo#131355).

resource.resource
=================
The following field components are created to display the popover card
when clicking on the avatar of the resource.resource record:
- widget many2one_avatar_resource (based on many2one_avatar_user)
- widget many2many_avatar_resource (based on many2many_avatar_user)

The behavior implemented when clicking on a resource.resource record's
avatar is the following:
- If the resource is human, a popover card is displayed. A "Send
Message" button is displayed on the card if a user is associated to the
record.
- If the resource is material, no popover card is displayed.
nb: this behavior is modified in planning

The design of the popover card is for resource.resource records is
similar to the one initially implemented for res.users records.

The choice is made to override existing widget/components instead of
patching them as field dependencies need to be added for
resource.resource records to distinguish material from human
resources (and have the necessary information to determine if the
popover card has to be displayed for material resources).

Note: It is currently not possible to add _relatedFields_ option to M2O
fields due to framework restriction that could evolve in Odoo 18. The
behavior of the many2one_avatar_resource widget therefore exhibits the
following limitations:
- related field 'resource_type' that need to be fetched to determine if
an avatar is displayed or not needs to be added to the model whose views
will use this widget.
- a popover card is displayed even if the human resource has no user
linked to it. For the same reason, a related field user_id should be
added to other models which is not really desirable and could lead to
confusion.
This should be refactored when a support of the _relatedFields_ option
is added for M2O fields.

hr.employee
===========
The following widgets are patched to display the popover card
when clicking on the avatar of the hr.employee record:
- many2many_avatar_user
- many2one_avatar_user

The card displayed uses the same template as the one used for
resource.resource records.

task-3457031
robodoo pushed a commit that referenced this pull request Dec 1, 2023
Impacted modules:
- hr
- hr_skills
- hr_holidays
- hr_homeworking
- resource_mail (new module)

This commits introduces avatar card preview for resource.resource
and hr.employee(.public) records in a similar way to what has been done
in mail for res.users records (see #121943 and
#131355).

resource.resource
=================
The following field components are created to display the popover card
when clicking on the avatar of the resource.resource record:
- widget many2one_avatar_resource (based on many2one_avatar_user)
- widget many2many_avatar_resource (based on many2many_avatar_user)

The behavior implemented when clicking on a resource.resource record's
avatar is the following:
- If the resource is human, a popover card is displayed. A "Send
Message" button is displayed on the card if a user is associated to the
record.
- If the resource is material, no popover card is displayed.
nb: this behavior is modified in planning

The design of the popover card is for resource.resource records is
similar to the one initially implemented for res.users records.

The choice is made to override existing widget/components instead of
patching them as field dependencies need to be added for
resource.resource records to distinguish material from human
resources (and have the necessary information to determine if the
popover card has to be displayed for material resources).

Note: It is currently not possible to add _relatedFields_ option to M2O
fields due to framework restriction that could evolve in Odoo 18. The
behavior of the many2one_avatar_resource widget therefore exhibits the
following limitations:
- related field 'resource_type' that need to be fetched to determine if
an avatar is displayed or not needs to be added to the model whose views
will use this widget.
- a popover card is displayed even if the human resource has no user
linked to it. For the same reason, a related field user_id should be
added to other models which is not really desirable and could lead to
confusion.
This should be refactored when a support of the _relatedFields_ option
is added for M2O fields.

hr.employee
===========
The following widgets are patched to display the popover card
when clicking on the avatar of the hr.employee record:
- many2many_avatar_user
- many2one_avatar_user

The card displayed uses the same template as the one used for
resource.resource records.

task-3457031

closes #137915

Related: odoo/enterprise#48808
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
16.5 RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants