Browse Source

[ADD] Default information from worker

pull/105/head
nicolasjamoulle 6 years ago
committed by Elouan
parent
commit
a883beaffe
  1. 22
      beesdoo_shift/wizard/subscribe.py

22
beesdoo_shift/wizard/subscribe.py

@ -26,6 +26,24 @@ class Subscribe(models.TransientModel):
else:
return date
def _get_info_session_date(self):
date = self.env['res.partner'].browse(self._context.get('active_id'))\
.info_session_date
if not date:
return False
elif not self._get_info_session_followed():
return False
else:
return date
def _get_info_session_followed(self):
session_followed = self.env['res.partner']\
.browse(self._context.get('active_id')).info_session
if not session_followed:
return False
else:
return session_followed
def _get_super(self):
return self.env['res.partner'].browse(self._context.get('active_id')).super
@ -36,8 +54,8 @@ class Subscribe(models.TransientModel):
partner = self.env['res.partner'].browse(self._context.get('active_id'))
return partner.state == 'unsubscribed' and partner.working_mode == 'regular'
info_session = fields.Boolean(string="Followed an information session", default=False)
info_session_date = fields.Date(string="Date of information session")
info_session = fields.Boolean(string="Followed an information session", default=_get_info_session_followed)
info_session_date = fields.Date(string="Date of information session", default=_get_info_session_date)
super = fields.Boolean(string="Super Cooperator", default=_get_super)
working_mode = fields.Selection(
[

Loading…
Cancel
Save