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
a3056e04
Commit
a3056e04
authored
Jan 19, 2022
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: restore open order creaton alarm, but stop using template
parent
66e0b0e2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
216 additions
and
28 deletions
+216
-28
master/bt5/slapos_accounting/PathTemplateItem/portal_alarms/slapos_request_update_instance_tree_open_sale_order.xml
...s/slapos_request_update_instance_tree_open_sale_order.xml
+105
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateInstanceTreeOpenSaleOrder.py
...ccounting/Alarm_requestUpdateInstanceTreeOpenSaleOrder.py
+12
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateInstanceTreeOpenSaleOrder.xml
...counting/Alarm_requestUpdateInstanceTreeOpenSaleOrder.xml
+62
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py
...pos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py
+36
-28
master/bt5/slapos_accounting/bt/template_path_list
master/bt5/slapos_accounting/bt/template_path_list
+1
-0
No files found.
master/bt5/slapos_accounting/PathTemplateItem/portal_alarms/slapos_request_update_instance_tree_open_sale_order.xml
0 → 100644
View file @
a3056e04
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Alarm"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_requestUpdateInstanceTreeOpenSaleOrder
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_request_update_instance_tree_open_sale_order
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<tuple>
<int>
0
</int>
</tuple>
</value>
</item>
<item>
<key>
<string>
periodicity_hour_frequency
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple>
<int>
0
</int>
</tuple>
</value>
</item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_month_day
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_start_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
0.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
periodicity_week
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Updates Open Sale Order for Instance Tree which does not have correct OSO
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateInstanceTreeOpenSaleOrder.py
0 → 100644
View file @
a3056e04
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
method_id
=
'InstanceTree_requestUpdateOpenSaleOrder'
,
portal_type
=
"Instance Tree"
,
causality_state
=
"diverged"
,
activate_kw
=
{
'tag'
:
tag
,
'priority'
:
2
},
activity_count
=
10
,
packet_size
=
1
,
# InstanceTree_trigger_Person_storeOpenSaleOrderJournal
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateInstanceTreeOpenSaleOrder.xml
0 → 100644
View file @
a3056e04
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_requestUpdateInstanceTreeOpenSaleOrder
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py
View file @
a3056e04
...
...
@@ -19,33 +19,24 @@ def storeWorkflowComment(document, comment):
portal
.
portal_workflow
.
doActionFor
(
document
,
'edit_action'
,
comment
=
comment
)
def
newOpenOrder
(
open_sale_order
):
open_sale_order_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredOpenSaleOrderTemplate
())
open_order_edit_kw
=
{
'effective_date'
:
DateTime
(),
'activate_kw'
:
activate_kw
,
'source'
:
open_sale_order_template
.
getSource
(),
'source_section'
:
open_sale_order_template
.
getSourceSection
()
}
if
open_sale_order
is
None
:
new_open_sale_order
=
open_sale_order_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
open_order_edit_kw
.
update
({
'destination'
:
person
.
getRelativeUrl
(),
'destination_decision'
:
person
.
getRelativeUrl
(),
'title'
:
"%s SlapOS Subscription"
%
person
.
getTitle
(),
})
else
:
new_open_sale_order
=
open_sale_order
.
Base_createCloneDocument
(
batch_mode
=
1
)
open_sale_order
.
setExpirationDate
(
now
,
activate_kw
=
activate_kw
)
new_open_sale_order
.
edit
(
**
open_order_edit_kw
)
def
newOpenOrder
():
new_open_sale_order
=
portal
.
open_sale_order_module
.
newContent
(
portal_type
=
"Open Sale Order"
,
specialise
=
"sale_trade_condition_module/slapos_subscription_trade_condition"
,
effective_date
=
DateTime
(),
activate_kw
=
activate_kw
,
#source=open_sale_order_template.getSource(),
#source_section=open_sale_order_template.getSourceSection(),
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
title
=
"%s SlapOS Subscription"
%
person
.
getTitle
()
)
new_open_sale_order
.
order
(
activate_kw
=
activate_kw
)
new_open_sale_order
.
validate
(
activate_kw
=
activate_kw
)
return
new_open_sale_order
if
instance_tree
.
getCausalityState
()
==
'diverged'
:
raise
NotImplementedError
(
'Open Order must be manually selected by the user'
)
person
=
instance_tree
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
# Template document does not have person relation
if
person
is
not
None
:
...
...
@@ -74,14 +65,14 @@ if instance_tree.getCausalityState() == 'diverged':
# Let's create the open order
if
is_open_order_creation_needed
:
open_sale_order
=
newOpenOrder
(
None
)
open_sale_order
=
newOpenOrder
()
open_order_explanation
=
""
# Add lines
open_
sale_order_line_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredOpenSaleOrderLineTemplate
())
open_order_line
=
open_sale_order_line_template
.
Base_createCloneDocument
(
batch_mode
=
1
,
destination
=
open_sale_order
)
open_
order_line
=
open_sale_order
.
newContent
(
portal
_type
=
"Open Sale Order Line"
,
activate_kw
=
activate_kw
)
hosting_subscription
=
portal
.
hosting_subscription_module
.
newContent
(
portal_type
=
"Hosting Subscription"
,
title
=
instance_tree
.
getTitle
()
...
...
@@ -133,7 +124,24 @@ if instance_tree.getCausalityState() == 'diverged':
storeWorkflowComment
(
open_sale_order
,
open_order_explanation
)
if
open_order_line
is
not
None
:
open_order_line
.
getParentValue
().
OpenSaleOrder_updatePeriod
()
open_order
=
open_order_line
.
getParentValue
()
# Check compatibility with previous template
assert
open_order
.
getSourceSection
()
==
'organisation_module/slapos'
assert
open_order
.
getDestinationSection
()
==
'organisation_module/slapos'
assert
open_order
.
getSource
()
==
'organisation_module/slapos'
assert
open_order
.
getPriceCurrency
()
==
'currency_module/EUR'
assert
open_order
.
getSpecialise
()
==
'sale_trade_condition_module/slapos_subscription_trade_condition'
assert
open_order_line
.
getResource
()
==
'service_module/slapos_instance_subscription'
assert
open_order_line
.
getQuantityUnit
()
==
'unit/piece'
assert
open_order_line
.
getBaseContribution
()
==
'base_amount/invoicing/discounted'
assert
open_order_line
.
getBaseContributionList
()[
1
]
==
'base_amount/invoicing/taxable'
assert
open_order_line
.
getUse
()
==
'trade/sale'
assert
open_order_line
.
getPrice
()
==
1
assert
open_order_line
.
getQuantity
()
==
1
open_order
.
OpenSaleOrder_updatePeriod
()
# Person_storeOpenSaleOrderJournal should fix all divergent Instance Tree in one run
assert
instance_tree
.
getCausalityState
()
==
'solved'
master/bt5/slapos_accounting/bt/template_path_list
View file @
a3056e04
...
...
@@ -31,6 +31,7 @@ portal_alarms/slapos_deliver_started_aggregated_sale_packing_list
portal_alarms/slapos_manage_building_calculating_delivery
portal_alarms/slapos_reindex_open_sale_order
portal_alarms/slapos_remove_bogus_delivery_link
portal_alarms/slapos_request_update_instance_tree_open_sale_order
portal_alarms/slapos_start_confirmed_aggregated_sale_packing_list
portal_alarms/slapos_start_confirmed_aggregated_subscription_sale_packing_list
portal_alarms/slapos_stop_confirmed_aggregated_sale_invoice_transaction
...
...
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