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

TA#72124 [16.0][MIG] hr_working_space #74

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
"license": "LGPL-3",
"category": "Other",
"summary": "Install all addons required for testing.",
"depends": [
"hr",
],
"depends": ["hr_working_space"],
"installable": True,
}
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ RUN gitoo install-all --conf_file /gitoo.yml --destination "${THIRD_PARTY_ADDONS

USER odoo

COPY hr_working_space /mnt/extra-addons/hr_working_space

COPY .docker_files/main /mnt/extra-addons/main
COPY .docker_files/odoo.conf /etc/odoo
11 changes: 11 additions & 0 deletions hr_working_space/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HR Working Space
================
This module adds the management of working space at the check-in time.
It allows the manager to add working spaces.
The working spaces will be proposed to the employee instead of the check-in button in attendance.

![App Switcher](static/description/check-in.png?raw=true)

Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
4 changes: 4 additions & 0 deletions hr_working_space/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import models

Check notice on line 4 in hr_working_space/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hr_working_space/__init__.py#L4

'.models' imported but unused (F401)
28 changes: 28 additions & 0 deletions hr_working_space/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{

Check warning on line 4 in hr_working_space/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hr_working_space/__manifest__.py#L4

Statement seems to have no effect
'name': 'HR Working Space',
'version': '16.0.1.0.0',
'author': 'Numigi',
'maintainer': 'Numigi',
'license': 'LGPL-3',
'category': 'Other',
'summary': 'Specify a working space',
'depends': [
'hr_attendance',
],
'data': [
'views/hr_working_space.xml',
'views/hr_attendance.xml',
'security/ir.model.access.csv',
],
"assets": {
"web.assets_backend": [
"hr_working_space/static/src/js/working_space_my_attendances.js",
"hr_working_space/static/src/css/hr_working_space.css",
"hr_working_space/static/src/xml/working_space_attendance.xml",
],
},
'installable': True,
}
146 changes: 146 additions & 0 deletions hr_working_space/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_working_space
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-17 14:29+0000\n"
"PO-Revision-Date: 2018-10-17 10:31-0400\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 2.0.6\n"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space__active
msgid "Active"
msgstr "Active"

#. module: hr_working_space
#: model:ir.model,name:hr_working_space.model_hr_attendance
msgid "Attendance"
msgstr ""

#. module: hr_working_space
#. openerp-web
#: code:addons/hr_working_space/static/src/xml/working_space_attendance.xml:10
#, python-format
msgid "Click on a working space to check in"
msgstr "Noter l'arrivée en cliquant sur un espace de travail"

#. module: hr_working_space
#. openerp-web
#: code:addons/hr_working_space/static/src/xml/working_space_attendance.xml:18
#, python-format
msgid "Click to check out"
msgstr "Noter la sortie"

#. module: hr_working_space
#: model_terms:ir.actions.act_window,help:hr_working_space.action_hr_working_spaces_form
msgid "Click to define a new working space."
msgstr "Créer le premier espace de travail "

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space__create_uid
msgid "Created by"
msgstr "Créé par"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space__create_date
msgid "Created on"
msgstr "Créé le"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space__display_name
msgid "Display Name"
msgstr "Nom à afficher"

#. module: hr_working_space
#: model:ir.model,name:hr_working_space.model_hr_employee
msgid "Employee"
msgstr "Employé"

#. module: hr_working_space
#. openerp-web
#: code:addons/hr_working_space/static/src/js/working_space_my_attendances.js:28
#, python-format
msgid "Error : Could not find employee linked to user"
msgstr "Erreur : impossible de trouver l'employé associé à l'utilisateur"

#. module: hr_working_space
#. openerp-web
#: code:addons/hr_working_space/static/src/xml/working_space_attendance.xml:22
#, python-format
msgid "Error : Could not find employee linked to user."
msgstr "Erreur : impossible de trouver l'employé associé à l'utilisateur."

#. module: hr_working_space
#: model:ir.model.fields,help:hr_working_space.field_hr_working_space__icon
msgid ""
"Font Awesome code of the icon that will represent the working space. See "
"https://fontawesome.com/icons?d=gallery."
msgstr ""
"Le code Font Awesome qui représentera l'espace de travail. Voir https://"
"fontawesome.com/icons?d=gallery."

