[FIX] hr_skills{_survey}: fix certification resume line end_date

How to reproduce:
- Install hr_skills_survey with demo data
- As admin, in "Survey", create a simple certification with one question
- Click on share and send it to Marc demo
- As a public user, do the certification through the received link
- As admin, go to "Employee" and got to "Reporting -> Certifications"
- You will see the certification in red under "Marc Demo"

This means that the certification is already expired and should not.

When completing a certification (survey), a hr_resume_line is inserted in the
database with a start_date and an end_date set to the completion date, causing
the certification to be expired right away.

We only do "cosmetic" correction here as the real fix will be done in master to
avoid multiple upgrade:

- to avoid existing certification to be displayed in red in the reporting view,
we correct the display (by avoiding adding danger decoration to the line if the
date_start equals the date_end). That correction won't avoid to find those
certifications as expired as we can't correct the computed field as it is
stored. Also, if the expiration_status column is shown (hidden by default), it
will display expired on those certifications.
- We do a similar correction in the display of the employee resume.

Note: the end_date problem is anterior to v17 but the resume line expiration
has been introduced in v17.

Task-3389395

closes odoo/odoo#158047

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
Pierre-Yves Dufays
2024-03-25 10:00:44 +00:00
parent 6615bc76b4
commit fe4cfef888
2 changed files with 4 additions and 2 deletions
@@ -40,7 +40,9 @@
<td class="o_data_cell pt-0" t-on-click="(ev) => this.onCellClicked(record, null, ev)">
<div class="o_resume_line" t-att-data-id="id">
<small class="o_resume_line_dates fw-bold">
<t t-esc="formatDate(data.date_start)"/> - <t t-if="data.date_end" t-esc="formatDate(data.date_end)"/><t t-else="">Current</t>
<t t-esc="formatDate(data.date_start)"/> -
<t t-if="data.date_end and +data.date_end != +data.date_start" t-esc="formatDate(data.date_end)"/>
<t t-else="">Current</t>
</small>
<h4 class="o_resume_line_title mt-2" t-esc="data.name"/>
<p t-if="data.description" class="o_resume_line_desc" t-esc="data.description"/>
@@ -4,7 +4,7 @@
<field name="model">hr.resume.line</field>
<field name="arch" type="xml">
<tree expand="1"
decoration-danger="expiration_status == 'expired'"
decoration-danger="expiration_status == 'expired' and date_start != date_end"
decoration-warning="expiration_status == 'expiring'"
default_group_by="employee_id">
<field name="employee_id" widget="many2one_avatar_user"/>