Commit 866532a2 by François C.

WIP: Gestion des absences et retards (nouvelles règles La Cagette)

parent 6ad0f139
# -*- coding: utf-8 -*-
from . import models
\ No newline at end of file
# -*- coding: utf-8 -*-
{
'name': "La Cagette - Membership",
'summary': """
Tuning membership rules""",
'description': """
""",
'author': "fracolo",
'website': "https://lacagette-coop.fr",
#
'category': 'Uncategorized',
'version': '0.0.2',
# any module necessary for this one to work correctly
'depends': ['base', 'coop_shift'],
# always loaded
'data': [
'data/ir_cron.xml',
# 'ir_config_parameter_data.xml'
],
'installable': True,
}
<?xml version="1.0"?>
<!--
Copyright (C) 2021 - Today Cooperatic
Author : fracolo
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record forcecreate="True" id="cron_ending_abcd_shift_preiod" model="ir.cron">
<field name="name">Ending ABCD shift period</field>
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 20:00:00')"/>
<field name="doall" eval="False"/>
<field name="model" eval="'shift.registration'"/>
<field name="function" eval="'send_shift_missing_emails'"/>
<field name="args" eval="'()'"/>
<field name="active" eval="False"/>
<field name="priority">2</field>
</record>
</odoo>
\ No newline at end of file
# -*- coding: utf-8 -*-
from . import res_partner
from . import shift_registration
\ No newline at end of file
# -*- coding: utf-8 -*-
from openerp import _, api, models, fields
class ResPartner(models.Model):
_inherit = 'res.partner'
# Columns Section
makeups_to_do = fields.Integer(
"Number of make-ups to done",
default= 0)
\ No newline at end of file
# -*- coding: utf-8 -*-
from openerp import _, api, models, fields
import logging
_logger = logging.getLogger(__name__)
class ShiftRegistration(models.Model):
_inherit = 'shift.registration'
is_late = fields.Boolean(
"Was the registration validated within grace period ?",
default= False)
is_makeup = fields.Boolean(
"Is this registration a consequence of a makeup to do",
default= False)
@api.multi
def write(self, vals):
res = super(ShiftRegistration, self).write(vals)
if 'state' in vals and vals['state'] == 'excused':
if self.ids:
for s in self.env['shift.registration']\
.search([('id', 'in', self.ids)]):
new_makeups_to_do = s.partner_id.makeups_to_do + 1
s.partner_id.update({'makeups_to_do': new_makeups_to_do})
return res
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment