[IMP] hr, hr_expense, hr_skills: adapt to report layout

task-3447407

Part-of: odoo/odoo#135739
Co-authored-by: Prakash Prajapati <ppr@odoo.com>, Dheeraj Pandey <padh@odoo.com>
This commit is contained in:
Aditya Dubey
2023-10-27 14:21:54 +00:00
committed by Prakash Prajapati
co-authored by Prakash Prajapati <ppr@odoo.com>, Dheeraj Pandey <padh@odoo.com>
parent 0f991a93ef
commit a45c6c545f
4 changed files with 76 additions and 45 deletions
+10 -4
View File
@@ -14,14 +14,18 @@
<template id="print_employee_badge">
<t t-call="web.basic_layout">
<div class="page">
<div class="oe_structure"></div>
<t t-foreach="docs" t-as="employee">
<div class="col-md-6">
<div class="oe_structure"></div>
<table style="width:243pt; height:153pt; border: 1pt solid black; border-collapse:separate; border-radius:8pt; margin:5pt">
<td style="width:33%;" valign="center">
<table style="width:77pt; height:150pt" class="table-borderless">
<tr style="height:30%">
<td align="center" valign="center">
<img t-if="employee.company_id.logo" t-att-src="image_data_uri(employee.company_id.logo)" style="max-height:45pt;max-width:90%" alt="Company Logo"/>
<span t-if="employee.company_id.logo">
<img t-att-src="image_data_uri(employee.company_id.logo)" style="max-height:45pt;max-width:90%" alt="Company Logo"/>
</span>
</td>
</tr>
<tr style="height:70%;">
@@ -33,14 +37,16 @@
</td>
<td style="width:67%" valign="center">
<table style="width:155pt; height:85pt" class="table-borderless">
<tr><th><div style="font-size:15pt; margin-bottom:0pt;margin-top:0pt;" align="center"><t t-esc="employee.name"/></div></th></tr>
<tr><td><div align="center" style="font-size:10pt;margin-bottom:5pt;"><t t-esc="employee.job_id.name"/></div></td></tr>
<tr><td><div t-if="employee.barcode" t-field="employee.barcode" t-options="{'widget': 'barcode', 'width': 600, 'height': 120, 'img_style': 'max-height:50pt;max-width:100%;', 'img_align': 'center'}"/></td></tr>
<tr><th><div style="font-size:15pt; margin-bottom:0pt;margin-top:0pt;" align="center"><span t-out="employee.name">Marc Demo</span></div></th></tr>
<tr><td><div align="center" style="font-size:10pt;margin-bottom:5pt;"><span t-out="employee.job_id.name">Software Developer</span></div></td></tr>
<tr><td><div t-if="employee.barcode" t-field="employee.barcode" t-options="{'widget': 'barcode', 'width': 600, 'height': 120, 'img_style': 'max-height:50pt;max-width:100%;', 'img_align': 'center'}">12345678901</div></td></tr>
</table>
</td>
</table>
<div class="oe_structure"></div>
</div>
</t>
<div class="oe_structure"></div>
</div>
</t>
</template>
+33 -20
View File
@@ -5,30 +5,32 @@
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<div class="page o_content_pdf">
<div class="oe_structure"></div>
<h2>Expenses Report</h2>
<h3><t t-out="o.name"/></h3>
<h3><span t-out="o.name">Business Trip</span></h3>
<div class="row o_header">
<div class="col-6">
<div class="row">
<div class="col-3 fw-bold"><span>Employee:</span> </div>
<div class="col-9 text-muted"><span t-field="o.employee_id.name"/></div>
<div class="col-9 text-muted"><span t-field="o.employee_id.name">Marc Demo</span></div>
</div>
<div class="row" t-if="o.accounting_date">
<div class="col-3 fw-bold"><span>Date:</span></div>
<div class="col-9 text-muted"><span t-field="o.accounting_date"/></div>
<div class="col-9 text-muted"><span t-field="o.accounting_date">2023-08-11</span></div>
</div>
</div>
<div class="col-6">
<div class="row" t-if="o.user_id.name">
<div class="col-3 fw-bold"><span>Manager:</span></div>
<div class="col-9 text-muted"><span t-field="o.user_id"/></div>
<div class="col-9 text-muted"><span t-field="o.user_id">Mitchell Admin</span></div>
</div>
<div class="row">
<div class="col-3 fw-bold"><span>Paid by:</span></div>
<div class="col-9 text-muted"><span t-field="o.payment_mode"/></div>
<div class="col-9 text-muted"><span t-field="o.payment_mode">Credit Card</span></div>
</div>
</div>
</div>
<div class="oe_structure"></div>
<table class="o_table">
<thead>
@@ -45,46 +47,56 @@
</thead>
<tbody>
<tr t-foreach="o.expense_line_ids" t-as="line">
<td class="text-start"><span t-field="line.date"/></td>
<td class="text-start"><span t-field="line.date"></span></td>
<td t-att-class="'text-start' + (' o_overflow' if len(line.name) > 30 else '')">
<span t-field="line.name"/><br/>
<span t-field="line.name">Flight Ticket</span><br/>
<span>
<div t-foreach="line.analytic_distribution" t-as="distribution">
<t t-out="line.env['account.analytic.account'].browse(int(distribution))[0].name"/>: <t t-out="line.analytic_distribution.get(distribution)"/>
</div>
<span t-foreach="line.analytic_distribution" t-as="distribution">
<span t-out="line.env['account.analytic.account'].browse(int(distribution))[0].name">Analytic Account Name</span>:
<span t-out="line.analytic_distribution.get(distribution)">50%</span>
</span>
</span>
</td>
<td class="text-end"><span t-field="line.price_unit"/></td>
<td class="text-end"><span t-field="line.quantity"/></td>
<td class="text-end"><span t-field="line.price_unit">$100.00</span></td>
<td class="text-end"><span t-field="line.quantity">1</span></td>
<td class="text-end">
<t t-foreach="line.tax_ids" t-as="tax">
<t t-if="tax.description"><span t-field="tax.description"/></t>
<t t-if="not tax.description"><span t-field="tax.name"/></t>
<t t-if="tax.description"><span t-field="tax.description">VAT</span></t>
<t t-if="not tax.description"><span t-field="tax.name">Tax Name</span></t>
</t>
</td>
<td t-if="foreign_currencies" class="text-end"><span t-field="line.total_amount_currency" t-options='{"widget": "monetary", "display_currency": line.currency_id}'/></td>
<td class="text-end"><span t-field="line.total_amount" t-options='{"widget": "monetary", "display_currency": o.company_currency_id}'/></td>
<td t-if="foreign_currencies" class="text-end">
<span t-field="line.total_amount_currency" t-options='{"widget": "monetary", "display_currency": line.currency_id}'>$120.00</span>
</td>
<td class="text-end">
<span t-field="line.total_amount" t-options='{"widget": "monetary", "display_currency": o.company_currency_id}'>$100.00</span>
</td>
</tr>
</tbody>
</table>
<div class="oe_structure"></div>
<div class="row justify-content-end o_total">
<div class="col-4">
<div class="oe_structure"></div>
<table class="o_subtable">
<tbody>
<tr>
<td>Untaxed Amount</td>
<td class="text-end"><span t-field="o.untaxed_amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/></td>
<td class="text-end"><span t-field="o.untaxed_amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'>$500.00</span></td>
</tr>
<tr>
<td>Taxes</td>
<td class="text-end"><span t-field="o.total_tax_amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/></td>
<td class="text-end"><span t-field="o.total_tax_amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'>$100.00</span></td>
</tr>
<tr class="fw-bold">
<td>Total</td>
<td class="text-end"><span t-field="o.total_amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/></td>
<td class="text-end">
<span t-field="o.total_amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'>$600.00</span>
</td>
</tr>
</tbody>
</table>
<div class="oe_structure"></div>
</div>
</div>
</div>
@@ -97,8 +109,9 @@
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.basic_layout">
<div class="oe_structure"></div>
<div t-if="attachment and attachment.mimetype != 'application/pdf'">
<h3> <t t-out="attachment.res_name"/> </h3>
<h3> <span t-out="attachment.res_name">Attachment Name</span> </h3>
<img t-att-src="attachment.image_src" class="o_attachment_pdf"/>
</div>
</t>
@@ -1,6 +1,6 @@
$text-color: #3f4650;
$text-color-secondary: #545e6c;
$text-muted: #a1b2c9;
$text-color: #16171a;
$text-color-secondary: #16171a;
$text-muted: #3b4757;
$progess-bar-background: #f5f5f5;
div.o_employee_cv {
@@ -29,6 +29,8 @@ div.o_employee_cv {
.o_sidebar {
color: #fff;
margin-top: -150px;
margin-left: 500px;
width: inherit;
display: inline-block;
max-width: 50%;
@@ -55,8 +57,8 @@ div.o_employee_cv {
}
.o_profile_job {
color: rgba(256, 256, 256, 0.6);
font-size: 16px;
color: rgba(256, 256, 256, 0.9);
font-size: 20px;
font-weight: bold;
margin-top: 0;
}
@@ -18,43 +18,50 @@
<div class="o_company row">
<div class="col-12 mb-4">
<img t-if="o.company_id.logo" t-att-src="image_data_uri(o.company_id.logo)" style="max-height: 45px;" alt="Logo"/>
<div class="oe_structure"></div>
</div>
<div class="col-12 mb-4" style="font-weight: bold;">
<t t-esc="o.company_id.partner_id.name"/>
<span t-out="o.company_id.partner_id.name">Demo Company Name</span>
</div>
<div class="col-12">
<span t-field="o.company_id.partner_id" t-options='{"widget": "contact", "fields": ["address"], "no_marker": True}'>Demo Address</span>
</div>
<div class="col-12" t-field="o.company_id.partner_id" t-options='{"widget": "contact", "fields": ["address"], "no_marker": True}'/>
</div>
</template>
<template id="report_employee_cv_sidepanel">
<div class="oe_structure"></div>
<div class="o_sidebar" t-attf-style="
background: #{color_primary};
background-color: #{color_primary};">
<div class="o_profile">
<img class="img img-fluid rounded-circle o_profile_image" t-attf-src="data:image/png;base64,#{o.image_128}" alt="" t-if="o.image_128"/>
<h1 class="o_profile_name mt-2" t-field="o.name"/>
<h3 class="o_profile_job mb-2" t-field="o.job_id"/>
<h1 class="o_profile_name mt-2" t-field="o.name">Marc Demo</h1>
<h3 class="o_profile_job mb-2" t-field="o.job_id">Software Developer</h3>
</div>
<div class="oe_structure"></div>
<div class="o_sidebar_section" t-if="show_contact">
<ul class="o_social">
<li class="email" t-if="o.company_id.email">
<i class="fa fa-solid fa-envelope pe-2"/>
<a t-attf-href="mailto: #{o.company_id.email}" t-field="o.company_id.email"/>
<a t-attf-href="mailto: #{o.company_id.email}" t-field="o.company_id.email">demo@email.com</a>
</li>
<li class="phone" t-if="o.company_id.mobile">
<i class="fa fa-solid fa-phone pe-2"/>
<a t-attf-href="tel:#{o.company_id.mobile}" t-field="o.company_id.mobile"/>
<a t-attf-href="tel:#{o.company_id.mobile}" t-field="o.company_id.mobile">+1234567890</a>
</li>
<li class="website" t-if="o.company_id.website">
<i class="fa fa-solid fa-globe pe-2"/>
<a t-attf-href="tel:#{o.company_id.website}" t-field="o.company_id.website"/>
<a t-attf-href="tel:#{o.company_id.website}" t-field="o.company_id.website">www.demo.com</a>
</li>
</ul>
</div>
</div>
<div class="oe_structure"></div>
</template>
<template id="report_employee_cv_main_panel">
<div class="oe_structure"></div>
<t t-foreach="resume_lines[o]" t-as="line_type">
<div class="o_main_panel">
<div class="o_main_panel_section">
@@ -62,28 +69,29 @@
<span class="o_main_panel_icon" t-attf-style="background: #{color_secondary};">
<i class="fa fa-solid fa-briefcase"/>
</span>
<t t-esc="line_type"/>
<span t-out="line_type">Experience</span>
</h2>
<t t-foreach="resume_lines[o][line_type]" t-as="resume_line">
<div class="o_main_panel_resume_title ps-5">
<div class="o_main_panel_resume_title_job">
<h3 class="o_main_panel_resume_job" t-field="resume_line.name"/>
<h3 class="o_main_panel_resume_job" t-field="resume_line.name">Software Developer</h3>
</div>
<div class="o_main_panel_resume_title_dates">
<t t-set="present">Present</t>
<div class="o_main_panel_resume_year">
<t t-esc="resume_line.date_start.year"/> - <t t-esc="resume_line.date_end.year if resume_line.date_end else present"/>
<span t-out="resume_line.date_start.year">2022</span> - <span t-out="resume_line.date_end.year if resume_line.date_end else 'Present'">2023</span>
</div>
</div>
</div>
<div class="o_main_panel_resume_description ps-5 w-auto">
<p t-field="resume_line.description"/>
<p t-field="resume_line.description">Odoo India pvt. Ltd</p>
</div>
</t>
</div>
</div>
</t>
<div class="oe_structure"></div>
<t t-set="has_languages" t-value="skill_type_language and any(skill_line.skill_type_id == skill_type_language for skill_line in o.employee_skill_ids)"/>
<div class="o_main_panel mt-4" t-if="has_languages">
<div class="o_main_panel_section" t-if="skill_type_language">
@@ -97,7 +105,7 @@
<t t-if="skill_line.skill_type_id == skill_type_language">
<div class="o_main_panel_resume_title ps-5 pb-2">
<div class="o_main_panel_resume_title_job">
<h3 class="o_main_panel_resume_job"><t t-esc="skill_line.skill_id.name"/> - <t t-esc="skill_line.skill_level_id.name"/></h3>
<h3 class="o_main_panel_resume_job"><span t-out="skill_line.skill_id.name">English</span> - <span t-out="skill_line.skill_level_id.name">Fluent</span></h3>
</div>
</div>
</t>
@@ -105,21 +113,22 @@
</div>
</div>
<div class="oe_structure"></div>
<t t-set="has_skills" t-value="show_skills and any(skill_line.skill_type_id != skill_type_language for skill_line in o.employee_skill_ids)"/>
<div class="o_main_panel mt-4" t-if="has_skills">
<div class="o_main_panel_section">
<h2 class="o_main_panel_title" t-attf-style="color: #{color_secondary};">
<span class="o_main_panel_icon" t-attf-style="background: #{color_secondary};">
<i class="fa fa-solid fa-rocket"/>
</span>Skills
</span>
Skills
</h2>
<t t-set="valid_skills" t-value="[skill for skill in o.employee_skill_ids if skill.skill_type_id != skill_type_language]"/>
<!-- Thanks wkhtmltopdf -->
<t t-foreach="[valid_skills[n:n+2] for n in range(0, len(valid_skills), 2)]" t-as="skills_pair">
<div class="o_main_panel_skills row ps-5">
<t t-foreach="skills_pair" t-as="skill_line">
<div class="o_main_panel_skill_line col-6 pe-4" t-if="skill_line.skill_type_id != skill_type_language">
<h3 class="o_main_panel_skill_name" t-field="skill_line.skill_id"/>
<h3 class="o_main_panel_skill_name" t-field="skill_line.skill_id">Python</h3>
<div class="progress o_main_panel_skill_progress_bar">
<div
class="o_main_panel_skill_progress_bar_color"
@@ -135,5 +144,6 @@
</t>
</div>
</div>
<div class="oe_structure"></div>
</template>
</odoo>