Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Zheng
slapos.core
Commits
17686abf
Commit
17686abf
authored
Aug 25, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Use new API to check if the user has something to Pay
parent
f55ffdc7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.py
...s/slapos_crm/Person_checkToCreateRegularisationRequest.py
+1
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIfPersonBalanceIsOk.py
...rm/RegularisationRequest_invalidateIfPersonBalanceIsOk.py
+2
-2
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
...ents/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
+11
-11
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.py
View file @
17686abf
...
@@ -19,7 +19,7 @@ ticket = portal.portal_catalog.getResultValue(
...
@@ -19,7 +19,7 @@ ticket = portal.portal_catalog.getResultValue(
default_source_project_uid
=
person
.
getUid
(),
default_source_project_uid
=
person
.
getUid
(),
simulation_state
=
[
'suspended'
,
'validated'
],
simulation_state
=
[
'suspended'
,
'validated'
],
)
)
if
(
ticket
is
None
)
and
int
(
person
.
Entity_stat
Balance
())
>
0
:
if
(
ticket
is
None
)
and
int
(
person
.
Entity_stat
OutstandingAmount
())
>
0
:
tag
=
"%s_addRegularisationRequest_inProgress"
%
person
.
getUid
()
tag
=
"%s_addRegularisationRequest_inProgress"
%
person
.
getUid
()
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIfPersonBalanceIsOk.py
View file @
17686abf
...
@@ -6,7 +6,7 @@ state = context.getSimulationState()
...
@@ -6,7 +6,7 @@ state = context.getSimulationState()
person
=
context
.
getSourceProjectValue
(
portal_type
=
"Person"
)
person
=
context
.
getSourceProjectValue
(
portal_type
=
"Person"
)
if
(
state
!=
'suspended'
)
or
\
if
(
state
!=
'suspended'
)
or
\
(
person
is
None
)
or
\
(
person
is
None
)
or
\
(
int
(
person
.
Entity_stat
Balance
())
>
0
):
(
int
(
person
.
Entity_stat
OutstandingAmount
())
>
0
):
return
return
else
:
else
:
context
.
invalidate
(
comment
=
"Automatically disabled as balance is %s"
%
person
.
Entity_stat
Balance
())
context
.
invalidate
(
comment
=
"Automatically disabled as balance is %s"
%
person
.
Entity_stat
OutstandingAmount
())
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
View file @
17686abf
...
@@ -30,7 +30,7 @@ import difflib
...
@@ -30,7 +30,7 @@ import difflib
class
TestSlapOSPerson_checkToCreateRegularisationRequest
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSPerson_checkToCreateRegularisationRequest
(
SlapOSTestCaseMixinWithAbort
):
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "1"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_payment_requested
(
self
):
def
test_addRegularisationRequest_payment_requested
(
self
):
for
preference
in
\
for
preference
in
\
self
.
portal
.
portal_catalog
(
portal_type
=
"System Preference"
):
self
.
portal
.
portal_catalog
(
portal_type
=
"System Preference"
):
...
@@ -84,7 +84,7 @@ The slapos team
...
@@ -84,7 +84,7 @@ The slapos team
'assert reference == "slapos-crm.create.regularisation.request"
\
n
'
\
'assert reference == "slapos-crm.create.regularisation.request"
\
n
'
\
'return context.restrictedTraverse('
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_addRegularisationRequest_notification_message"])'
)
'context.REQUEST["test_addRegularisationRequest_notification_message"])'
)
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "1"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_notification_message
(
self
):
def
test_addRegularisationRequest_notification_message
(
self
):
for
preference
in
\
for
preference
in
\
self
.
portal
.
portal_catalog
(
portal_type
=
"System Preference"
):
self
.
portal
.
portal_catalog
(
portal_type
=
"System Preference"
):
...
@@ -143,7 +143,7 @@ The slapos team
...
@@ -143,7 +143,7 @@ The slapos team
# ticket2 = person.Person_checkToCreateRegularisationRequest()
# ticket2 = person.Person_checkToCreateRegularisationRequest()
# self.assertEqual(ticket.getRelativeUrl(), ticket2.getRelativeUrl())
# self.assertEqual(ticket.getRelativeUrl(), ticket2.getRelativeUrl())
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "1"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_do_not_duplicate_ticket_if_not_reindexed
(
self
):
def
test_addRegularisationRequest_do_not_duplicate_ticket_if_not_reindexed
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
...
@@ -154,7 +154,7 @@ The slapos team
...
@@ -154,7 +154,7 @@ The slapos team
self
.
assertEqual
(
ticket2
,
None
)
self
.
assertEqual
(
ticket2
,
None
)
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "0"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "0"'
)
@
simulate
(
'RegularisationRequest_checkToSendUniqEvent'
,
@
simulate
(
'RegularisationRequest_checkToSendUniqEvent'
,
'*args, **kwargs'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
'raise NotImplementedError, "Should not have been called"'
)
...
@@ -164,7 +164,7 @@ The slapos team
...
@@ -164,7 +164,7 @@ The slapos team
self
.
assertEqual
(
ticket
,
None
)
self
.
assertEqual
(
ticket
,
None
)
self
.
assertEqual
(
event
,
None
)
self
.
assertEqual
(
event
,
None
)
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "1"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_existing_suspended_ticket
(
self
):
def
test_addRegularisationRequest_existing_suspended_ticket
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
...
@@ -176,7 +176,7 @@ The slapos team
...
@@ -176,7 +176,7 @@ The slapos team
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "1"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_existing_validated_ticket
(
self
):
def
test_addRegularisationRequest_existing_validated_ticket
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
...
@@ -189,7 +189,7 @@ The slapos team
...
@@ -189,7 +189,7 @@ The slapos team
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "1"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_existing_invalidated_ticket
(
self
):
def
test_addRegularisationRequest_existing_invalidated_ticket
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
=
person
.
Person_checkToCreateRegularisationRequest
()[
0
]
ticket
=
person
.
Person_checkToCreateRegularisationRequest
()[
0
]
...
@@ -226,7 +226,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
...
@@ -226,7 +226,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
,
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
,
REQUEST
=
{})
REQUEST
=
{})
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "0"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "0"'
)
def
test_invalidateIfPersonBalanceIsOk_matching_case
(
self
):
def
test_invalidateIfPersonBalanceIsOk_matching_case
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
=
self
.
createRegularisationRequest
()
...
@@ -236,7 +236,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
...
@@ -236,7 +236,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
()
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
()
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'invalidated'
)
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'invalidated'
)
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "0"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "0"'
)
def
test_invalidateIfPersonBalanceIsOk_not_suspended
(
self
):
def
test_invalidateIfPersonBalanceIsOk_not_suspended
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
=
self
.
createRegularisationRequest
()
...
@@ -245,7 +245,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
...
@@ -245,7 +245,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
()
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
()
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'validated'
)
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'validated'
)
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "0"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "0"'
)
def
test_invalidateIfPersonBalanceIsOk_no_person
(
self
):
def
test_invalidateIfPersonBalanceIsOk_no_person
(
self
):
ticket
=
self
.
createRegularisationRequest
()
ticket
=
self
.
createRegularisationRequest
()
ticket
.
validate
()
ticket
.
validate
()
...
@@ -253,7 +253,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
...
@@ -253,7 +253,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
()
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
()
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'suspended'
)
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "1"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_invalidateIfPersonBalanceIsOk_wrong_balance
(
self
):
def
test_invalidateIfPersonBalanceIsOk_wrong_balance
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
=
self
.
createRegularisationRequest
()
...
...
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