Skip to content

Commit

Permalink
[MIG] portal_timesheet: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vib-adhoc committed Jun 9, 2023
1 parent dd1ffcb commit 55a38a2
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 0 deletions.
64 changes: 64 additions & 0 deletions portal_timesheet/README.rst
@@ -0,0 +1,64 @@
.. |company| replace:: ADHOC SA

.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png
:alt: ADHOC SA
:target: https://www.adhoc.com.ar

.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png

.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

================
Portal Timesheet
================

This module add an new group to use portal with absence management in backend.

#. This module creates the necessary groups to be able to give permissions to a portal user for timesheet, but the installation of the module alone does nothing, it is then necessary to choose the portal group that includes this functionality and add these groups as inheritance.

Installation
============

Only install the module.

Configuration
=============

There is nothing to configure.

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: http://runbot.adhoc.com.ar/

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/ingadhoc/miscellaneous/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.

Credits
=======

Images
------

* |company| |icon|

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

Maintainer
----------

|company_logo|

This module is maintained by the |company|.

To contribute to this module, please visit https://www.adhoc.com.ar.
6 changes: 6 additions & 0 deletions portal_timesheet/__init__.py
@@ -0,0 +1,6 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################

from . import models
49 changes: 49 additions & 0 deletions portal_timesheet/__manifest__.py
@@ -0,0 +1,49 @@
##############################################################################
#
# Copyright (C) 2019 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Portal Timesheet',
'version': '16.0.1.0.0',
'category': 'Base',
'sequence': 14,
'summary': '',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'images': [
],
'depends': [
'portal_backend',
'hr_timesheet',
],
'data': [
'security/res_groups.xml',
'security/ir.model.access.csv',
'views/base_menus.xml',
'views/hr_employee_views.xml',
],
'demo': [
# 'demo/hr_demo.xml',
'demo/project_demo.xml',
'demo/res_users_demo.xml',
],
'installable': True,
'auto_install': False,
'application': False,
}
15 changes: 15 additions & 0 deletions portal_timesheet/demo/hr_demo.xml
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<odoo>
<record id="employee_potal_advanced" model="hr.employee">
<field name="name">John Portal Advanced</field>
<field name="user_id" ref="portal_backend.user_portal_advanced"/>
<field name="department_id" ref="hr.dep_rd"/>
<field name="parent_id" ref="hr.employee_admin"/>
<field name="job_id" ref="hr.job_developer"/>
<field name="job_title">Junior Developer</field>
<field name="category_ids" eval="[(6, 0, [ref('hr.employee_category_4')])]"/>
<field name="work_location_id" ref="hr.work_location_1"/>
<field name="image_1920" type="base64" file="portal_backend/static/img/advanced_partner-image.png"/>
<field name="create_date">2022-01-01 00:00:00</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions portal_timesheet/demo/project_demo.xml
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<odoo>
<record id="project.project_project_1" model="project.project">
<field name="message_partner_ids" eval="[(4, ref('portal_backend.partner_portal_advanced'))]"/>
</record>
</odoo>
6 changes: 6 additions & 0 deletions portal_timesheet/demo/res_users_demo.xml
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<odoo>
<record id="portal_backend.user_portal_advanced" model="res.users" context="{'no_reset_password': True}">
<field name="groups_id" eval="[(4, ref('portal_timesheet.group_portal_backend_timesheet'))]"/>
</record>
</odoo>
2 changes: 2 additions & 0 deletions portal_timesheet/models/__init__.py
@@ -0,0 +1,2 @@
from . import ir_http
from . import project
11 changes: 11 additions & 0 deletions portal_timesheet/models/ir_http.py
@@ -0,0 +1,11 @@
from odoo import api, models


class Http(models.AbstractModel):
_inherit = 'ir.http'

def session_info(self):
if self.env.user.has_group('portal_timesheet.group_portal_backend_timesheet'):
return super(Http, self.with_context(portal_bypass=True)).session_info()
else:
return super(Http, self).session_info()
15 changes: 15 additions & 0 deletions portal_timesheet/models/project.py
@@ -0,0 +1,15 @@
from odoo import models, fields


