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
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
829a89eb
Commit
829a89eb
authored
Jun 02, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Only launch activities for persons with Started Payment Transactions
It is the only sign of debt the user could have.
parent
8eaffd51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
16 deletions
+79
-16
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_createRegularisationRequest.py
...tal_skins/slapos_crm/Alarm_createRegularisationRequest.py
+2
-4
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+77
-12
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_createRegularisationRequest.py
View file @
829a89eb
portal
=
context
.
getPortalObject
()
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
NegatedQuery
# XXX TODO: use getInventory to directly fetch user with a wrong balance
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Person"
,
validation_state
=
"validated"
,
reference
=
NegatedQuery
(
SimpleQuery
(
reference
=
None
))
,
de
fault_email_text
=
NegatedQuery
(
SimpleQuery
(
default_email_text
=
None
))
,
destination_section_related__portal_type
=
"Payment Transaction"
,
de
stination_section_related__simulation_state
=
"started"
,
method_id
=
'Person_checkToCreateRegularisationRequest'
,
activate_kw
=
{
'tag'
:
tag
}
)
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
829a89eb
# Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved.
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2021 Nexedi SA and Contributors.
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
#
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
\
SlapOSTestCaseMixin
,
SlapOSTestCaseMixinWithAbort
from
unittest
import
skip
...
...
@@ -10,41 +31,85 @@ class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
new_id
=
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
title
=
"Test person %s"
%
new_id
,
reference
=
"TESTPERS_%s"
%
new_id
,
default_email_text
=
"%s@example.org"
%
new_id
,
title
=
"Test person %s"
%
new_id
)
person
.
validate
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment Transaction for TestSlapOSCRMCreateRegularisationRequest person %s"
%
new_id
,
destination_section
=
person
.
getRelativeUrl
(),
start_date
=
DateTime
()
)
payment
.
confirm
()
payment
.
start
()
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
slapos_crm_create_regularisation_request
self
.
_test_alarm
(
alarm
,
person
,
"Person_checkToCreateRegularisationRequest"
)
def
test_alarm_no
_email
(
self
):
def
test_alarm_no
t_validated
(
self
):
new_id
=
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
title
=
"Test person %s"
%
new_id
,
reference
=
"TESTPERS_%s"
%
new_id
,
title
=
"Test person %s"
%
new_id
)
person
.
validate
()
person
.
invalidate
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment Transaction for TestSlapOSCRMCreateRegularisationRequest person %s"
%
new_id
,
destination_section
=
person
.
getRelativeUrl
(),
start_date
=
DateTime
()
)
payment
.
confirm
()
payment
.
start
()
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
slapos_crm_create_regularisation_request
self
.
_test_alarm_not_visited
(
alarm
,
person
,
"Person_checkToCreateRegularisationRequest"
)
def
test_alarm_
not_validat
ed
(
self
):
def
test_alarm_
payment_stopp
ed
(
self
):
new_id
=
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
title
=
"Test person %s"
%
new_id
,
reference
=
"TESTPERS_%s"
%
new_id
,
default_email_text
=
"%s@example.org"
%
new_id
,
title
=
"Test person %s"
%
new_id
)
person
.
validate
()
person
.
invalidate
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment Transaction for TestSlapOSCRMCreateRegularisationRequest person %s"
%
new_id
,
destination_section
=
person
.
getRelativeUrl
(),
start_date
=
DateTime
()
)
payment
.
confirm
()
payment
.
start
()
payment
.
stop
()
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
slapos_crm_create_regularisation_request
self
.
_test_alarm_not_visited
(
alarm
,
person
,
"Person_checkToCreateRegularisationRequest"
)
def
test_alarm_payment_confirmed
(
self
):
new_id
=
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
title
=
"Test person %s"
%
new_id
)
person
.
validate
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment Transaction for TestSlapOSCRMCreateRegularisationRequest person %s"
%
new_id
,
destination_section
=
person
.
getRelativeUrl
(),
start_date
=
DateTime
()
)
payment
.
confirm
()
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
...
...
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