Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0][MIG] ao_hr_timesheet_sheet #137

Open
wants to merge 10 commits into
base: 12.0
Choose a base branch
from
25 changes: 25 additions & 0 deletions ao_hr_timesheet_sheet/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

================================
AO-specific customizations on HR
================================

This module contains customizations specific to Aleph Objects.

* A regular user can only view/create/edit her own HR Timesheet.
* A manager can view/create/edit HR Timesheets of the employees she is in
charge of.
* A department manager can view/create/edit HR Timesheets of the employees
in her department
* Users cannot create projects from HR Timesheets
* Add Last Week filter on Timesheet Reporting

Credits
=======

Contributors
------------

* Eficent Business and IT Consulting Services S.L. <[email protected]>
Empty file.
23 changes: 23 additions & 0 deletions ao_hr_timesheet_sheet/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2015-19 Eficent Business and IT Consulting Services S.L.
# - Jordi Ballester Alomar
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "AO-specific customizations on HR Timesheet Sheet",
"version": "12.0.1.0.0",
"author": "Eficent Business and IT Consulting Services S.L.",
"website": "http://www.eficent.com",
"category": "Human Resources",
"depends": [
"hr_timesheet_sheet",
"hr_timesheet_attendance",
],
"license": "AGPL-3",
"data": [
"security/hr_timesheet_sheet_security.xml",
"views/account_analytic_line_view.xml",
"views/hr_timesheet_sheet_views.xml",
"views/hr_timesheet_attendance_report_view.xml"
],
"installable": True,
}
37 changes: 37 additions & 0 deletions ao_hr_timesheet_sheet/security/hr_timesheet_sheet_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="0">

<record id="timesheet_user_rule" model="ir.rule">
<field name="name">Employee Timesheet</field>
<field name="model_id" search="[('model','=','hr_timesheet.sheet')]" model="ir.model"/>
<field name="domain_force">['|', '|',
('employee_id.user_id','=', user.id),
('employee_id.parent_id.user_id','=', user.id),
('department_id.manager_id.user_id', '=', user.id)]</field>
<field eval="False" name="global"/>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
</record>
<record id="timesheet_hr_user_rule" model="ir.rule">
<field name="name">Employee Timesheet - HR</field>
<field name="model_id" search="[('model','=','hr_timesheet.sheet')]" model="ir.model"/>
<field name="domain_force">[(1,'=',1)]</field>
<field eval="False" name="global"/>
<field name="groups" eval="[(4, ref('hr.group_hr_user'))]"/>
</record>

<record id="timesheet_line_rule_base_hr_user" model="ir.rule">
<field name="name">account.analytic.line.timesheet.base.hr.user</field>
<field name="model_id" ref="analytic.model_account_analytic_line"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('hr.group_hr_user'))]"/>
<field name="perm_create" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_unlink" eval="1"/>
<field name="perm_read" eval="1"/>
</record>

<record id="hr_timesheet.timesheet_line_rule_user" model="ir.rule">
<field name="perm_read" eval="1"/>
</record>

</odoo>
52 changes: 52 additions & 0 deletions ao_hr_timesheet_sheet/views/account_analytic_line_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<odoo>

<record id="hr_timesheet.act_hr_timesheet_line" model="ir.actions.act_window">
<field name="name">Activities</field>
<field name="res_model">account.analytic.line</field>
<field name="view_type">form</field>
<field name="domain">[('project_id', '!=', False),('user_id', '=', uid)]</field>
<field name="context">{"search_default_today":1}</field>
<field name="search_view_id"
ref="hr_timesheet.hr_timesheet_line_search"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to record activities.
</p><p>
You can register and track your workings hours by project every
day. Every time spent on a project will become a cost in the
analytic accounting/contract and can be re-invoiced to
customers if required.
</p>
</field>
</record>

<record id="act_hr_timesheet_line_all_users" model="ir.actions.act_window">
<field name="name">Everyone Activities</field>
<field name="res_model">account.analytic.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
<field name="domain">[('project_id', '!=', False)]</field>
<field name="context">{"search_default_today":1}</field>
<field name="search_view_id"
ref="hr_timesheet.hr_timesheet_line_search"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to record activities.
</p><p>
You can register and track your workings hours by project every
day. Every time spent on a project will become a cost in the
analytic accounting/contract and can be re-invoiced to
customers if required.
</p>
</field>
</record>

<menuitem id="menu_hr_working_hours" parent="hr_timesheet.menu_hr_time_tracking"
action="act_hr_timesheet_line_all_users" groups="hr.group_hr_user"/>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="hr_timesheet_attendance_report_filter_last_week" model="ir.ui.view">
<field name="name">hr.timesheet.attendance.report.filter.last.week</field>
<field name="model">hr.timesheet.attendance.report</field>
<field name="inherit_id" ref="hr_timesheet_attendance.view_hr_timesheet_attendance_report_search"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='month']" position="after">
<filter name="last_week" string="Last Week"
domain="[
'&amp;',
('date', '>=', (context_today() + relativedelta(weeks=-2,days=1,weekday=0)).strftime('%Y-%m-%d')),
('date', '&lt;=', (context_today() + relativedelta(weeks=-1,weekday=6)).strftime('%Y-%m-%d')),
]"/>
</xpath>
</field>
</record>

</odoo>
15 changes: 15 additions & 0 deletions ao_hr_timesheet_sheet/views/hr_timesheet_sheet_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="hr_timesheet_sheet_form" model="ir.ui.view">
<field name="name">hr_timesheet.sheet.form</field>
<field name="model">hr_timesheet.sheet</field>
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
<field name="arch" type="xml">
<field name="add_line_project_id" position="attributes">
<attribute name="options">{'no_create': True}</attribute>
</field>
</field>
</record>

</odoo>