[MERGE] hr*: Miscellaneous usability improvements
1. hr_holidays: Clean manager form refs Purpose: Ease modification/addition of views and actions (in particular when inheriting actions in hr_holidays_gantt) Specification: Use `form_view_ref` in the action context instead of the form xml id in all views. + Add tree view from "Time Off / My Team" 2. hr_contract: Remove social secretariat field Social secretariat is a Belgian concept. It does not make sense to have this in the standard contract app. Will be reintroduced in l10n_be_hr_payroll (or internal) if really needed. Move `job_id` in the right group to easily add fields on the right with view inheritance. 3. hr_holidays: Display leaves in calendar Purpose: When a leave is created and approved, it can also create a meeting in the calendar. In the leave type configuration a particular meeting type can be chosen. The purpose is to simplify this. Specification: Remove the choice of meeting type. The choice should be: Display Leaves in calendar: Yes/No (checkox) 4. hr: Direclty create user's employee 5. hr_holidays_gantt: Improve gantt views 6. hr_contract_salary: Make applicant's certificate required Purpose: Currently, on the salary configurator frontend, the certificate is a radio button, with a default value selected. Some applicants don't change the default value, even if it is not their certificate. Applicant should always explicitely set their certificate. Specification: Make the certificate a required field without a default value. To reuse the existing validation logic of the salary JS, the input is now a `select` instead of a `radio`. 7. hr_payroll: Sort payslips by date Currently, payslips and payslip batches are sorted by creation date, oldest first. It's better to sort them according to their dates, more recent firsts. 8. hr_holidays_gantt: Rename Leave into Time Off 9. hr_payroll: Adapt view inheritance social secretariat field The field `reported_to_secretariat` of `hr.contract` has been removed in Community: #4284 This commit adapts view inheritance after this change. 10. hr_payroll: Move schedule_pay from contract to structure Schedule pay depends on the salary structure, not the contract. e.g. for the same contract, the regular pay is every month, but the 13th month is every year. Hence the field is moved to `hr.payroll.structure` and made a related field on `hr.contract`. Note: the field schedule_pay is currently unused. It could probably be removed completly remove on the contract. 11. hr_payroll: Add stat button on structure type 12. hr_payroll: Merge hr_payroll_gantt into hr_payroll Since hr_payroll is now an enterprise module, an additional module is no longer needed to add gantt views. After this commit, `hr_payroll_gantt` module is deleted and everything is moved to `hr_payroll`. 13. hr_payroll: Improve payroll menus Employees - Employees -Contracts Work Entries - Work Entries - Conficts Payslips - To Pay (show only draft payslips) - All Payslips (newest first) - Batches (newest first) Reporting - Payroll - Meal Voucher (l10n_be_hr_payroll) Configuration - Settings - Work Entries * Work Entry Types - Salary * Structure Types * Structures * Rules * Other Input Type (debug mode) 14. hr_payroll: Rename demo data The renamed demo structure is the main structure. It should have a general name instead of a name linked to a particular employee. 15. l10n_be_hr_payroll: Set default 38h calendar for BE Set the default calendar of Belgian companies to 38 hours/week TaskID: 1972536 closes odoo/odoo#33233 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -51,16 +51,12 @@ class User(models.Model):
|
||||
certificate = fields.Selection(related='employee_id.certificate', readonly=False, related_sudo=False)
|
||||
study_field = fields.Char(related='employee_id.study_field', readonly=False, related_sudo=False)
|
||||
study_school = fields.Char(related='employee_id.study_school', readonly=False, related_sudo=False)
|
||||
employee_warning = fields.Char("Missing employee warning", compute='_compute_employee_warning')
|
||||
employee_count = fields.Integer(compute='_compute_employee_count')
|
||||
|
||||
@api.depends('groups_id', 'employee_ids', 'active')
|
||||
def _compute_employee_warning(self):
|
||||
""" Fill warning only for active internal user (employee) not linked to hr.employee """
|
||||
@api.depends('employee_ids')
|
||||
def _compute_employee_count(self):
|
||||
for user in self:
|
||||
if not user.employee_ids and not user.share and user.active:
|
||||
user.employee_warning = _("Don't forget to create the linked employee.")
|
||||
else:
|
||||
user.employee_warning = False
|
||||
user.employee_count = len(user.employee_ids)
|
||||
|
||||
def __init__(self, pool, cr):
|
||||
""" Override of __init__ to add access rights.
|
||||
@@ -183,12 +179,7 @@ class User(models.Model):
|
||||
@api.multi
|
||||
def action_create_employee(self):
|
||||
self.ensure_one()
|
||||
form_view = self.env.ref('hr.view_employee_form')
|
||||
return {
|
||||
'name': _('Create Employee'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'hr.employee',
|
||||
'views': [(form_view.id, 'form')],
|
||||
'target': 'new',
|
||||
'context': {'default_user_id': self.id}
|
||||
}
|
||||
self.env['hr.employee'].create(dict(
|
||||
user_id=self.id,
|
||||
**self.env['hr.employee']._sync_user(self)
|
||||
))
|
||||
|
||||
@@ -165,16 +165,36 @@
|
||||
<field name="view_id" ref="hr.res_users_view_form_profile"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_employee_action_from_user" model="ir.actions.act_window">
|
||||
<field name="name">Employees</field>
|
||||
<field name="res_model">hr.employee</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="domain">[('user_id', '=', active_id)]</field>
|
||||
</record>
|
||||
|
||||
<record id="res_users_view_form" model="ir.ui.view">
|
||||
<field name="name">res.users.form.inherit</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='image']" position="before">
|
||||
<div groups="hr.group_hr_user" class="alert alert-danger text-center" role="alert" attrs="{'invisible': [('employee_warning', '=', False)]}">
|
||||
<a class="close" data-dismiss="alert" href="#">x</a>
|
||||
<field name="employee_warning" nolabel="1" class="oe_inline"/> <button class="oe_inline oe_link p-0" type="object" name="action_create_employee">Click here to create it.</button>.
|
||||
</div>
|
||||
|
||||
<xpath expr="//header" position="inside">
|
||||
<field name="share" invisible="1"/>
|
||||
<field name="employee_ids" invisible="1"/>
|
||||
<button string="Create employee"
|
||||
type="object" name="action_create_employee"
|
||||
attrs="{'invisible': ['|', '|', ('id', '=', False), ('share', '=', True), ('employee_count', '>', 0)]}"/>
|
||||
<!-- share is not correclty recomputed because it depends on fields of reified view => invisible before saving (id=False) -->
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
<button name="%(hr_employee_action_from_user)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-users"
|
||||
attrs="{'invisible': [('employee_count', '=', 0)]}"
|
||||
type="action">
|
||||
<field name="employee_count" widget="statinfo" string="Employee(s)"/>
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -45,8 +45,6 @@ class Contract(models.Model):
|
||||
permit_no = fields.Char('Work Permit No', related="employee_id.permit_no", readonly=False)
|
||||
visa_no = fields.Char('Visa No', related="employee_id.visa_no", readonly=False)
|
||||
visa_expire = fields.Date('Visa Expire Date', related="employee_id.visa_expire", readonly=False)
|
||||
reported_to_secretariat = fields.Boolean('Social Secretariat',
|
||||
help='Green this button when the contract information has been transfered to the social secretariat.')
|
||||
hr_responsible_id = fields.Many2one('res.users', 'HR Responsible', tracking=True,
|
||||
help='Person responsible for validating the employee\'s contracts.')
|
||||
|
||||
|
||||
@@ -75,8 +75,6 @@
|
||||
<separator />
|
||||
<filter string="Current Employee" name="current_employee" domain="[('employee_id.active','=',True)]"/>
|
||||
<separator/>
|
||||
<filter string="To Report to Social Secretariat" name="to_report" domain="[('reported_to_secretariat', '=', False)]"/>
|
||||
<separator/>
|
||||
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
|
||||
<separator/>
|
||||
<filter string="Important Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/>
|
||||
@@ -113,10 +111,9 @@
|
||||
<group>
|
||||
<field name="employee_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="job_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="reported_to_secretariat" widget="toggle_button" options='{"active": "Reported to the social secretariat", "inactive": "To report to the social secretariat"}'/>
|
||||
<field name="job_id"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
|
||||
@@ -603,7 +603,7 @@ class HolidaysRequest(models.Model):
|
||||
by creating a calendar event and a resource time off. """
|
||||
holidays = self.filtered(lambda request: request.holiday_type == 'employee')
|
||||
holidays._create_resource_leave()
|
||||
for holiday in holidays:
|
||||
for holiday in holidays.filtered(lambda l: l.holiday_status_id.create_calendar_meeting):
|
||||
meeting_values = holiday._prepare_holidays_meeting_values()
|
||||
meeting = self.env['calendar.event'].with_context(no_mail_to_attendees=True).create(meeting_values)
|
||||
holiday.write({'meeting_id': meeting.id})
|
||||
@@ -614,8 +614,6 @@ class HolidaysRequest(models.Model):
|
||||
calendar = self.employee_id.resource_calendar_id or self.env.company.resource_calendar_id
|
||||
meeting_values = {
|
||||
'name': self.display_name,
|
||||
'categ_ids': [(6, 0, [
|
||||
self.holiday_status_id.categ_id.id])] if self.holiday_status_id.categ_id else [],
|
||||
'duration': self.number_of_days * (calendar.hours_per_day or HOURS_PER_DAY),
|
||||
'description': self.notes,
|
||||
'user_id': self.user_id.id,
|
||||
|
||||
@@ -26,9 +26,7 @@ class HolidaysType(models.Model):
|
||||
code = fields.Char('Code')
|
||||
sequence = fields.Integer(default=100,
|
||||
help='The type with the smallest sequence is the default value in time off request')
|
||||
categ_id = fields.Many2one(
|
||||
'calendar.event.type', string='Meeting Type',
|
||||
help='Once a time off is validated, Odoo will create a corresponding meeting of this type in the calendar.')
|
||||
create_calendar_meeting = fields.Boolean(string="Display Time Off in Calendar", default=True)
|
||||
color_name = fields.Selection([
|
||||
('red', 'Red'),
|
||||
('blue', 'Blue'),
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<search string="Search Time Off Type">
|
||||
<field name="name" string="Time Off Types"/>
|
||||
<field name="code"/>
|
||||
<field name="categ_id"/>
|
||||
<field name="create_calendar_meeting"/>
|
||||
<separator/>
|
||||
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
|
||||
</search>
|
||||
@@ -70,7 +70,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<group name="calendar" string="Calendar" groups="base.group_no_one">
|
||||
<field name="categ_id"/>
|
||||
<field name="create_calendar_meeting"/>
|
||||
<field name="color_name"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
|
||||
@@ -368,7 +368,7 @@
|
||||
<field name="name">hr.leave.view.calendar</field>
|
||||
<field name="model">hr.leave</field>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Time Off Request" event_open_popup="true" readonly_form_view_id="%(hr_holidays.hr_leave_view_form_manager)d" form_view_id="%(hr_holidays.hr_leave_view_form_manager)d" date_start="date_from" date_stop="date_to" mode="month" quick_add="False" color="employee_id">
|
||||
<calendar string="Time Off Request" event_open_popup="true" date_start="date_from" date_stop="date_to" mode="month" quick_add="False" color="employee_id">
|
||||
<field name="display_name"/>
|
||||
</calendar>
|
||||
</field>
|
||||
@@ -440,11 +440,16 @@
|
||||
<field name="name">All Time Off</field>
|
||||
<field name="res_model">hr.leave</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">calendar</field>
|
||||
<field name="context">{'search_default_year': 1, 'search_default_group_employee': 1, 'search_default_managed_people': 1, 'search_default_managed_people': 1, 'search_default_my_team_leaves': 1}</field>
|
||||
<field name="view_mode">calendar,tree</field>
|
||||
<field name="context">{
|
||||
'search_default_year': 1,
|
||||
'search_default_group_employee': 1,
|
||||
'search_default_managed_people': 1,
|
||||
'search_default_my_team_leaves': 1,
|
||||
'form_view_ref': 'hr_holidays.hr_leave_view_form_manager',
|
||||
}</field>
|
||||
<field name="domain">[('holiday_type','=','employee'), ('state', '!=', 'refuse')]</field>
|
||||
<field name="search_view_id" ref="view_hr_holidays_filter"/>
|
||||
<field name="view_id" ref="hr_leave_view_calendar"/>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
@@ -594,7 +599,7 @@
|
||||
<field name="res_model">hr.leave</field>
|
||||
<field name="binding_model_id" ref="hr.model_hr_employee"/>
|
||||
<field name="view_mode">tree,kanban,form,calendar,activity</field>
|
||||
<field name="context">{}</field>
|
||||
<field name="context">{'form_view_ref': 'hr_holidays.hr_leave_view_form_manager'}</field>
|
||||
<field name="domain">[]</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
@@ -602,18 +607,6 @@
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
<record id="hr_leave_action_all_tree_form" model="ir.actions.act_window.view">
|
||||
<field name="sequence">2</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="act_window_id" ref="hr_leave_action_all"/>
|
||||
<field name="view_id" ref="hr_leave_view_tree"/>
|
||||
</record>
|
||||
<record id="hr_leave_action_all_view_form" model="ir.actions.act_window.view">
|
||||
<field name="sequence">10</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="act_window_id" ref="hr_leave_action_all"/>
|
||||
<field name="view_id" ref="hr_leave_view_form_manager"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_leave_action_action_approve_department" model="ir.actions.act_window">
|
||||
<field name="name">Department Time Off</field>
|
||||
|
||||
Reference in New Issue
Block a user