Commit 1fc30fb1 by François C.

Fix syntax error and add EXTENSION_TYPE_ID to fit with supercoop db

parent a2dca96f
Pipeline #2464 passed with stage
in 1 minute 38 seconds
......@@ -447,7 +447,6 @@ def regenerate_member_delay(request):
duration = raw_data["duration"]
ext_name = "Délai étendue depuis l'admin BDM"
res["create_delay"] = cs.create_delay(data=data, duration=duration, ext_name=ext_name)
if (res["create_delay"]):
......
......@@ -352,9 +352,8 @@ function extend_member_delay(member) {
let today = new Date();
let today_plus_extension_duration = new Date();
today_plus_extension_duration.setMonth(today_plus_extension_duration.getMonth()+ extension_duration);
const diff_time = Math.abs(today_extension_duration - today);
const diff_time = Math.abs(today_plus_extension_duration - today);
const diff_days = Math.ceil(diff_time / (1000 * 60 * 60 * 24));
let data = {
......
......@@ -142,7 +142,7 @@ function request_delay() {
let today_plus_extension_duration = new Date();
today_plus_extension_duration.setMonth(today_plus_extension_duration.getMonth()+ extension_duration);
const diff_time = Math.abs(today_extension_duration - today);
const diff_time = Math.abs(today_plus_extension_duration - today);
const diff_days = Math.ceil(diff_time / (1000 * 60 * 60 * 24));
$.ajax({
......
......@@ -350,6 +350,10 @@
By default, False.
- EXTENSION_TYPE_ID = 6
By default 1. Extension type id (from shift_extension_type table) used to create extension
### Reception
- RECEPTION_ADD_ADMIN_MODE = True
......
......@@ -345,7 +345,6 @@ class CagetteShift(models.Model):
fields = ['extension_ids']
partner_extensions = self.o_api.search_read('res.partner', cond, fields)
response = False
# If has extensions
if 'extension_ids' in partner_extensions[0]:
# Look for current extension: started before today and ends after
......@@ -378,7 +377,7 @@ class CagetteShift(models.Model):
else:
# Get the 'Extension' type id
extension_types = self.o_api.search_read('shift.extension.type')
ext_type_id = 1 # Default
ext_type_id = getattr(settings, 'EXTENSION_TYPE_ID', 1)
for val in extension_types:
if val['name'] == 'Extension':
ext_type_id = val['id']
......@@ -396,7 +395,7 @@ class CagetteShift(models.Model):
"date_stop": ending_date.isoformat(),
"name": ext_name
}
response = self.o_api.create('shift.extension', fields)
return response
......
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