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
140
Merge Requests
140
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
705e0beb
Commit
705e0beb
authored
Jun 17, 2024
by
Julien Muchembled
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AppliedRule._checkExpand: add parameters to filter objects + better reporting
parent
831cf1a8
Pipeline
#35611
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.AppliedRule.py
...mplateItem/portal_components/document.erp5.AppliedRule.py
+25
-8
No files found.
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.AppliedRule.py
View file @
705e0beb
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
##############################################################################
##############################################################################
from
collections
import
deque
from
collections
import
deque
from
difflib
import
unified_diff
from
pprint
import
pformat
import
sys
import
sys
import
transaction
import
transaction
import
zope.interface
import
zope.interface
...
@@ -390,7 +392,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
...
@@ -390,7 +392,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
return
{
k
:
sum
(
v
.
values
(),
[])
for
k
,
v
in
deleted
},
delivery_set
return
{
k
:
sum
(
v
.
values
(),
[])
for
k
,
v
in
deleted
},
delivery_set
simulation_tool
.
_delObject
(
self
.
getId
())
simulation_tool
.
_delObject
(
self
.
getId
())
def
_checkExpand
(
self
):
def
_checkExpand
(
self
,
ignore_nul_movements
=
False
,
filter
=
None
):
"""Check that expand() would not fail nor do major changes to the subobjects
"""Check that expand() would not fail nor do major changes to the subobjects
Transaction is aborted after 'expand' is called.
Transaction is aborted after 'expand' is called.
...
@@ -405,12 +407,19 @@ class AppliedRule(XMLObject, ExplainableMixin):
...
@@ -405,12 +407,19 @@ class AppliedRule(XMLObject, ExplainableMixin):
while
object_list
:
while
object_list
:
document
=
object_list
.
popleft
()
document
=
object_list
.
popleft
()
portal_type
=
document
.
getPortalType
()
portal_type
=
document
.
getPortalType
()
document_dict
=
{
'portal_type'
:
portal_type
}
document_dict
=
{
property
:
document
.
getProperty
(
property
)
for
property_
in
property_dict
[
portal_type
]:
for
property
in
property_dict
[
portal_type
]}
document_dict
[
property_
]
=
document
.
getProperty
(
property_
)
if
ignore_nul_movements
and
portal_type
==
'Simulation Movement'
and
\
not
(
document_dict
[
'quantity'
]
and
document
.
getPrice
()):
if
document
.
isDeletable
():
continue
del
document_dict
[
'quantity'
]
document_dict
[
'portal_type'
]
=
portal_type
if
filter
is
None
or
filter
(
initial_rule_dict
,
document
,
document_dict
):
rule_dict
[
document
.
getRelativeUrl
()]
=
document_dict
rule_dict
[
document
.
getRelativeUrl
()]
=
document_dict
object_list
+=
document
.
objectValues
()
object_list
+=
document
.
objectValues
()
return
rule_dict
return
rule_dict
initial_rule_dict
=
None
initial_rule_dict
=
fillRuleDict
()
initial_rule_dict
=
fillRuleDict
()
try
:
try
:
self
.
expand
(
"immediate"
)
self
.
expand
(
"immediate"
)
...
@@ -420,7 +429,15 @@ class AppliedRule(XMLObject, ExplainableMixin):
...
@@ -420,7 +429,15 @@ class AppliedRule(XMLObject, ExplainableMixin):
msg
=
''
.
join
(
ExceptionFormatter
.
format_exception
(
*
sys
.
exc_info
())[
1
:])
msg
=
''
.
join
(
ExceptionFormatter
.
format_exception
(
*
sys
.
exc_info
())[
1
:])
else
:
else
:
final_rule_dict
=
fillRuleDict
()
final_rule_dict
=
fillRuleDict
()
msg
=
"%r != %r"
%
(
initial_rule_dict
,
final_rule_dict
)
\
if
initial_rule_dict
==
final_rule_dict
:
if
initial_rule_dict
!=
final_rule_dict
else
None
msg
=
None
else
:
diff
=
unified_diff
(
pformat
(
initial_rule_dict
,
width
=
1000
).
splitlines
(),
pformat
(
final_rule_dict
,
width
=
1000
).
splitlines
(),
lineterm
=
''
)
next
(
diff
)
next
(
diff
)
msg
=
'
\
n
'
.
join
(
diff
)
transaction
.
abort
()
transaction
.
abort
()
return
msg
return
msg
Jérome Perrin
@jerome
mentioned in commit
28b44e98
·
Jun 28, 2024
mentioned in commit
28b44e98
mentioned in commit 28b44e9860aeb92eda403149ed09a05818a58e17
Toggle commit 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