16.0 dev recup #5

Open
LaetitiaElabore wants to merge 10 commits from 16.0-dev-recup into 16.0
13 changed files with 324 additions and 0 deletions
Showing only changes of commit 5d118259a3 - Show all commits

View File

@@ -0,0 +1,50 @@
=====================================
hr_employee_stats_sheet_lunch_voucher
=====================================
Summary
=======
Description
===========
Installation
============
Use Odoo normal module installation procedure to install
``hr_employee_stats_sheet_lunch_voucher``.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/hr_employee_stats_sheet_lunch_voucher/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
=======
Contributors
------------
* `Elabore <mailto:laetitia.dacosta@elabore.coop>`
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,20 @@
{
"name": "hr_employee_stats_sheet_lunch_voucher",
"version": "16.0.1.0.0",
"description": "Add global sheet for employee stats",
"summary": "Add global sheet for employee stats",
"author": "Elabore",
"website": "https://elabore.coop",
"license": "LGPL-3",
"category": "Human Resources",
"depends": [
"hr_employee_stats_sheet",
],
"data": [
"views/hr_employee_stats.xml",
"views/hr_timesheet_sheet.xml",
"views/res_config_settings_views.xml",
],
"installable": True,
"application": False,
}

View File

@@ -0,0 +1,86 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_employee_stats_sheet_lunch_voucher
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-06-11 13:19+0000\n"
"PO-Revision-Date: 2025-06-11 13:19+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model.fields,help:hr_employee_stats_sheet_lunch_voucher.field_res_config_settings__lunch_voucher_min_worked_hours
msgid ""
"5h by default, meaning that if an employee works 5h or more in a day, he "
"will get a lunch voucher"
msgstr "5h par défaut"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model_terms:ir.ui.view,arch_db:hr_employee_stats_sheet_lunch_voucher.res_config_settings_view_form
msgid ""
"<span class=\"fa fa-lg fa-building\" title=\"Minimal number of hours worked "
"in a day to get a lunch voucher.\" groups=\"base.group_multi_company\"/>"
msgstr ""
"<span class=\"fa fa-lg fa-building\" title=\"Nombre minimal d'heures travaillées "
"dans une journée pour cumuler un prime repas.\" groups=\"base.group_multi_company\"/>"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model,name:hr_employee_stats_sheet_lunch_voucher.model_res_company
msgid "Companies"
msgstr "Sociétés"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model,name:hr_employee_stats_sheet_lunch_voucher.model_res_config_settings
msgid "Config Settings"
msgstr "Paramètres de configuration"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model,name:hr_employee_stats_sheet_lunch_voucher.model_hr_employee_stats
msgid "Employee Stats"
msgstr "Statistique de l'employé·e"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model_terms:ir.ui.view,arch_db:hr_employee_stats_sheet_lunch_voucher.res_config_settings_view_form
msgid ""
"Indicate the minimal number of hours worked in a day to get a lunch voucher "
"(by default 5 hours)."
msgstr "Indiquez le nombre d'heures minimal pour cumuler une prime repas/ticket restaurant"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model.fields,field_description:hr_employee_stats_sheet_lunch_voucher.field_hr_employee_stats__lunch_voucher
msgid "Lunch Voucher"
msgstr "Ticket restaurant"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model.fields,field_description:hr_employee_stats_sheet_lunch_voucher.field_res_company__lunch_voucher_min_worked_hours
msgid "Lunch Voucher Min Worked Hours"
msgstr "Prime repas Nombre d'heures minimal"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model.fields,field_description:hr_employee_stats_sheet_lunch_voucher.field_hr_timesheet_sheet__lunch_voucher_count
#: model_terms:ir.ui.view,arch_db:hr_employee_stats_sheet_lunch_voucher.hr_timesheet_sheet_tree_lunch_voucher_inherit
#: model_terms:ir.ui.view,arch_db:hr_employee_stats_sheet_lunch_voucher.timesheet_sheet_form_lunch_voucher_inherit
msgid "Lunch voucher Count"
msgstr "Nombre de ticket restaurant"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model.fields,field_description:hr_employee_stats_sheet_lunch_voucher.field_res_config_settings__lunch_voucher_min_worked_hours
msgid "Minimal number of hours worked in a day to get a lunch voucher"
msgstr "Nombre d'heures minimal pour cumuler une prime repas/ticket restaurant"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model,name:hr_employee_stats_sheet_lunch_voucher.model_hr_timesheet_sheet
msgid "Timesheet Sheet"
msgstr "Feuille de temps"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model_terms:ir.ui.view,arch_db:hr_employee_stats_sheet_lunch_voucher.hr_employee_stats_tree_lunch_voucher_inherit
msgid "Total"
msgstr ""

View File

