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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
646d5bf5
Commit
646d5bf5
authored
Jan 13, 2025
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: create regularisation request for organisations
Stop and delete b2b services
parent
f8b48a03
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
250 additions
and
86 deletions
+250
-86
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_createRegularisationRequest.py
...tal_skins/slapos_crm/Alarm_createRegularisationRequest.py
+7
-7
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_invalidateSuspendedRegularisationRequest.py
...pos_crm/Alarm_invalidateSuspendedRegularisationRequest.py
+2
-2
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Entity_checkToCreateRegularisationRequest.py
...s/slapos_crm/Entity_checkToCreateRegularisationRequest.py
+0
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Entity_checkToCreateRegularisationRequest.xml
.../slapos_crm/Entity_checkToCreateRegularisationRequest.xml
+1
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_deleteInstanceTreeList.py
...lapos_crm/RegularisationRequest_deleteInstanceTreeList.py
+5
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIfEntityBalanceIsOk.py
...rm/RegularisationRequest_invalidateIfEntityBalanceIsOk.py
+3
-3
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIfEntityBalanceIsOk.xml
...m/RegularisationRequest_invalidateIfEntityBalanceIsOk.xml
+1
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_stopInstanceTreeList.py
.../slapos_crm/RegularisationRequest_stopInstanceTreeList.py
+38
-10
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerAcknowledgmentEscalation.py
.../RegularisationRequest_triggerAcknowledgmentEscalation.py
+1
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerDeleteReminderEscalation.py
.../RegularisationRequest_triggerDeleteReminderEscalation.py
+1
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerStopAcknowledgmentEscalation.py
...ularisationRequest_triggerStopAcknowledgmentEscalation.py
+1
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerStopReminderEscalation.py
...rm/RegularisationRequest_triggerStopReminderEscalation.py
+1
-1
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+183
-52
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
...mponents/test.erp5.testSlapOSERP5VirtualMasterScenario.py
+6
-2
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_createRegularisationRequest.py
View file @
646d5bf5
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
person
_uid_list
=
[]
entity
_uid_list
=
[]
for
(
_
,
brain
)
in
enumerate
(
portal
.
portal_simulation
.
getInventoryList
(
for
(
_
,
brain
)
in
enumerate
(
portal
.
portal_simulation
.
getInventoryList
(
simulation_state
=
(
'stopped'
,
'delivered'
),
simulation_state
=
(
'stopped'
,
'delivered'
),
group_by_mirror_section
=
True
,
group_by_mirror_section
=
True
,
...
@@ -10,16 +10,16 @@ for (_, brain) in enumerate(portal.portal_simulation.getInventoryList(
...
@@ -10,16 +10,16 @@ for (_, brain) in enumerate(portal.portal_simulation.getInventoryList(
grouping_reference
=
None
grouping_reference
=
None
)):
)):
section_uid
=
brain
.
getDestinationSectionUid
(
portal_type
=
"Person"
)
section_uid
=
brain
.
getDestinationSectionUid
(
portal_type
=
[
"Person"
,
"Organisation"
]
)
if
section_uid
is
not
None
:
if
section_uid
is
not
None
:
person
_uid_list
.
append
(
section_uid
)
entity
_uid_list
.
append
(
section_uid
)
if
person
_uid_list
:
if
entity
_uid_list
:
portal
.
portal_catalog
.
searchAndActivate
(
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Person"
,
portal_type
=
[
"Person"
,
"Organisation"
]
,
validation_state
=
"validated"
,
validation_state
=
"validated"
,
uid
=
person
_uid_list
,
uid
=
entity
_uid_list
,
method_id
=
'
Person
_checkToCreateRegularisationRequest'
,
method_id
=
'
Entity
_checkToCreateRegularisationRequest'
,
activate_kw
=
{
'tag'
:
tag
}
activate_kw
=
{
'tag'
:
tag
}
)
)
context
.
activate
(
after_tag
=
tag
).
getId
()
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_invalidateSuspendedRegularisationRequest.py
View file @
646d5bf5
...
@@ -2,7 +2,7 @@ portal = context.getPortalObject()
...
@@ -2,7 +2,7 @@ portal = context.getPortalObject()
portal
.
portal_catalog
.
searchAndActivate
(
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Regularisation Request"
,
portal_type
=
"Regularisation Request"
,
simulation_state
=
[
"suspended"
,
"validated"
],
simulation_state
=
[
"suspended"
,
"validated"
],
method_id
=
'RegularisationRequest_invalidateIf
Person
BalanceIsOk'
,
method_id
=
'RegularisationRequest_invalidateIf
Entity
BalanceIsOk'
,
activate_kw
=
{
'tag'
:
tag
}
activate_kw
=
{
'tag'
:
tag
}
)
)
context
.
activate
(
after_tag
=
tag
).
getId
()
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/
Person
_checkToCreateRegularisationRequest.py
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/
Entity
_checkToCreateRegularisationRequest.py
View file @
646d5bf5
File moved
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/
Person
_checkToCreateRegularisationRequest.xml
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/
Entity
_checkToCreateRegularisationRequest.xml
View file @
646d5bf5
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person
_checkToCreateRegularisationRequest
</string>
</value>
<value>
<string>
Entity
_checkToCreateRegularisationRequest
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_deleteInstanceTreeList.py
View file @
646d5bf5
...
@@ -4,9 +4,9 @@ if REQUEST is not None:
...
@@ -4,9 +4,9 @@ if REQUEST is not None:
ticket
=
context
ticket
=
context
state
=
ticket
.
getSimulationState
()
state
=
ticket
.
getSimulationState
()
person
=
ticket
.
getDestinationDecisionValue
(
portal_type
=
"Person"
)
entity
=
ticket
.
getDestinationDecisionValue
(
portal_type
=
[
"Person"
,
"Organisation"
]
)
if
(
state
==
'suspended'
)
and
\
if
(
state
==
'suspended'
)
and
\
(
person
is
not
None
)
and
\
(
entity
is
not
None
)
and
\
(
ticket
.
getResource
()
==
'service_module/slapos_crm_delete_acknowledgement'
):
(
ticket
.
getResource
()
==
'service_module/slapos_crm_delete_acknowledgement'
):
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
...
@@ -14,16 +14,17 @@ if (state == 'suspended') and \
...
@@ -14,16 +14,17 @@ if (state == 'suspended') and \
ledger_uid
=
portal
.
portal_categories
.
ledger
.
automated
.
getUid
()
ledger_uid
=
portal
.
portal_categories
.
ledger
.
automated
.
getUid
()
# Gather the list of not paid services
# Gather the list of not paid services
for
outstanding_amount
in
person
.
Entity_getOutstandingAmountList
(
for
outstanding_amount
in
entity
.
Entity_getOutstandingAmountList
(
ledger_uid
=
ledger_uid
,
ledger_uid
=
ledger_uid
,
include_planned
=
True
include_planned
=
True
):
):
for
outstanding_invoice
in
person
.
Entity_getOutstandingAmountList
(
for
outstanding_invoice
in
entity
.
Entity_getOutstandingAmountList
(
section_uid
=
outstanding_amount
.
getSourceSectionUid
(),
section_uid
=
outstanding_amount
.
getSourceSectionUid
(),
resource_uid
=
outstanding_amount
.
getPriceCurrencyUid
(),
resource_uid
=
outstanding_amount
.
getPriceCurrencyUid
(),
ledger_uid
=
outstanding_amount
.
getLedgerUid
(),
ledger_uid
=
outstanding_amount
.
getLedgerUid
(),
group_by_node
=
False
group_by_node
=
False
):
):
person
=
outstanding_invoice
.
getDestinationValue
(
portal_type
=
"Person"
)
subscribed_item
=
None
subscribed_item
=
None
for
invoice_line
in
outstanding_invoice
.
getMovementList
(
for
invoice_line
in
outstanding_invoice
.
getMovementList
(
portal_type
=
[
'Invoice Line'
,
'Invoice Cell'
]
portal_type
=
[
'Invoice Line'
,
'Invoice Cell'
]
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIf
Person
BalanceIsOk.py
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIf
Entity
BalanceIsOk.py
View file @
646d5bf5
...
@@ -3,10 +3,10 @@ if REQUEST is not None:
...
@@ -3,10 +3,10 @@ if REQUEST is not None:
raise
Unauthorized
raise
Unauthorized
state
=
context
.
getSimulationState
()
state
=
context
.
getSimulationState
()
person
=
context
.
getDestinationDecisionValue
(
portal_type
=
"Person"
)
entity
=
context
.
getDestinationDecisionValue
(
portal_type
=
[
"Person"
,
"Organisation"
]
)
if
(
state
not
in
(
'suspended'
,
'validated'
))
or
\
if
(
state
not
in
(
'suspended'
,
'validated'
))
or
\
(
person
is
None
):
(
entity
is
None
):
return
return
if
not
person
.
Entity_hasOutstandingAmount
(
ledger_uid
=
context
.
getPortalObject
().
portal_categories
.
ledger
.
automated
.
getUid
()):
if
not
entity
.
Entity_hasOutstandingAmount
(
ledger_uid
=
context
.
getPortalObject
().
portal_categories
.
ledger
.
automated
.
getUid
()):
context
.
invalidate
(
comment
=
"Automatically disabled as balance is ok"
)
context
.
invalidate
(
comment
=
"Automatically disabled as balance is ok"
)
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIf
Person
BalanceIsOk.xml
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIf
Entity
BalanceIsOk.xml
View file @
646d5bf5
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
RegularisationRequest_invalidateIf
Person
BalanceIsOk
</string>
</value>
<value>
<string>
RegularisationRequest_invalidateIf
Entity
BalanceIsOk
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_stopInstanceTreeList.py
View file @
646d5bf5
...
@@ -4,19 +4,47 @@ if REQUEST is not None:
...
@@ -4,19 +4,47 @@ if REQUEST is not None:
ticket
=
context
ticket
=
context
state
=
ticket
.
getSimulationState
()
state
=
ticket
.
getSimulationState
()
person
=
ticket
.
getDestinationDecisionValue
(
portal_type
=
"Person"
)
entity
=
ticket
.
getDestinationDecisionValue
(
portal_type
=
[
"Person"
,
"Organisation"
]
)
if
(
state
==
'suspended'
)
and
\
if
(
state
==
'suspended'
)
and
\
(
person
is
not
None
)
and
\
(
entity
is
not
None
)
and
\
(
ticket
.
getResource
()
in
[
'service_module/slapos_crm_stop_acknowledgement'
,
'service_module/slapos_crm_delete_reminder'
,
'service_module/slapos_crm_delete_acknowledgement'
]):
(
ticket
.
getResource
()
in
[
'service_module/slapos_crm_stop_acknowledgement'
,
'service_module/slapos_crm_delete_reminder'
,
'service_module/slapos_crm_delete_acknowledgement'
]):
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Instance Tree"
,
ledger_uid
=
portal
.
portal_categories
.
ledger
.
automated
.
getUid
()
validation_state
=
[
"validated"
],
# Gather the list of not paid services
destination_section__uid
=
person
.
getUid
(),
for
outstanding_amount
in
entity
.
Entity_getOutstandingAmountList
(
method_id
=
'InstanceTree_stopFromRegularisationRequest'
,
ledger_uid
=
ledger_uid
,
method_args
=
(
person
.
getRelativeUrl
(),),
include_planned
=
True
activate_kw
=
{
'tag'
:
tag
}
):
)
for
outstanding_invoice
in
entity
.
Entity_getOutstandingAmountList
(
section_uid
=
outstanding_amount
.
getSourceSectionUid
(),
resource_uid
=
outstanding_amount
.
getPriceCurrencyUid
(),
ledger_uid
=
outstanding_amount
.
getLedgerUid
(),
group_by_node
=
False
):
person
=
outstanding_invoice
.
getDestinationValue
(
portal_type
=
"Person"
)
subscribed_item
=
None
for
invoice_line
in
outstanding_invoice
.
getMovementList
(
portal_type
=
[
'Invoice Line'
,
'Invoice Cell'
]
):
hosting_subscription
=
invoice_line
.
getAggregateValue
(
portal_type
=
'Hosting Subscription'
)
if
hosting_subscription
is
not
None
:
subscribed_item
=
invoice_line
.
getAggregateValue
(
portal_type
=
[
'Project'
,
'Instance Tree'
,
'Compute Node'
])
if
subscribed_item
is
None
:
raise
NotImplementedError
(
'Unhandled invoice line %s'
%
invoice_line
.
getRelativeUrl
())
if
(
subscribed_item
.
getPortalType
()
==
'Instance Tree'
):
# change the slap state to stopped, to allow propagation of the state
# even on remote node
subscribed_item
.
InstanceTree_stopFromRegularisationRequest
(
person
.
getRelativeUrl
())
if
subscribed_item
is
None
:
raise
NotImplementedError
(
'Unhandled invoice %s'
%
outstanding_invoice
.
getRelativeUrl
())
return
True
return
True
return
False
return
False
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerAcknowledgmentEscalation.py
View file @
646d5bf5
...
@@ -23,7 +23,7 @@ return context.RegularisationRequest_checkToTriggerNextEscalationStep(
...
@@ -23,7 +23,7 @@ return context.RegularisationRequest_checkToTriggerNextEscalationStep(
comment
=
'Stopping reminder.'
,
comment
=
'Stopping reminder.'
,
notification_message
=
"slapos-crm.acknowledgment.escalation"
,
notification_message
=
"slapos-crm.acknowledgment.escalation"
,
substitution_method_parameter_dict
=
{
substitution_method_parameter_dict
=
{
'user_name'
:
context
.
getDestination
Sect
ionTitle
(),
'user_name'
:
context
.
getDestination
Decis
ionTitle
(),
'days'
:
ndays
'days'
:
ndays
}
}
)
)
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerDeleteReminderEscalation.py
View file @
646d5bf5
...
@@ -23,7 +23,7 @@ return context.RegularisationRequest_checkToTriggerNextEscalationStep(
...
@@ -23,7 +23,7 @@ return context.RegularisationRequest_checkToTriggerNextEscalationStep(
comment
=
'Deleting acknowledgment.'
,
comment
=
'Deleting acknowledgment.'
,
notification_message
=
"slapos-crm.delete.reminder.escalation"
,
notification_message
=
"slapos-crm.delete.reminder.escalation"
,
substitution_method_parameter_dict
=
{
substitution_method_parameter_dict
=
{
'user_name'
:
context
.
getDestination
Sect
ionTitle
(),
'user_name'
:
context
.
getDestination
Decis
ionTitle
(),
'days'
:
ndays
'days'
:
ndays
}
}
)
)
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerStopAcknowledgmentEscalation.py
View file @
646d5bf5
...
@@ -22,7 +22,7 @@ return context.RegularisationRequest_checkToTriggerNextEscalationStep(
...
@@ -22,7 +22,7 @@ return context.RegularisationRequest_checkToTriggerNextEscalationStep(
comment
=
'Deleting reminder.'
,
comment
=
'Deleting reminder.'
,
notification_message
=
"slapos-crm.stop.acknowledgment.escalation"
,
notification_message
=
"slapos-crm.stop.acknowledgment.escalation"
,
substitution_method_parameter_dict
=
{
substitution_method_parameter_dict
=
{
'user_name'
:
context
.
getDestination
Sect
ionTitle
(),
'user_name'
:
context
.
getDestination
Decis
ionTitle
(),
'days'
:
ndays
'days'
:
ndays
}
}
)
)
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerStopReminderEscalation.py
View file @
646d5bf5
...
@@ -23,7 +23,7 @@ return context.RegularisationRequest_checkToTriggerNextEscalationStep(
...
@@ -23,7 +23,7 @@ return context.RegularisationRequest_checkToTriggerNextEscalationStep(
comment
=
'Stopping acknowledgment.'
,
comment
=
'Stopping acknowledgment.'
,
notification_message
=
"slapos-crm.stop.reminder.escalation"
,
notification_message
=
"slapos-crm.stop.reminder.escalation"
,
substitution_method_parameter_dict
=
{
substitution_method_parameter_dict
=
{
'user_name'
:
context
.
getDestination
Sect
ionTitle
(),
'user_name'
:
context
.
getDestination
Decis
ionTitle
(),
'days'
:
ndays
'days'
:
ndays
}
}
)
)
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
646d5bf5
This diff is collapsed.
Click to expand it.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
646d5bf5
...
@@ -157,7 +157,9 @@ class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin):
...
@@ -157,7 +157,9 @@ class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin):
# required to generate accounting report
# required to generate accounting report
price_currency_value
=
currency
,
price_currency_value
=
currency
,
# required to calculate the vat
# required to calculate the vat
default_address_region
=
'europe/west/france'
default_address_region
=
'europe/west/france'
,
# required email to send events
default_email_url_string
=
'test@example.org'
)
)
seller_bank_account
=
seller_organisation
.
newContent
(
seller_bank_account
=
seller_organisation
.
newContent
(
portal_type
=
"Bank Account"
,
portal_type
=
"Bank Account"
,
...
@@ -553,7 +555,9 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -553,7 +555,9 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
portal_type
=
'Organisation'
,
portal_type
=
'Organisation'
,
title
=
'TestOrganisation Section %s'
%
self
.
generateNewId
(),
title
=
'TestOrganisation Section %s'
%
self
.
generateNewId
(),
default_address_region
=
'europe/west/france'
,
default_address_region
=
'europe/west/france'
,
vat_code
=
self
.
generateNewId
()
vat_code
=
self
.
generateNewId
(),
# required email to send events
default_email_url_string
=
'test@example.org'
)
)
customer_section_organisation
.
validate
()
customer_section_organisation
.
validate
()
...
...
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