Merge pull request #4009 from expsa/samir-aladawi-improves-hr-reports

Samir aladawi improves hr reports
This commit is contained in:
SamirLADOUI-sa 2025-07-23 16:00:38 +01:00 committed by GitHub
commit 5155574508
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 56 additions and 15 deletions

View File

@ -48,6 +48,7 @@
"views/hr_penalty_register_view.xml",
"views/employee_iqama_document_view.xml",
"views/res_users_views.xml",
"views/hr_holidays_views.xml",
"views/menus_view.xml",
# "views/res_config_settings.xml",
'report/hr_layout.xml',

View File

@ -31,3 +31,4 @@ from . import assets_document
from . import hr_department
from . import res_partner
from . import res_users
from . import hr_holidays

View File

@ -0,0 +1,7 @@
from odoo import models, fields
class HrHolidays(models.Model):
_inherit = 'hr.holidays'
emp_no = fields.Char(related='employee_id.emp_no')

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_holiday_allocation_tree_hr_holidays_community" model="ir.ui.view">
<field name="name">hr.holidays.allocation.tree.inherit</field>
<field name="model">hr.holidays</field>
<field name="inherit_id" ref="hr_holidays_community.view_holiday_allocation_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='employee_id']" position="before">
<field name="emp_no"/>
</xpath>
</field>
</record>
<record id="view_holiday_hr_holidays_community" model="ir.ui.view">
<field name="name">hr.holidays.tree.inherit</field>
<field name="model">hr.holidays</field>
<field name="inherit_id" ref="hr_holidays_community.view_holiday"/>
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='employee_id']" position="before">
<field name="emp_no"/>
</xpath>
</field>
</record>
</odoo>

View File

@ -84,8 +84,8 @@ class EmployeeHandoverReportXlsx(models.AbstractModel):
sheet.write(row, clm + 2, rec.employee_id.name, format1)
sheet.write(row, clm + 3, rec.job_id.name, format1)
sheet.write(row, clm + 4, rec.employee_id.department_id.name, format1)
sheet.write(row, clm + 5, rec.reason, format1)
sheet.write(row, clm + 6, str(rec.create_date), format1)
sheet.write(row, clm + 5, rec.cause_type.name, format1)
sheet.write(row, clm + 6, rec.create_date.strftime('%Y-%m-%d'), format1)
sheet.write(row, clm + 7, str(rec.first_hire_date), format1)
sheet.write(row, clm + 8, str(rec.last_work_date), format1)
sheet.write(row, clm + 9, rec.employee_id.working_location.name, format1)

View File

@ -137,22 +137,24 @@
<field name="name">hr.holidays.allocation.tree</field>
<field name="model">hr.holidays</field>
<field name="arch" type="xml">
<tree decoration-danger="state == 'refuse'" decoration-info="state == 'draft'" string="Allocation Requests"
<tree
decoration-info="state == 'draft'" decoration-warning="state in ['confirm', 'validate']"
decoration-success="state == 'validate1'" decoration-danger="state == 'refuse'" string="Allocation Requests"
decoration-bf="message_needaction == True">
<field name="employee_id"/>
<field name="department_id" />
<field name="holiday_type"/>
<field name="category_id"/>
<field name="department_id" invisible="1"/>
<field name="holiday_status_id"/>
<field name="name"/>
<field name="number_of_days" string="Allocated Days" sum="Remaining Days"/>
<field name="state"/>
<field name="holiday_type" invisible="1"/>
<field name="category_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="name" invisible="1"/>
<field name="manager_id" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
<field name="message_needaction" invisible="1"/>
<field name="state"/>
</tree>
</field>
</record>
@ -181,7 +183,9 @@
<field name="model">hr.holidays</field>
<field name="priority">20</field>
<field name="arch" type="xml">
<tree decoration-danger="state == 'refuse'" decoration-info="state == 'draft'" string="Leaves Summary">
<tree
decoration-info="state == 'draft'" decoration-warning="state in ['confirm', 'validate']"
decoration-success="state == 'validate1'" decoration-danger="state == 'refuse'" string="Leaves Summary">
<field name="employee_id"/>
<field name="category_id" invisible="1"/>
<field name="department_id" invisible="1"/>
@ -276,7 +280,9 @@
<field name="name">hr.holidays.tree</field>
<field name="model">hr.holidays</field>
<field name="arch" type="xml">
<tree decoration-danger="state == 'refuse'" decoration-info="state == 'draft'" string="Leave Requests"
<tree
decoration-info="state == 'draft'" decoration-warning="state in ['confirm', 'validate']"
decoration-success="state == 'validate1'" decoration-danger="state == 'refuse'" string="Leave Requests"
decoration-bf="message_needaction == True">
<field name="employee_id"/>
<field name="holiday_type" string="Mode" groups="base.group_no_one"/>
@ -284,7 +290,7 @@
<field name="name"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="number_of_days" string="Number of Days" sum="Remaining Days"/>
<field name="number_of_days_temp" string="Number of Days" sum="Remaining Days" decoration-bf="1"/>
<field name="state"/>
<field name="payslip_status" widget="toggle_button" options='{"active": "Reported in last payslips", "inactive": "To Report in Payslip"}' groups="hr_holidays_community.group_hr_holidays_manager"/>
<field name="category_id" invisible="1"/>
@ -520,7 +526,7 @@
Click here to create a new leave request.
</p>
</field>
<field name="domain">[('holiday_type','=','employee')]</field>
<field name="domain">[('holiday_type', '=', 'employee'), ('type', '=', 'add')]</field>
<field name="search_view_id" ref="view_hr_holidays_filter"/>
</record>

View File

@ -243,7 +243,7 @@
<attribute name="invisible">1</attribute>
</xpath>
<field name="state" position="before">
<field name="return_from_leave"/>
<field name="return_from_leave" optional="hide"/>
<!--field name="canceled_duration"/-->
</field>