@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_employee_stats_sheet_lunch_voucher
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-05 13:34+0000\n"
"PO-Revision-Date: 2025-05-05 13:34+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model,name:hr_employee_stats_sheet_lunch_voucher.model_hr_employee_stats
msgid "Employee Stats"
msgstr ""
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model.fields,field_description:hr_employee_stats_sheet_lunch_voucher.field_hr_employee_stats__lunch_voucher
msgid "Lunch Voucher"
msgstr ""
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model.fields,field_description:hr_employee_stats_sheet_lunch_voucher.field_hr_timesheet_sheet__lunch_voucher_count
#: model_terms:ir.ui.view,arch_db:hr_employee_stats_sheet_lunch_voucher.hr_timesheet_sheet_stats_overview_view_sikle_inherit
msgid "Lunch voucher Count"
msgstr ""
#. module: hr_employee_stats_sheet_lunch_voucher
#: model:ir.model,name:hr_employee_stats_sheet_lunch_voucher.model_hr_timesheet_sheet
msgid "Timesheet Sheet"
msgstr ""
#. module: hr_employee_stats_sheet_lunch_voucher
#: model_terms:ir.ui.view,arch_db:hr_employee_stats_sheet_lunch_voucher.view_hr_employee_stats_tree_sikle_inherit
msgid "Total"
msgstr ""

View File

@@ -0,0 +1 @@
from . import hr_employee_stats, hr_timesheet_sheet, res_config, res_company

View File

@@ -0,0 +1,19 @@
from odoo import fields, models, api
class HrEmployeeStats(models.Model):
_inherit = "hr.employee.stats"
lunch_voucher = fields.Integer("Lunch Voucher", compute="_compute_lunch_voucher")
@api.depends("total_hours")
def _compute_lunch_voucher(self):
for stat in self:
stat.lunch_voucher = 0
if stat.date and stat.employee_id:
stat._get_lunch_voucher()
def _get_lunch_voucher(self):
#do not factorize this method with _compute_lunch_voucher to be used in other modules
self.ensure_one()
if self.total_hours >= self.env.company.lunch_voucher_min_worked_hours:
self.lunch_voucher = 1

View File

@@ -0,0 +1,15 @@
from odoo import fields, models, api
class HrTimesheetSheet(models.Model):
_inherit = "hr_timesheet.sheet"
lunch_voucher_count = fields.Integer("Lunch voucher Count", compute="_compute_lunch_voucher_count")
@api.depends("employee_stats_ids.lunch_voucher")
def _compute_lunch_voucher_count(self):
for sheet in self:
sheet.lunch_voucher_count = 0
if sheet.employee_stats_ids:
for stat in sheet.employee_stats_ids:
sheet.lunch_voucher_count += stat.lunch_voucher

View File

@@ -0,0 +1,7 @@
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
lunch_voucher_min_worked_hours = fields.Float(default=5)

View File

@@ -0,0 +1,14 @@
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
lunch_voucher_min_worked_hours = fields.Float(
related="company_id.lunch_voucher_min_worked_hours",
required=True,
string="Minimal number of hours worked in a day to get a lunch voucher",
domain="[('company_id', '=', company_id)]",
readonly=False,
help="5h by default, meaning that if an employee works 5h or more in a day, he will get a lunch voucher",
)

View File

@@ -0,0 +1,12 @@
<odoo>
<record id="hr_employee_stats_tree_lunch_voucher_inherit" model="ir.ui.view">
<field name="name">hr.employee.stats.tree.lunch.voucher.inherit</field>
<field name="model">hr.employee.stats</field>
<field name="inherit_id" ref="hr_employee_stats_sheet.view_hr_employee_stats_tree"/>
<field name="arch" type="xml">
<field name="total_hours" position="after">
<field name="lunch_voucher" sum="Total"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,22 @@
<odoo>
<record id="timesheet_sheet_form_lunch_voucher_inherit" model="ir.ui.view">
<field name="name">timesheet.sheet.form.lunch.voucher.inherit</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="department_id" position="after">
<field name="lunch_voucher_count" string="Lunch voucher Count" />
</field>
</field>
</record>
<record id="hr_timesheet_sheet_tree_lunch_voucher_inherit" model="ir.ui.view">
<field name="name">hr.timesheet.sheet.tree.lunch.voucher.inherit</field>
<field name="model">hr_timesheet.sheet</field>
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_tree" />
<field name="arch" type="xml">
<field name="department_id" position="after">
<field name="lunch_voucher_count" string="Lunch voucher Count" />
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,35 @@
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.hr.timesheet</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="55" />
<field name="inherit_id" ref="hr_timesheet.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@name='hr_timesheet_sheet']" position="inside">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="lunch_voucher_min_worked_hours"/>
<span
class="fa fa-lg fa-building"
title="Minimal number of hours worked in a day to get a lunch voucher."
groups="base.group_multi_company"
/>
<div class="text-muted">
Indicate the minimal number of hours worked in a day to get a lunch voucher (by default 5 hours).
</div>
<div class="content-group">
<div class="mb16">
<field
name="lunch_voucher_min_worked_hours"
class="o_light_label"
widget="float"
required="1"
/>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>