fix employee management
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from . import employee_report
|
||||
@@ -0,0 +1,13 @@
|
||||
from odoo import models
|
||||
|
||||
class MyReport(models.AbstractModel):
|
||||
_name = 'report.employee_management.my_report_template' # module.template
|
||||
_description = 'Employee Profile Report'
|
||||
|
||||
def _get_report_values(self, docids, data=None):
|
||||
# Lấy tất cả bản ghi employee.profile
|
||||
docs = self.env['employee.profile'].browse(docids)
|
||||
return {
|
||||
'doc_model': 'employee.profile',
|
||||
'docs': docs,
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<odoo>
|
||||
<!-- QWeb Report Template -->
|
||||
<template id="report_employee_profile_template">
|
||||
<t t-call="web.html_container">
|
||||
<t t-call="web.external_layout">
|
||||
<div class="page">
|
||||
<h2 style="text-align: center;">Employee Profile Report</h2>
|
||||
|
||||
<table class="table table-sm table-bordered" style="width: 100%; border-collapse: collapse;" border="1">
|
||||
<thead style="background-color: #f2f2f2;">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Employee Code</th>
|
||||
<th>Email</th>
|
||||
<th>Phone</th>
|
||||
<th>Department</th>
|
||||
<th>Position</th>
|
||||
<th>Image</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="docs" t-as="doc">
|
||||
<tr>
|
||||
<td>
|
||||
<t t-esc="doc.name"/>
|
||||
</td>
|
||||
<td>
|
||||
<t t-esc="doc.employee_code"/>
|
||||
</td>
|
||||
<td>
|
||||
<t t-esc="doc.email"/>
|
||||
</td>
|
||||
<td>
|
||||
<t t-esc="doc.phone"/>
|
||||
</td>
|
||||
<td>
|
||||
<t t-esc="doc.department"/>
|
||||
</td>
|
||||
<td>
|
||||
<t t-esc="doc.position"/>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<!-- Report Action -->
|
||||
<record id="report_employee_profile" model="ir.actions.report">
|
||||
<field name="name">Employee Profile Report</field>
|
||||
<field name="model">employee.profile</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">employee_management.report_employee_profile_template</field>
|
||||
<field name="report_file">employee_management.report_employee_profile_template</field>
|
||||
<field name="print_report_name">'EmployeeProfile_' + (object.name or '')</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user