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
d7ba4285
Commit
d7ba4285
authored
Jan 10, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alarm to update the open order line period.
parent
9c2cd8a1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
398 additions
and
1 deletion
+398
-1
master/bt5/slapos_accounting/CatalogRelatedKeyTemplateItem/related_key_list.xml
...unting/CatalogRelatedKeyTemplateItem/related_key_list.xml
+3
-0
master/bt5/slapos_accounting/PathTemplateItem/portal_alarms/slapos_update_open_sale_order_period.xml
...em/portal_alarms/slapos_update_open_sale_order_period.xml
+107
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateOpenSaleOrderPeriod.xml
...pos_accounting/Alarm_requestUpdateOpenSaleOrderPeriod.xml
+75
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.xml
...al_skins/slapos_accounting/OpenSaleOrder_updatePeriod.xml
+74
-0
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingAlarm.py
..._accounting/TestTemplateItem/testSlapOSAccountingAlarm.py
+136
-0
master/bt5/slapos_accounting/bt/revision
master/bt5/slapos_accounting/bt/revision
+1
-1
master/bt5/slapos_accounting/bt/template_catalog_related_key_list
...t5/slapos_accounting/bt/template_catalog_related_key_list
+1
-0
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/CatalogRelatedKeyTemplateItem/related_key_list.xml
0 → 100644
View file @
d7ba4285
<key_list>
<key>
children_portal_type | catalog/portal_type/z_related_children
</key>
</key_list>
\ No newline at end of file
master/bt5/slapos_accounting/PathTemplateItem/portal_alarms/slapos_update_open_sale_order_period.xml
0 → 100644
View file @
d7ba4285
<?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_requestUpdateOpenSaleOrderPeriod
</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_update_open_sale_order_period
</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>
4
</int>
</tuple>
</value>
</item>
<item>
<key>
<string>
periodicity_hour_frequency
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple>
<int>
4
</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>
-4861728000.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 period
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateOpenSaleOrderPeriod.xml
0 → 100644
View file @
d7ba4285
<?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>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Open Sale Order\',\n
validation_state=\'validated\',\n
children_portal_type=\'Open Sale Order Line\',\n
method_id=\'OpenSaleOrder_updatePeriod\',\n
activate_kw={\'tag\': tag}\n
)\n
context.activate(after_tag=tag).getId()\n
</string>
</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_requestUpdateOpenSaleOrderPeriod
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.xml
0 → 100644
View file @
d7ba4285
<?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>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
if context.getValidationState() == \'validated\':\n
person = context.getDestinationDecisionValue(portal_type="Person")\n
if person is not None:\n
person.Person_storeOpenSaleOrderJournal()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OpenSaleOrder_updatePeriod
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingAlarm.py
View file @
d7ba4285
...
...
@@ -1673,3 +1673,139 @@ class TestSlapOSStopConfirmedAggregatedSaleInvoiceTransactionAlarm(
script
=
'Delivery_stopConfirmedAggregatedSaleInvoiceTransaction'
portal_type
=
'Sale Invoice Transaction'
alarm
=
'slapos_stop_confirmed_aggregated_sale_invoice_transaction'
class
TestSlapOSUpdateOpenSaleOrderPeriod
(
testSlapOSMixin
):
def
createOpenOrder
(
self
):
open_order
=
self
.
portal
.
open_sale_order_module
\
.
template_open_sale_order
.
Base_createCloneDocument
(
batch_mode
=
1
)
open_order
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTHS-%s"
%
self
.
generateNewId
(),
)
open_order
.
order
()
open_order
.
validate
()
return
open_order
def
test_updatePeriod_REQUEST_disallowed
(
self
):
self
.
assertRaises
(
Unauthorized
,
self
.
portal
.
OpenSaleOrder_updatePeriod
,
REQUEST
=
{})
def
_simulatePerson_storeOpenSaleOrderJournal
(
self
):
script_name
=
'Person_storeOpenSaleOrderJournal'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Person_storeOpenSaleOrderJournal') """
)
transaction
.
commit
()
def
_dropPerson_storeOpenSaleOrderJournal
(
self
):
script_name
=
'Person_storeOpenSaleOrderJournal'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_updatePeriod_no_person
(
self
):
open_order
=
self
.
createOpenOrder
()
open_order
.
OpenSaleOrder_updatePeriod
()
def
test_updatePeriod_validated
(
self
):
open_order
=
self
.
createOpenOrder
()
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
open_order
.
edit
(
destination_decision_value
=
person
,
)
self
.
_simulatePerson_storeOpenSaleOrderJournal
()
try
:
open_order
.
OpenSaleOrder_updatePeriod
()
finally
:
self
.
_dropPerson_storeOpenSaleOrderJournal
()
self
.
assertEqual
(
'Visited by Person_storeOpenSaleOrderJournal'
,
person
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_updatePeriod_invalidated
(
self
):
open_order
=
self
.
createOpenOrder
()
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
open_order
.
edit
(
destination_decision_value
=
person
,
)
open_order
.
invalidate
()
self
.
_simulatePerson_storeOpenSaleOrderJournal
()
try
:
open_order
.
OpenSaleOrder_updatePeriod
()
finally
:
self
.
_dropPerson_storeOpenSaleOrderJournal
()
self
.
assertNotEqual
(
'Visited by Person_storeOpenSaleOrderJournal'
,
person
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_simulateOpenSaleOrder_updatePeriod
(
self
):
script_name
=
'OpenSaleOrder_updatePeriod'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by OpenSaleOrder_updatePeriod') """
)
transaction
.
commit
()
def
_dropOpenSaleOrder_updatePeriod
(
self
):
script_name
=
'OpenSaleOrder_updatePeriod'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_alarm
(
self
):
open_order
=
self
.
createOpenOrder
()
open_order
.
newContent
(
portal_type
=
"Open Sale Order Line"
)
self
.
tic
()
self
.
_simulateOpenSaleOrder_updatePeriod
()
try
:
self
.
portal
.
portal_alarms
.
slapos_update_open_sale_order_period
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropOpenSaleOrder_updatePeriod
()
self
.
assertEqual
(
'Visited by OpenSaleOrder_updatePeriod'
,
open_order
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_invalidated
(
self
):
open_order
=
self
.
createOpenOrder
()
open_order
.
newContent
(
portal_type
=
"Open Sale Order Line"
)
open_order
.
invalidate
()
self
.
tic
()
self
.
_simulateOpenSaleOrder_updatePeriod
()
try
:
self
.
portal
.
portal_alarms
.
slapos_update_open_sale_order_period
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropOpenSaleOrder_updatePeriod
()
self
.
assertNotEqual
(
'Visited by OpenSaleOrder_updatePeriod'
,
open_order
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_no_line
(
self
):
open_order
=
self
.
createOpenOrder
()
self
.
tic
()
self
.
_simulateOpenSaleOrder_updatePeriod
()
try
:
self
.
portal
.
portal_alarms
.
slapos_update_open_sale_order_period
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropOpenSaleOrder_updatePeriod
()
self
.
assertNotEqual
(
'Visited by OpenSaleOrder_updatePeriod'
,
open_order
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
master/bt5/slapos_accounting/bt/revision
View file @
d7ba4285
243
\ No newline at end of file
244
\ No newline at end of file
master/bt5/slapos_accounting/bt/template_catalog_related_key_list
0 → 100644
View file @
d7ba4285
children_portal_type | catalog/portal_type/z_related_children
\ No newline at end of file
master/bt5/slapos_accounting/bt/template_path_list
View file @
d7ba4285
...
...
@@ -32,6 +32,7 @@ portal_alarms/slapos_stop_confirmed_aggregated_sale_invoice_transaction
portal_alarms/slapos_trigger_aggregated_delivery_order_builder
portal_alarms/slapos_trigger_build
portal_alarms/slapos_trigger_payment_transaction_order_builder
portal_alarms/slapos_update_open_sale_order_period
portal_categories/trade_phase/slapos
portal_categories/trade_phase/slapos/**
portal_categories/trade_state/**
...
...
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