19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:00 +01:00
parent a1137a1456
commit e1d89e11e3
2789 changed files with 1093187 additions and 605897 deletions

View file

@ -0,0 +1,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import hr_manager_department_report

View file

@ -6,7 +6,8 @@
<field name="report_type">qweb-pdf</field>
<field name="report_name">hr.print_employee_badge</field>
<field name="report_file">hr.print_employee_badge</field>
<field name="print_report_name">'Print Badge - %s' % (object.name).replace('/', '')</field>
<field name="paperformat_id" ref="hr.paperformat_hr_employee_badge"/>
<field name="print_report_name">'Badge - %s' % (object.name).replace('/', '')</field>
<field name="binding_model_id" ref="model_hr_employee"/>
<field name="binding_type">report</field>
</record>
@ -14,33 +15,45 @@
<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">
<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"/>
</td>
</tr>
<tr style="height:70%;">
<td align="center" valign="center">
<img t-att-src="image_data_uri(employee.avatar_1920)" style="max-height:85pt;max-width:90%" alt="Employee Image"/>
</td>
</tr>
</table>
</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>
</table>
</td>
<div style="display: inline-block; page-break-inside: avoid; width: 243pt; height: 153pt; border: 1pt solid black; border-radius:8pt; margin:5pt; padding: 2pt;">
<div class="oe_structure"></div>
<table style="width: 100%; height: 100%; border-spacing: 4pt; border-collapse: separate;" class="table-borderless">
<tr>
<td style="width: 33%;">
<table style="width: 100%; height: 100%; text-align: center;" class="table-borderless">
<t t-if="employee.company_id.logo">
<tr style="height:30%; padding-top: 4pt; padding-bottom: 2pt">
<td>
<img t-att-src="image_data_uri(employee.company_id.logo)" style="max-height: 40pt; max-width: 100%;" alt="Company Logo"/>
</td>
</tr>
</t>
<tr style="height:70%;">
<td style="height: 100%; width: 100%; padding-top: 2pt; padding-bottom: 4pt;">
<img t-att-src="image_data_uri(employee.avatar_1920)" style="max-height: 100pt; max-width: 100%;" alt="Employee Image"/>
</td>
</tr>
</table>
</td>
<td style="width:67%; height:100%; vertical-align: top;">
<table style="width: 100%; height: 100%; text-align: center;" class="table-borderless">
<tr><th><span style="font-size: 15pt;" t-out="employee.name" data-oe-demo="Marc Demo"></span></th></tr>
<tr><td><span style="font-size: 10pt;" t-out="employee.job_id.name" data-oe-demo="Software Developer"></span></td></tr>
<tr style="height: 100%;">
<td style="vertical-align: bottom; padding-bottom: 4pt;">
<div t-if="employee.barcode" t-field="employee.barcode" t-options="{'widget': 'barcode', 'width': 600, 'height': 120, 'img_style': 'max-width:100%;', 'img_align': 'center'}" data-oe-demo="12345678901"></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="oe_structure"></div>
</div>
</t>
<div class="oe_structure"></div>
</div>
</t>
</template>

View file

@ -0,0 +1,33 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class HrManagerDepartmentReport(models.AbstractModel):
_name = 'hr.manager.department.report'
_description = 'Hr Manager Department Report'
_auto = False
employee_id = fields.Many2one('hr.employee', string="Employee", readonly=True)
has_department_manager_access = fields.Boolean(search="_search_has_department_manager_access",
compute="_compute_has_department_manager_access")
def _search_has_department_manager_access(self, operator, value):
if operator != 'in':
return NotImplemented
department_ids = self.env['hr.department']._search([('manager_id', 'in', self.env.user.employee_ids.ids)])
return [
'|',
('employee_id.user_id', '=', self.env.user.id),
('employee_id.department_id', 'child_of', tuple(department_ids)),
]
def _compute_has_department_manager_access(self):
department_ids = self.env['hr.department']._search([('manager_id', 'in', self.env.user.employee_ids.ids)])
employees = self.env['hr.employee'].search([
'|',
('user_id', '=', self.env.user.id),
('department_id', 'child_of', tuple(department_ids)),
])
for report in self:
report.has_department_manager_access = report.employee_id in employees