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