Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
1fc30fb1
Commit
1fc30fb1
authored
Oct 26, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
7 deletions
+8
-7
admin.py
members/admin.py
+0
-1
manage_makeups.js
members/static/js/admin/manage_makeups.js
+1
-2
members-space.js
members_space/static/js/members-space.js
+1
-1
config.md
outils/config.md
+4
-0
models.py
shifts/models.py
+2
-3
No files found.
members/admin.py
View file @
1fc30fb1
...
@@ -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"
]):
...
...
members/static/js/admin/manage_makeups.js
View file @
1fc30fb1
...
@@ -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
=
{
...
...
members_space/static/js/members-space.js
View file @
1fc30fb1
...
@@ -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
({
...
...
outils/config.md
View file @
1fc30fb1
...
@@ -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
...
...
shifts/models.py
View file @
1fc30fb1
...
@@ -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'
]
...
@@ -396,7 +395,7 @@ class CagetteShift(models.Model):
...
@@ -396,7 +395,7 @@ class CagetteShift(models.Model):
"date_stop"
:
ending_date
.
isoformat
(),
"date_stop"
:
ending_date
.
isoformat
(),
"name"
:
ext_name
"name"
:
ext_name
}
}
response
=
self
.
o_api
.
create
(
'shift.extension'
,
fields
)
response
=
self
.
o_api
.
create
(
'shift.extension'
,
fields
)
return
response
return
response
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment