Commit 0f788280 by François

WIP: Adaptations pour utilisation exclusive des services volants (pour…

WIP: Adaptations pour utilisation exclusive des services volants (pour implémentation règles la Cagette nouvelle version)
parent bce4a8a5
Pipeline #1292 failed with stage
in 1 minute 21 seconds
......@@ -46,7 +46,8 @@ function display_current_coop_form() {
// form.find('[name="barcode_base"]').val(current_coop.barcode_base);
form.find('[name="email"]').val(current_coop._id);
if (current_coop.shift_template &&
current_coop.shift_template.data.type == 2) {
current_coop.shift_template.data.type == 2 &&
typeof manage_ftop != "undefined" && manage_ftop == true) {
$('#choosen_shift input').hide();
ftop_shift.val('Volant');
ftop_shift.show();
......
......@@ -117,6 +117,7 @@ def prepa_odoo(request):
'ask_for_sex': getattr(settings, 'SUBSCRIPTION_ASK_FOR_SEX', False),
'ask_for_street2': getattr(settings, 'SUBSCRIPTION_ADD_STREET2', False),
'ask_for_second_phone': getattr(settings, 'SUBSCRIPTION_ADD_SECOND_PHONE', False),
'show_ftop_button': getattr(settings, 'SHOW_FTOP_BUTTON', True),
'db': settings.COUCHDB['dbs']['member']}
# with_addr_complement
......@@ -150,6 +151,7 @@ def validation_inscription(request, email):
'ask_for_sex': getattr(settings, 'SUBSCRIPTION_ASK_FOR_SEX', False),
'ask_for_street2': getattr(settings, 'SUBSCRIPTION_ADD_STREET2', False),
'ask_for_second_phone': getattr(settings, 'SUBSCRIPTION_ADD_SECOND_PHONE', False),
'show_ftop_button': getattr(settings, 'SHOW_FTOP_BUTTON', True),
'em_url': settings.EM_URL,
'WELCOME_ENTRANCE_MSG': settings.WELCOME_ENTRANCE_MSG,
'WELCOME_SUBTITLE_ENTRANCE_MSG': getattr(settings, 'WELCOME_SUBTITLE_ENTRANCE_MSG', '')}
......
......@@ -118,6 +118,10 @@
If True, in shift_template calendar choice view, "Volant" button is included
- USE_STANDARD_SHIFT = True (by default)
La Cagette use False to implement custom rules
### Scales and labels files generation
- DAV_PATH = '/data/dav/cagette'
......
......@@ -35,14 +35,13 @@ function get_shift_name(s_data) {
if (s_data && s_data.week) {
shift_name = weeks_name[s_data.week];
if (s_data.type == 2) {
if (s_data.type == 2 && typeof manage_ftop != "undefined" && manage_ftop == true) {
shift_name = 'Volant';
} else {
shift_name += s_data.day + ' - ' + s_data.begin;
shift_name += ' - ' + s_data.place;
}
}
return shift_name;
}
......
......@@ -120,6 +120,8 @@ class CagetteShift(models.Model):
def get_shift_ticket(self,idShift, in_ftop_team):
"""Récupérer le shift_ticket suivant le membre et flotant ou pas"""
if getattr(settings, 'USE_STANDARD_SHIFT', True) == False:
in_ftop_team = "True"
fields = ['shift_ticket_ids']
cond = [['id', "=", idShift]]
listeTicket = self.o_api.search_read('shift.shift', cond, fields)
......@@ -132,11 +134,14 @@ class CagetteShift(models.Model):
"""Shift registration"""
st_r_id = False
try:
shift_type = "standard"
if data['in_ftop_team'] == "True" or getattr(settings, 'USE_STANDARD_SHIFT', True) == False:
shift_type = "ftop"
fieldsDatas = { "partner_id": data['idPartner'],
"shift_id": data['idShift'],
"shift_ticket_id": self.get_shift_ticket(data['idShift'], data['in_ftop_team']),
"shift_type": "standard", # ftop
"related_shift_state": 'confirm',
"shift_type": shift_type,
"origin": 'memberspace',
"state": 'open'}
st_r_id = self.o_api.create('shift.registration', fieldsDatas)
......
......@@ -108,7 +108,7 @@ def get_list_shift_calendar(request, partner_id):
events = []
for value in listService:
events.append(value)
if value['shift_type_id'][0] == 1:
if value['shift_type_id'][0] == 1 or getattr(settings, 'USE_STANDARD_SHIFT', True) is False:
l = set(value['registration_ids']) & set(listRegisterPartner)
# if (int(value['seats_reserved']) == int(value['seats_max']) and len(l) > 0 ) or (int(value['seats_reserved']) < int(value['seats_max'])):
if (int(value['seats_available']) > 0 or len(l) > 0 ):
......
......@@ -20,6 +20,8 @@
{% if open_on_sunday %}
let open_on_sunday = true
{% endif %}
let manage_ftop = {% if show_ftop_button %}true{% else %}false{% endif %};
</script>
{% endblock %}
{% block content %}
......
......@@ -12,7 +12,7 @@
<script type="text/javascript">
var type = 2;
var context = 'validation';
let manage_ftop = {% if show_ftop_button %}true{% else %}false{% endif %};
</script>
{% endblock %}
{% block content %}
......
......@@ -17,6 +17,7 @@
history.pushState(null, null, location.pathname)
}
var coop = {{coop|safe}};
let manage_ftop = {% if show_ftop_button %}true{% else %}false{% endif %};
</script>
{% endblock %}
{% block content %}
......
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