Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
144
Merge Requests
144
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
85375206
Commit
85375206
authored
Jan 15, 2025
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Plain Diff
erp5_administration: add alarm to check site modification
See merge request
!2042
parents
91385efb
c00087aa
Pipeline
#39058
failed with stage
in 0 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
322 additions
and
0 deletions
+322
-0
bt5/erp5_administration/PathTemplateItem/portal_alarms/check_site_daily_modification.xml
...plateItem/portal_alarms/check_site_daily_modification.xml
+109
-0
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkSiteDailyModification.py
...s/erp5_administration/Alarm_checkSiteDailyModification.py
+3
-0
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkSiteDailyModification.xml
.../erp5_administration/Alarm_checkSiteDailyModification.xml
+62
-0
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_checkSiteDailyModification.py
...ns/erp5_administration/Base_checkSiteDailyModification.py
+35
-0
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_checkSiteDailyModification.xml
...s/erp5_administration/Base_checkSiteDailyModification.xml
+66
-0
bt5/erp5_administration/TestTemplateItem/portal_components/test.erp5.testERP5Administration.py
...tem/portal_components/test.erp5.testERP5Administration.py
+46
-0
bt5/erp5_administration/bt/template_path_list
bt5/erp5_administration/bt/template_path_list
+1
-0
No files found.
bt5/erp5_administration/PathTemplateItem/portal_alarms/check_site_daily_modification.xml
0 → 100644
View file @
85375206
<?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_checkSiteDailyModification
</string>
</value>
</item>
<item>
<key>
<string>
alarm_notification_mode
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
automatic_solve
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
check_site_daily_modification
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<tuple>
<int>
0
</int>
</tuple>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple>
<int>
1
</int>
</tuple>
</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=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<tuple>
<float>
1603152000.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>
report_method_id
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Check Site Daily Modification
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkSiteDailyModification.py
0 → 100644
View file @
85375206
active_process
=
context
.
newActiveProcess
().
getRelativeUrl
()
context
.
activate
(
tag
=
tag
).
Base_checkSiteDailyModification
(
active_process
=
active_process
)
context
.
activate
(
after_tag
=
tag
).
getId
()
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkSiteDailyModification.xml
0 → 100644
View file @
85375206
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</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, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_checkSiteDailyModification
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_checkSiteDailyModification.py
0 → 100644
View file @
85375206
from
DateTime
import
DateTime
from
Products.CMFActivity.ActiveResult
import
ActiveResult
from
Products.ZSQLCatalog.SQLCatalog
import
Query
portal
=
context
.
getPortalObject
()
if
not
check_date
:
check_date
=
DateTime
().
earliestTime
()
-
1
active_process
=
context
.
restrictedTraverse
(
active_process
)
for
workflow_object
in
portal
.
portal_catalog
(
portal_type
=
(
'Workflow'
,
'Workflow Script'
,
'Workflow State'
,
'Workflow Transition'
,
'Workflow Variable'
,
'Worklist'
,
'Interaction Workflow'
),
modification_date
=
Query
(
modification_date
=
check_date
,
range
=
"min"
),
select_list
=
[
'relative_url'
]
):
active_process
.
postResult
(
ActiveResult
(
severity
=
100
,
detail
=
'%s is modified'
%
workflow_object
.
relative_url
))
for
sub_path
,
sub_obj
in
portal
.
portal_skins
.
ZopeFind
(
portal
.
portal_skins
,
search_sub
=
1
):
modified_date
=
DateTime
(
container
.
last_modified
(
sub_obj
))
if
modified_date
>=
check_date
:
active_process
.
postResult
(
ActiveResult
(
severity
=
100
,
detail
=
'%s is modified'
%
sub_path
))
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_checkSiteDailyModification.xml
0 → 100644
View file @
85375206
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</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>
active_process, check_date = None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_checkSiteDailyModification
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_administration/TestTemplateItem/portal_components/test.erp5.testERP5Administration.py
View file @
85375206
...
...
@@ -30,6 +30,7 @@
import
unittest
import
time
from
Products.ERP5.tests.testInventoryAPI
import
InventoryAPITestCase
from
DateTime
import
DateTime
class
TestERP5Administration
(
InventoryAPITestCase
):
"""Test for erp5_administration business template.
...
...
@@ -231,6 +232,51 @@ component_error()
location_and_message_list
)
def
test_check_site_modification
(
self
):
# remove second, obj's modification in erp5 don't have seconds
check_date
=
DateTime
(
DateTime
().
strftime
(
'%Y-%m-%d %H:%M'
))
active_process
=
self
.
portal
.
portal_activities
.
newActiveProcess
()
self
.
portal
.
Base_checkSiteDailyModification
(
active_process
=
active_process
.
getRelativeUrl
(),
check_date
=
check_date
)
result_list
=
[
x
.
detail
for
x
in
active_process
.
getResultList
()]
message_list
=
[
'erp5_administration/Base_checkSiteDailyModification is modified'
,
'erp5_administration/BusinessTemplate_viewCheckPythonCodeDialog is modified'
,
'portal_workflow/edit_workflow is modified'
,
'portal_workflow/edit_workflow/state_current is modified'
,
'portal_workflow/preference_interaction_workflow is modified'
]
for
message
in
message_list
:
self
.
assertNotIn
(
message
,
result_list
)
self
.
portal
.
portal_skins
.
erp5_administration
.
Base_checkSiteDailyModification
.
ZPythonScript_setTitle
(
'%s'
%
check_date
)
self
.
portal
.
portal_skins
.
erp5_administration
.
Base_checkSiteDailyModification
.
ZPythonScript_setTitle
(
''
)
self
.
portal
.
portal_skins
.
erp5_administration
.
BusinessTemplate_viewCheckPythonCodeDialog
.
manage_addProduct
[
'Formulator'
].
manage_addField
(
'my_title'
,
'Title'
,
'StringField'
)
self
.
portal
.
portal_skins
.
erp5_administration
.
BusinessTemplate_viewCheckPythonCodeDialog
.
manage_delObjects
(
'my_title'
)
new_comment
=
'Test %s'
%
check_date
self
.
portal
.
portal_workflow
.
preference_interaction_workflow
.
edit
(
comment
=
new_comment
)
self
.
portal
.
portal_workflow
.
edit_workflow
.
edit
(
comment
=
new_comment
)
self
.
portal
.
portal_workflow
.
edit_workflow
.
state_current
.
edit
(
comment
=
new_comment
)
self
.
tic
()
self
.
portal
.
Base_checkSiteDailyModification
(
active_process
=
active_process
.
getRelativeUrl
(),
check_date
=
check_date
)
result_list
=
[
x
.
detail
for
x
in
active_process
.
getResultList
()]
for
message
in
message_list
:
self
.
assertIn
(
message
,
result_list
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5Administration
))
...
...
bt5/erp5_administration/bt/template_path_list
View file @
85375206
...
...
@@ -4,5 +4,6 @@ portal_alarms/check_conversion_tool_availability
portal_alarms/check_folder_handler
portal_alarms/check_item_tracking
portal_alarms/check_localizer
portal_alarms/check_site_daily_modification
portal_alarms/check_skin_cache
portal_alarms/check_stock
\ No newline at end of file
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