Skip to content

Commit

Permalink
[MIG] shift_attendance: migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
remytms committed Dec 5, 2024
1 parent 0866f19 commit ba20230
Show file tree
Hide file tree
Showing 18 changed files with 746 additions and 492 deletions.
1 change: 1 addition & 0 deletions setup/shift_attendance/odoo/addons/shift_attendance
6 changes: 6 additions & 0 deletions setup/shift_attendance/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 3 additions & 3 deletions shift_attendance/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Shift Attendance Sheet
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-beescoop%2FObeesdoo-lightgray.png?logo=github
:target: https://github.com/beescoop/Obeesdoo/tree/12.0/shift_attendance
:target: https://github.com/beescoop/Obeesdoo/tree/16.0/shift_attendance
:alt: beescoop/Obeesdoo

|badge1| |badge2| |badge3|
Expand Down Expand Up @@ -46,7 +46,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/beescoop/Obeesdoo/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/beescoop/Obeesdoo/issues/new?body=module:%20shift_attendance%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/beescoop/Obeesdoo/issues/new?body=module:%20shift_attendance%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand All @@ -68,6 +68,6 @@ Contributors
Maintainers
~~~~~~~~~~~

This module is part of the `beescoop/Obeesdoo <https://github.com/beescoop/Obeesdoo/tree/12.0/shift_attendance>`_ project on GitHub.
This module is part of the `beescoop/Obeesdoo <https://github.com/beescoop/Obeesdoo/tree/16.0/shift_attendance>`_ project on GitHub.

You are welcome to contribute.
4 changes: 1 addition & 3 deletions shift_attendance/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Elouan Le Bars, Coop IT Easy SC, Odoo Community Association (OCA)",
"website": "https://github.com/beescoop/Obeesdoo",
"category": "Cooperative management",
"version": "12.0.2.0.0",
"version": "16.0.1.0.0",
"depends": [
"eater",
"member_card",
Expand All @@ -35,6 +35,4 @@
"demo/workers.xml",
],
"license": "AGPL-3",
"pre_init_hook": "rename_beesdoo",
"post_init_hook": "post_init",
}
59 changes: 29 additions & 30 deletions shift_attendance/data/cron.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
<odoo>
<data noupdate="1">
<record id="ir_cron_generate_attendance_sheet" model="ir.cron">
<field name="name">Generate Attendance Sheets</field>
<field name="model_id" ref="model_shift_sheet" />
<field name="state">code</field>
<field name="code">model._generate_attendance_sheet()</field>
<field name="user_id" ref="base.user_root" />
<field name="interval_number">4</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="active" eval="False" />
</record>
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="ir_cron_generate_attendance_sheet" model="ir.cron">
<field name="name">Generate Attendance Sheets</field>
<field name="model_id" ref="model_shift_sheet" />
<field name="state">code</field>
<field name="code">model._generate_attendance_sheet()</field>
<field name="user_id" ref="base.user_root" />
<field name="interval_number">4</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="active" eval="False" />
</record>