#. module: hr_working_space
#: model:ir.model,name:hr_working_space.model_hr_working_space
msgid "HR Working Space"
msgstr "RH Espace de Travail"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space__id
msgid "ID"
msgstr "ID"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space__icon
msgid "Icon"
msgstr "Icone"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space__write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space__write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_working_space__name
msgid "Name"
msgstr "Nom"

#. module: hr_working_space
#. openerp-web
#: code:addons/hr_working_space/static/src/xml/working_space_attendance.xml:8
#, python-format
msgid "Welcome"
msgstr "Bienvenu"

#. module: hr_working_space
#: model:ir.model.fields,field_description:hr_working_space.field_hr_attendance__working_space_id
#: model_terms:ir.ui.view,arch_db:hr_working_space.hr_working_space_view_filter
msgid "Working Space"
msgstr "Espace de travail"

#. module: hr_working_space
#: model:ir.actions.act_window,name:hr_working_space.action_hr_working_spaces_form
#: model:ir.ui.menu,name:hr_working_space.menu_action_warehouse_form
#: model_terms:ir.ui.view,arch_db:hr_working_space.view_hr_working_space_form
#: model_terms:ir.ui.view,arch_db:hr_working_space.view_hr_working_space_tree
msgid "Working Spaces"
msgstr "Espaces de travail"
5 changes: 5 additions & 0 deletions hr_working_space/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import hr_working_space

Check notice on line 4 in hr_working_space/models/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hr_working_space/models/__init__.py#L4

'.hr_working_space' imported but unused (F401)
from . import hr_attendance

Check notice on line 5 in hr_working_space/models/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hr_working_space/models/__init__.py#L5

'.hr_attendance' imported but unused (F401)
31 changes: 31 additions & 0 deletions hr_working_space/models/hr_attendance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class HRWorkingSpace(models.Model):
"""Add working spaces to attendance"""

_inherit = "hr.attendance"

working_space_id = fields.Many2one(
'hr.working.space', string='Working Space', required=True
)


class HREmployeeWorkingSpace(models.Model):
"""Add the management of the working space at the attendance."""

_inherit = 'hr.employee'

def attendance_manual_working_space(
self, next_action, working_space_id=None, entered_pin=None
):
res = self.attendance_manual(next_action, entered_pin=entered_pin)
if working_space_id:
attendance = self.env['hr.attendance'].search(
[('id', '=', res['action']['attendance']['id'])], limit=1
)
attendance.working_space_id = int(working_space_id)
return res
19 changes: 19 additions & 0 deletions hr_working_space/models/hr_working_space.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class HRAttendanceWithWorkingSpace(models.Model):
"""Basic definition of a workspace"""

_name = "hr.working.space"
_description = "HR Working Space"