class Project(models.Model):
_inherit = "project.project"

total_timesheet_time = fields.Integer(
groups='hr_timesheet.group_hr_timesheet_user, portal_timesheet.group_portal_backend_timesheet')

class Task(models.Model):
_inherit = "project.task"

def _ensure_fields_are_accessible(self, fields, operation='read', check_group_user=True):
if not self.env.user.has_group('portal_timesheet.group_portal_backend_timesheet'):
super()._ensure_fields_are_accessible(fields, operation, check_group_user)
12 changes: 12 additions & 0 deletions portal_timesheet/security/ir.model.access.csv
@@ -0,0 +1,12 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
portal_timesheet_account_analytic_account,portal-timesheet-model_account_analytic_account,analytic.model_account_analytic_account,group_portal_backend_timesheet,1,1,0,0
portal_timesheet_account_analytic_line,portal-timesheet-model_account_analytic_line,analytic.model_account_analytic_line,group_portal_backend_timesheet,1,1,1,1
portal_timesheet_hr_employee_public,portal-timesheet-model_hr_employee_public,hr.model_hr_employee_public,group_portal_backend_timesheet,1,0,0,0
portal_timesheet_project_project,portal-timesheet-model_project_project,project.model_project_project,group_portal_backend_timesheet,1,0,0,0
portal_timesheet_project_task,portal-timesheet-model_project_task,project.model_project_task,group_portal_backend_timesheet,1,1,0,0
portal_timesheet_resource_calendar,portal-timesheet-model_resource_calendar,resource.model_resource_calendar,group_portal_backend_timesheet,1,0,0,0
portal_timesheet_resource_calendar_attendance,portal-timesheet-model_resource_calendar_attendance,resource.model_resource_calendar_attendance,group_portal_backend_timesheet,1,0,0,0
portal_timesheet_resource_calendar_leaves,portal-timesheet-model_resource_calendar_leaves,resource.model_resource_calendar_leaves,group_portal_backend_timesheet,1,0,0,0
portal_timesheet_timer_timer,portal-timesheet-model_timer_timer,timer.model_timer_timer,group_portal_backend_timesheet,1,0,0,0
portal_timesheet_uom_category,portal-timesheet-model_uom_category,uom.model_uom_category,group_portal_backend_timesheet,1,0,0,0
portal_timesheet_uom_uom,portal-timesheet-model_uom_uom,uom.model_uom_uom,group_portal_backend_timesheet,1,0,0,0
12 changes: 12 additions & 0 deletions portal_timesheet/security/res_groups.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.module.category" id="category_portal_timesheet">
<field name="name">Portal Timesheet</field>
<field name="parent_id" ref="portal_backend.category_portal_advanced"/>
</record>

<record id="group_portal_backend_timesheet" model="res.groups">
<field name="name">Portal Timesheet</field>
<field name="category_id" ref="category_portal_timesheet"/>
</record>
</odoo>
10 changes: 10 additions & 0 deletions portal_timesheet/views/base_menus.xml
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="hr_timesheet.timesheet_menu_root" model="ir.ui.menu">
<field name="groups_id" eval="(4, ref('portal_timesheet.group_portal_backend_timesheet'))"/>
</record>

<record id="hr_timesheet.timesheet_menu_activity_user" model="ir.ui.menu">
<field name="groups_id" eval="(4, ref('portal_timesheet.group_portal_backend_timesheet'))"/>
</record>
</odoo>
16 changes: 16 additions & 0 deletions portal_timesheet/views/hr_employee_views.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Show portal users in employees -->
<record id="view_employee_form" model="ir.ui.view">
<field name="name">view.employee.form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='active_group']/field[@name='user_id']" position="attributes">
<attribute name="domain">[]</attribute>
</xpath>
</field>
</record>
</data>
</odoo>

0 comments on commit 55a38a2

Please sign in to comment.