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
Roque
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
Hide 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(
default_source_project_uid
=
person
.
getUid
(),
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
()
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()
person
=
context
.
getSourceProjectValue
(
portal_type
=
"Person"
)
if
(
state
!=
'suspended'
)
or
\
(
person
is
None
)
or
\
(
int
(
person
.
Entity_stat
Balance
())
>
0
):
(
int
(
person
.
Entity_stat
OutstandingAmount
())
>
0
):
return
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
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
):
for
preference
in
\
self
.
portal
.
portal_catalog
(
portal_type
=
"System Preference"
):
...
...
@@ -84,7 +84,7 @@ The slapos team
'assert reference == "slapos-crm.create.regularisation.request"
\
n
'
\
'return context.restrictedTraverse('
\
'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
):
for
preference
in
\
self
.
portal
.
portal_catalog
(
portal_type
=
"System Preference"
):
...
...
@@ -143,7 +143,7 @@ The slapos team
# ticket2 = person.Person_checkToCreateRegularisationRequest()
# 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
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
...
...
@@ -154,7 +154,7 @@ The slapos team
self
.
assertEqual
(
ticket2
,
None
)
self
.
assertEqual
(
event2
,
None
)
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "0"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "0"'
)
@
simulate
(
'RegularisationRequest_checkToSendUniqEvent'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
...
...
@@ -164,7 +164,7 @@ The slapos team
self
.
assertEqual
(
ticket
,
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
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
...
...
@@ -176,7 +176,7 @@ The slapos team
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
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
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
...
...
@@ -189,7 +189,7 @@ The slapos team
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
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
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
=
person
.
Person_checkToCreateRegularisationRequest
()[
0
]
...
...
@@ -226,7 +226,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
,
REQUEST
=
{})
@
simulate
(
'Entity_stat
Balance
'
,
'*args, **kwargs'
,
'return "0"'
)
@
simulate
(
'Entity_stat
OutstandingAmount
'
,
'*args, **kwargs'
,
'return "0"'
)
def
test_invalidateIfPersonBalanceIsOk_matching_case
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
...
...
@@ -236,7 +236,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
()
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
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
...
...
@@ -245,7 +245,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
()
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
):
ticket
=
self
.
createRegularisationRequest
()
ticket
.
validate
()
...
...
@@ -253,7 +253,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket
.
RegularisationRequest_invalidateIfPersonBalanceIsOk
()
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
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
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