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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
d7829bda
Commit
d7829bda
authored
Jan 09, 2025
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_administration: add alarm to check site modification
parent
3770c698
Pipeline
#39005
failed with stage
in 0 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
283 additions
and
0 deletions
+283
-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
+15
-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
+27
-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 @
d7829bda
<?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 @
d7829bda
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 @
d7829bda
<?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 @
d7829bda
from
DateTime
import
DateTime
from
Products.CMFActivity.ActiveResult
import
ActiveResult
portal
=
context
.
getPortalObject
()
if
not
check_date
:
check_date
=
DateTime
().
earliestTime
()
-
1
active_process
=
context
.
restrictedTraverse
(
active_process
)
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 @
d7829bda
<?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 @
d7829bda
...
...
@@ -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,32 @@ 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
)
self
.
assertEquals
(
len
(
active_process
.
ActiveProcess_getResultList
()),
0
)
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'
)
self
.
tic
()
self
.
portal
.
Base_checkSiteDailyModification
(
active_process
=
active_process
.
getRelativeUrl
(),
check_date
=
check_date
)
result_list
=
sorted
([
x
.
detail
for
x
in
active_process
.
getResultList
()])
expected_result_list
=
[
'erp5_administration/Base_checkSiteDailyModification is modified'
,
'erp5_administration/BusinessTemplate_viewCheckPythonCodeDialog is modified'
]
self
.
assertEquals
(
result_list
,
expected_result_list
,
result_list
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5Administration
))
...
...
bt5/erp5_administration/bt/template_path_list
View file @
d7829bda
...
...
@@ -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