Browse Source

[ADD] Holiday wizard

pull/105/head
Thibault Francois 7 years ago
committed by Elouan
parent
commit
98d84f4bbd
  1. 1
      beesdoo_shift/__openerp__.py
  2. 12
      beesdoo_shift/models/cooperative_status.py
  3. 3
      beesdoo_shift/views/cooperative_status.xml
  4. 3
      beesdoo_shift/wizard/__init__.py
  5. 2
      beesdoo_shift/wizard/extension.py
  6. 15
      beesdoo_shift/wizard/holiday.py
  7. 20
      beesdoo_shift/wizard/holiday.xml

1
beesdoo_shift/__openerp__.py

@ -33,5 +33,6 @@
"wizard/assign_super_coop.xml",
"wizard/subscribe.xml",
"wizard/extension.xml",
"wizard/holiday.xml",
],
}

12
beesdoo_shift/models/cooperative_status.py

@ -225,5 +225,17 @@ class ResPartner(models.Model):
res['context'] = {'default_auto': True}
res['name'] = _('Trigger Grace Delay')
return res
@api.multi
def register_holiday(self):
return {
'name': _('Register Holiday'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'beesdoo.shift.holiday',
'target': 'new',
}
#TODO access right + vue on res.partner
#TODO can_shop : Status can_shop ou extempted ou part C

3
beesdoo_shift/views/cooperative_status.xml

@ -26,6 +26,9 @@
<button name="coop_unsubscribe" string="Unsubscribe" class="oe_highlight"
type="object" groups="beesdoo_shift.group_shift_management"
attrs="{'invisible': [('cooperator_type', '!=', 'share_a')]}"/>
<button name="register_holiday" string="Register Holidays" class="oe_highlight"
type="object" groups="beesdoo_shift.group_shift_management"
attrs="{'invisible': ['|', ('cooperator_type', '!=', 'share_a'), ('state', '!=', 'ok')]}"/>
<field name="state" widget="statusbar" attrs="{'invisible': [('cooperator_type', '!=', 'share_a')]}" />
</header>
</xpath>

3
beesdoo_shift/wizard/__init__.py

@ -2,4 +2,5 @@ import instanciate_planning
import batch_template
import assign_super_coop
import subscribe
import extension
import extension
import holiday

2
beesdoo_shift/wizard/extension.py

@ -33,5 +33,3 @@ class Subscribe(models.TransientModel):
if today_delay < 0:
raise UserError(_('You should not start a manual extension during the grace delay'))
status_id.sudo().write({'time_extension': self.extension_days + today_delay})
#TO continue

15
beesdoo_shift/wizard/holiday.py

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api, _
class Subscribe(models.TransientModel):
_name = 'beesdoo.shift.holiday'
_inherit = 'beesdoo.shift.action_mixin'
holiday_start_day = fields.Date(string="Start date for the holiday", default=fields.Date.today)
holiday_end_day = fields.Date(string="End date for the holiday (included)")
@api.multi
def holidays(self):
self = self._check() #maybe a different group
status_id = self.env['cooperative.status'].search([('cooperator_id', '=', self.cooperator_id.id)])
status_id.sudo().write({'holiday_start_time': self.holiday_start_day, 'holiday_end_time': self.holiday_end_day})

20
beesdoo_shift/wizard/holiday.xml

@ -0,0 +1,20 @@
<odoo>
<record model="ir.ui.view" id="holiday_coop_wizard_view_form">
<field name="name">Holiday Management</field>
<field name="model">beesdoo.shift.holiday</field>
<field name="arch" type="xml">
<form>
<field name="cooperator_id" invisible="1"/>
<group>
<field name="holiday_start_day" />
<field name="holiday_end_day" />
</group>
<footer>
<button type="object" name="holidays"
string="Confirm" class="oe_highlight" />
<button special="cancel" string="Cancel" />
</footer>
</form>
</field>
</record>
</odoo>
Loading…
Cancel
Save