active = fields.Boolean(string='Active', default=True)
name = fields.Char(string='Name', required=True)
icon = fields.Char(
"Icon",
help="Font Awesome code of the icon that will represent the working space. "
"See https://fontawesome.com/icons?d=gallery.",
)
4 changes: 4 additions & 0 deletions hr_working_space/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_working_space_erp_manager,access_hr_working_space,model_hr_working_space,base.group_erp_manager,1,1,1,1
access_hr_working_space_hr_manager,access_hr_working_space_hr_manager,model_hr_working_space,hr_attendance.group_hr_attendance_manager,1,1,1,1
access_hr_working_space,access_hr_working_space,model_hr_working_space,,1,0,0,0
Binary file added hr_working_space/static/description/check-in.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added hr_working_space/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions hr_working_space/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">Check-in With Working Spaces</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="check-in.png">
</div>
</div>
</div>
</section>
8 changes: 8 additions & 0 deletions hr_working_space/static/src/css/hr_working_space.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.o_hr_working_space_icon {
border: none;
color: white;
padding: 12px 16px;
font-size: 48px;
cursor: pointer;
width: 90px;
}
39 changes: 39 additions & 0 deletions hr_working_space/static/src/js/working_space_my_attendances.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
odoo.define("hr_working_space.working_space_my_attendances", (require) => {

Check notice on line 1 in hr_working_space/static/src/js/working_space_my_attendances.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hr_working_space/static/src/js/working_space_my_attendances.js#L1

'odoo' is not defined.
"use strict";

var core = require("web.core");
var AttendanceWidget = require('hr_attendance.my_attendances');

Check notice on line 5 in hr_working_space/static/src/js/working_space_my_attendances.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hr_working_space/static/src/js/working_space_my_attendances.js#L5

Strings must use doublequote.

AttendanceWidget.include({
events: _.extend({}, AttendanceWidget.prototype.events, {

Check notice on line 8 in hr_working_space/static/src/js/working_space_my_attendances.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hr_working_space/static/src/js/working_space_my_attendances.js#L8

'_' is not defined.
"click .o_hr_working_space_sign_in": function (event) {

Check warning on line 9 in hr_working_space/static/src/js/working_space_my_attendances.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hr_working_space/static/src/js/working_space_my_attendances.js#L9

Expected method shorthand.
this.sign_in_with_working_space(event);
},
}),
willStart() {
var def = this._rpc({
model: "hr.working.space",
method: "search_read",
fields: ["name", "icon"]
}).then((workingSpaces) => {
this.workingSpaces = workingSpaces;
});
return $.when(def, this._super.apply(this, arguments));
},
sign_in_with_working_space(event) {

Check notice on line 23 in hr_working_space/static/src/js/working_space_my_attendances.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hr_working_space/static/src/js/working_space_my_attendances.js#L23

Identifier 'sign_in_with_working_space' is not in camel case.
var workingSpaceID = event.target.id;
this._rpc({
model: "hr.employee",
method: "attendance_manual_working_space",
args: [[this.employee.id], "hr_attendance.hr_attendance_action_my_attendances", workingSpaceID]
})
.then((result) => {
if (result.action) {
this.do_action(result.action);
} else if (result.warning) {
this.do_warn(result.warning);
}
});
},
});
});
22 changes: 22 additions & 0 deletions hr_working_space/static/src/xml/working_space_attendance.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<template xml:space="preserve">

<t t-extend="HrAttendanceCheckInOutButtons">
<xpath t-jquery="button" t-operation="replace">
<t t-if="widget.workingSpaces">
<t t-foreach="widget.workingSpaces" t-as="working_space" t-if="!checked_in">
<i t-att-id="working_space.id"
t-att-title="working_space.name"
t-att-class="working_space.icon + ' fa-3x fa o_hr_working_space_sign_in btn btn-primary o_hr_working_space_icon'" />
</t>
<t t-if="checked_in">
<button t-attf-class="o_hr_attendance_sign_in_out_icon btn btn-{{ checked_in ? 'warning' : 'success' }} align-self-center px-5 py-3 mt-4 mb-2">
<span class="align-middle fs-2 ms-3">Check OUT</span>
</button>
</t>
</t>
</xpath>

</t>

</template>
38 changes: 38 additions & 0 deletions hr_working_space/views/hr_attendance.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="hr_attendance_with_working_space_form" model="ir.ui.view">
<field name="name">HR Attendance Form with working space</field>
<field name="model">hr.attendance</field>
<field name="inherit_id" ref="hr_attendance.hr_attendance_view_form" />
<field name="arch" type="xml">
<field name="employee_id" position="after">
<field name="working_space_id" />
</field>
</field>
</record>
<record id="hr_attendance_with_working_space_tree" model="ir.ui.view">
<field name="name">HR Attendance Tree with working space</field>
<field name="model">hr.attendance</field>
<field name="inherit_id" ref="hr_attendance.view_attendance_tree" />
<field name="arch" type="xml">
<field name="employee_id" position="after">
<field name="working_space_id" />
</field>
</field>
</record>

<record id="hr_working_space_view_filter" model="ir.ui.view">
<field name="inherit_id" ref="hr_attendance.hr_attendance_view_filter" />
<field name="name">HR Attendance filter with working space</field>
<field name="model">hr.attendance</field>
<field name="arch" type="xml">
<field name="department_id" position="after">
<field name="working_space_id" />
</field>
<filter name="groupby_name" position="after">
<filter name="groupby_working_space" string="Working Space" context="{'group_by':'working_space_id'}" />
</filter>
</field>
</record>

</odoo>
Loading
Loading