<record id="ir_cron_check_non_validated_sheet" model="ir.cron">
<field name="name">Check for non-validated sheets</field>
<field name="model_id" ref="model_shift_sheet" />
<field name="state">code</field>
<field name="code">model._cron_non_validated_sheets()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field
name="nextcall"
eval="datetime.now().replace(hour=00, minute=00, second=10)"
/>
<field name="active" eval="False" />
</record>
</data>
<record id="ir_cron_check_non_validated_sheet" model="ir.cron">
<field name="name">Check for non-validated sheets</field>
<field name="model_id" ref="model_shift_sheet" />
<field name="state">code</field>
<field name="code">model._cron_non_validated_sheets()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field
name="nextcall"
eval="datetime.now().replace(hour=00, minute=00, second=10)"
/>
<field name="active" eval="False" />
</record>
</odoo>
200 changes: 99 additions & 101 deletions shift_attendance/data/mail_template.xml
Original file line number Diff line number Diff line change
@@ -1,126 +1,124 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<odoo noupdate="1">
<!-- Mail template are declared in a NOUPDATE block
so users can freely customize/delete them -->
<data noupdate="1">
<record id="email_template_non_attendance" model="mail.template">
<field name="name">Shift Non-attendance</field>
<field name="subject">Non-attendance to your last shift.</field>
<field
name="partner_to"
>${object.replaced_id.id or object.worker_id.id|safe}</field>
<field name="model_id" ref="shift.model_shift_shift" />
<field name="auto_delete" eval="True" />
<field name="lang">${object.worker_id.lang}</field>
<field
name="body_html"
><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<record id="email_template_non_attendance" model="mail.template">
<field name="name">Shift Non-attendance</field>
<field name="subject">Non-attendance to your last shift.</field>
<field
name="partner_to"
>${object.replaced_id.id or object.worker_id.id|safe}</field>
<field name="model_id" ref="shift.model_shift_shift" />
<field name="auto_delete" eval="True" />
<field name="lang">${object.worker_id.lang}</field>
<field
name="body_html"
><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
% if object.replaced_id:
<p>Hello ${object.replaced_id.name},
% if object.replaced_id:
<p>Hello ${object.replaced_id.name},
<br><br>You have been recorded as non-attended during your last shift (${format_tz(object.start_time,object.replaced_id.tz or 'Europe/Brussels','%d.%m.%Y - %H:%M')}),
and you were supposed to replace ${object.worker_id.name}.
% endif
<br><br>You have been recorded as non-attended during your last shift (${format_tz(object.start_time,object.replaced_id.tz or 'Europe/Brussels','%d.%m.%Y - %H:%M')}),
and you were supposed to replace ${object.worker_id.name}.
% endif
% if not object.replaced_id:
</p><p>Hello ${object.worker_id.name},</p>
% if not object.replaced_id:
</p><p>Hello ${object.worker_id.name},</p>
<p>You have been recorded as non-attended during your last shift (${format_tz(object.start_time,object.worker_id.tz or 'Europe/Brussels','%d.%m.%Y - %H:%M')}).
% endif
<p>You have been recorded as non-attended during your last shift (${format_tz(object.start_time,object.worker_id.tz or 'Europe/Brussels','%d.%m.%Y - %H:%M')}).
% endif
% if object.worker_id.working_mode == 'regular':
% if object.state == 'absent_0':
<br><br>Super-cooperator assigned you 0 compensation, so you won't have any additionnal shift to do before your next regular shift.
% endif
% if object.state == 'absent_1':
<br><br>Super-cooperator assigned you 1 compensation, so you have to attend one additionnal shift before your next regular shift.
% endif
% if object.state == 'absent_2':
<br><br>Super-cooperator assigned you 2 compensations, so you have to attend two additionnal shifts before your next regular shift.
% endif
% if object.worker_id.working_mode == 'regular':
% if object.state == 'absent_0':
<br><br>Super-cooperator assigned you 0 compensation, so you won't have any additionnal shift to do before your next regular shift.
% endif
% if object.state == 'absent_1':
<br><br>Super-cooperator assigned you 1 compensation, so you have to attend one additionnal shift before your next regular shift.
% endif
% if object.state == 'absent_2':
<br><br>Super-cooperator assigned you 2 compensations, so you have to attend two additionnal shifts before your next regular shift.
% endif
% if object.replaced_id:
You were supposed to replace ${object.worker_id.name}.
You have to do ${(object.replaced_id.cooperative_status_ids.sr + object.replaced_id.cooperative_status_ids.sc) * -1 } shifts before your next regular shift.<br>
% else:
You have to do ${(object.worker_id.cooperative_status_ids.sr + object.worker_id.cooperative_status_ids.sc) * -1 } shifts before your next regular shift.<br>
% endif
% if object.replaced_id:
You were supposed to replace ${object.worker_id.name}.
You have to do ${(object.replaced_id.cooperative_status_ids.sr + object.replaced_id.cooperative_status_ids.sc) * -1 } shifts before your next regular shift.<br>
% else:
You have to do ${(object.worker_id.cooperative_status_ids.sr + object.worker_id.cooperative_status_ids.sc) * -1 } shifts before your next regular shift.<br>
% endif
% endif
% if object.worker_id.working_mode == 'irregular':
Your shift counter is at ${object.worker_id.cooperative_status_ids.sr}.
% if object.worker_id.working_mode == 'irregular':
Your shift counter is at ${object.worker_id.cooperative_status_ids.sr}.
% if object.worker_id.cooperative_status_ids.future_alert_date:
It should be superior or equal to 1 before the
${object.worker_id.cooperative_status_ids.future_alert_date}.
% endif
<br>
% endif
% if object.worker_id.cooperative_status_ids.future_alert_date:
It should be superior or equal to 1 before the
${object.worker_id.cooperative_status_ids.future_alert_date}.
% endif
<br>
% endif
% if object.replaced_id:
Your current status is "${object.replaced_id.cooperative_status_ids.get_status_value()}".
% else:
<br><br>Your current status is "${object.worker_id.cooperative_status_ids.get_status_value()}".
% endif
% if object.replaced_id:
Your current status is "${object.replaced_id.cooperative_status_ids.get_status_value()}".
% else:
<br><br>Your current status is "${object.worker_id.cooperative_status_ids.get_status_value()}".
% endif
<br>If you have any question regarding this non-attendance, just answer this e-mail.
</p>
<br>
<p>Cooperatively yours,<br>
The Members' office volunteers</p>
<p>${object.worker_id.company_id.name}.</p>
<br>If you have any question regarding this non-attendance, just answer this e-mail.
</p>
<br>
<p>Cooperatively yours,<br>
The Members' office volunteers</p>
<p>${object.worker_id.company_id.name}.</p>
% if object.worker_id.company_id.street:
${object.worker_id.company_id.street}
% endif
% if object.worker_id.company_id.street2:
${object.worker_id.company_id.street2}<br>
% endif
% if object.worker_id.company_id.city or object.worker_id.company_id.zip:
${object.worker_id.company_id.zip} ${object.worker_id.company_id.city}<br>
% endif
% if object.worker_id.company_id.country_id:
${object.worker_id.company_id.state_id and ('%s, ' % object.worker_id.company_id.state_id.name) or ''} ${object.worker_id.company_id.country_id.name or ''}<br>
% endif
% if object.worker_id.company_id.phone:
Phone:&nbsp; ${object.worker_id.company_id.phone}
% endif
% if object.worker_id.company_id.street:
${object.worker_id.company_id.street}
% endif
% if object.worker_id.company_id.street2:
${object.worker_id.company_id.street2}<br>
% endif
% if object.worker_id.company_id.city or object.worker_id.company_id.zip:
${object.worker_id.company_id.zip} ${object.worker_id.company_id.city}<br>
% endif
% if object.worker_id.company_id.country_id:
${object.worker_id.company_id.state_id and ('%s, ' % object.worker_id.company_id.state_id.name) or ''} ${object.worker_id.company_id.country_id.name or ''}<br>
% endif
% if object.worker_id.company_id.phone:
Phone:&nbsp; ${object.worker_id.company_id.phone}
% endif
% if object.worker_id.company_id.website:
<div>
Web :&nbsp;<a href="${object.worker_id.company_id.website}">${object.worker_id.company_id.website}</a>
</div>
%endif
% if object.worker_id.company_id.logo_url:
% if object.worker_id.company_id.website:
<div>
<img src="${object.worker_id.company_id.logo_url}">
Web :&nbsp;<a href="${object.worker_id.company_id.website}">${object.worker_id.company_id.website}</a>
</div>
%endif
%endif
% if object.worker_id.company_id.logo_url:
<div>
<img src="${object.worker_id.company_id.logo_url}">
</div>
]]></field>
</record>
%endif
</div>
]]></field>
</record>

<record id="email_template_non_validated_sheet" model="mail.template">
<field name="name">Non-validated sheet</field>
<field
name="subject"
>[${object.day}] Non-validated sheet ${object.time_slot} </field>
<field name="model_id" ref="model_shift_sheet" />
<field name="auto_delete" eval="True" />
<field
name="body_html"
><![CDATA[
<record id="email_template_non_validated_sheet" model="mail.template">
<field name="name">Non-validated sheet</field>
<field
name="subject"
>[${object.day}] Non-validated sheet ${object.time_slot} </field>
<field name="model_id" ref="model_shift_sheet" />
<field name="auto_delete" eval="True" />
<field
name="body_html"
><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>${object.day}
<br/><br/>The attendance sheet for ${object.time_slot} is not validated.
<br/><br/>Please, do it as soon as possible so as to update workers' status.
</p>
<p>${object.day}
<br/><br/>The attendance sheet for ${object.time_slot} is not validated.
<br/><br/>Please, do it as soon as possible so as to update workers' status.
</p>
</div>
]]></field>
</record>
</data>
]]></field>
</record>
</odoo>
25 changes: 9 additions & 16 deletions shift_attendance/data/system_parameter.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<record id="param_card_support" model="ir.config_parameter">
<field name="key">shift_attendance.card_support</field>
<field name="value">False</field>
</record>
<record
id="param_attendance_sheet_generation_interval"
model="ir.config_parameter"
>
<field
name="key"
>shift_attendance.attendance_sheet_generation_interval</field>
<field name="value">15</field>
</record>
</data>
<odoo noupdate="1">
<record id="param_card_support" model="ir.config_parameter">
<field name="key">shift_attendance.card_support</field>
<field name="value">False</field>
</record>
<record id="param_attendance_sheet_generation_interval" model="ir.config_parameter">
<field name="key">shift_attendance.attendance_sheet_generation_interval</field>
<field name="value">15</field>
</record>
</odoo>
Loading

0 comments on commit ba20230

Please sign in to comment.