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
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
Frederic Thoma
erp5
Commits
e09bb2bd
Commit
e09bb2bd
authored
Jan 20, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Form: If form is in ignore list don't check it's fields
parent
f7aec705
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
+33
-33
product/ERP5Form/Form.py
product/ERP5Form/Form.py
+33
-33
No files found.
product/ERP5Form/Form.py
View file @
e09bb2bd
...
@@ -1362,40 +1362,40 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1362,40 +1362,40 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
'erp5-Guideline.Report.Name.Uses.Portal.Type.Followed.By.View.Report.Name.And.Report'
,
'erp5-Guideline.Report.Name.Uses.Portal.Type.Followed.By.View.Report.Name.And.Report'
,
'Report form name must follow ${portal_type}_view.*Report naming'
)
'Report form name must follow ${portal_type}_view.*Report naming'
)
is_field_library
=
self
.
getId
().
endswith
(
'FieldLibrary'
)
is_field_library
=
self
.
getId
().
endswith
(
'FieldLibrary'
)
if
self
.
pt
==
'form_view'
and
not
is_field_library
:
if
self
.
pt
==
'form_view'
and
not
is_field_library
:
translated_workflow_state_title_field_re
=
re
.
compile
(
'my_translated_.*state_title$'
)
translated_workflow_state_title_field_re
=
re
.
compile
(
'my_translated_.*state_title$'
)
def
isTranslatedWorkflowStateTitleField
(
f
):
def
isTranslatedWorkflowStateTitleField
(
f
):
return
translated_workflow_state_title_field_re
.
match
(
f
.
getId
())
is
not
None
return
translated_workflow_state_title_field_re
.
match
(
f
.
getId
())
is
not
None
not_translated_workflow_state_field_re
=
re
.
compile
(
'my_(?!translated_).*state(_title|)$'
)
not_translated_workflow_state_field_re
=
re
.
compile
(
'my_(?!translated_).*state(_title|)$'
)
def
isNonTranslatedWorkflowStateField
(
f
):
def
isNonTranslatedWorkflowStateField
(
f
):
return
not_translated_workflow_state_field_re
.
match
(
f
.
getId
())
and
f
.
getId
()
not
in
(
return
not_translated_workflow_state_field_re
.
match
(
f
.
getId
())
and
f
.
getId
()
not
in
(
# exception for some properties containing "state" in their names
# exception for some properties containing "state" in their names
'my_initial_implementation_state'
,
'my_initial_implementation_state'
,
'my_hot_reindexing_state'
,
'my_hot_reindexing_state'
,
'my_message_different_state'
,
'my_message_different_state'
,
)
)
for
group_name
in
self
.
get_groups
():
for
group_name
in
self
.
get_groups
():
field_list
=
self
.
get_fields_in_group
(
group_name
)
field_list
=
self
.
get_fields_in_group
(
group_name
)
for
index
,
field
in
enumerate
(
field_list
):
for
index
,
field
in
enumerate
(
field_list
):
if
isTranslatedWorkflowStateTitleField
(
field
):
if
isTranslatedWorkflowStateTitleField
(
field
):
is_in_right_group
=
'right'
in
group_name
is_in_right_group
=
'right'
in
group_name
# workflow states fields must be the last ones, so we check
# workflow states fields must be the last ones, so we check
# that this field or all the one below match the
# that this field or all the one below match the
# my_translated_${state_variable}_title regex
# my_translated_${state_variable}_title regex
all_bottom_fields_are_workflow_state_fields
=
{
True
}
==
{
all_bottom_fields_are_workflow_state_fields
=
{
True
}
==
{
isTranslatedWorkflowStateTitleField
(
f
)
is
not
None
for
f
in
field_list
[
index
:]}
isTranslatedWorkflowStateTitleField
(
f
)
is
not
None
for
f
in
field_list
[
index
:]}
if
not
(
all_bottom_fields_are_workflow_state_fields
and
is_in_right_group
):
if
not
(
all_bottom_fields_are_workflow_state_fields
and
is_in_right_group
):
addMessage
(
'erp5-Guideline.Place.Simulation.And.Validation.Fields.In.Bottom.Of.Right.Group'
,
'Workflow state fields must be at the bottom right'
)
if
isNonTranslatedWorkflowStateField
(
field
):
addMessage
(
addMessage
(
'erp5-Guideline.Place.Simulation.And.Validation.Fields.In.Bottom.Of.Right.Group'
,
'erp5-Guideline.Use.Correct.Names.For.Simulation.And.Validation.Titles'
,
'Workflow state fields must be at the bottom right'
)
'Workflow state fields should be named my_translated_${state_variable}_title'
)
if
isNonTranslatedWorkflowStateField
(
field
):
addMessage
(
'erp5-Guideline.Use.Correct.Names.For.Simulation.And.Validation.Titles'
,
'Workflow state fields should be named my_translated_${state_variable}_title'
)
return
message_list
return
message_list
...
...
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