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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
de87a9b0
Commit
de87a9b0
authored
Feb 06, 2023
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CausalityAssignmentMovementGroup: do not lose existing values on update
parent
3f29602a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.CausalityAssignmentMovementGroup.py
...ponents/document.erp5.CausalityAssignmentMovementGroup.py
+10
-7
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.DeliveryCausalityAssignmentMovementGroup.py
...document.erp5.DeliveryCausalityAssignmentMovementGroup.py
+2
-5
No files found.
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.CausalityAssignmentMovementGroup.py
View file @
de87a9b0
...
@@ -40,7 +40,7 @@ class CausalityAssignmentMovementGroup(MovementGroup):
...
@@ -40,7 +40,7 @@ class CausalityAssignmentMovementGroup(MovementGroup):
portal_type
=
'Causality Assignment Movement Group'
portal_type
=
'Causality Assignment Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
return
self
.
_addCausalityToEdit
(
movement
)
return
self
.
_addCausalityToEdit
(
movement
,
{}
)
def
_separate
(
self
,
movement_list
,
**
kw
):
def
_separate
(
self
,
movement_list
,
**
kw
):
if
not
movement_list
:
if
not
movement_list
:
...
@@ -51,13 +51,17 @@ class CausalityAssignmentMovementGroup(MovementGroup):
...
@@ -51,13 +51,17 @@ class CausalityAssignmentMovementGroup(MovementGroup):
return
[[
movement_list
,
property_dict
]]
return
[[
movement_list
,
property_dict
]]
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
# We can always update.
causality_list
=
movement
.
getCausalityList
()
if
causality_list
:
property_dict
=
property_dict
.
copy
()
for
causality
in
property_dict
.
get
(
'causality_list'
,
()):
if
causality
not
in
causality_list
:
causality_list
.
append
(
causality
)
property_dict
[
'causality_list'
]
=
causality_list
return
True
,
property_dict
return
True
,
property_dict
def
_addCausalityToEdit
(
self
,
movement
,
property_dict
=
None
):
def
_addCausalityToEdit
(
self
,
movement
,
property_dict
):
if
property_dict
is
None
:
causality_list
=
property_dict
.
setdefault
(
'causality_list'
,
[])
property_dict
=
{}
causality_list
=
property_dict
.
get
(
'causality_list'
,
[])
root_movement
=
movement
.
getRootSimulationMovement
()
root_movement
=
movement
.
getRootSimulationMovement
()
# 'order' category is deprecated. it is kept for compatibility.
# 'order' category is deprecated. it is kept for compatibility.
movement_list
=
root_movement
.
getOrderList
()
or
\
movement_list
=
root_movement
.
getOrderList
()
or
\
...
@@ -65,5 +69,4 @@ class CausalityAssignmentMovementGroup(MovementGroup):
...
@@ -65,5 +69,4 @@ class CausalityAssignmentMovementGroup(MovementGroup):
for
delivery_movement
in
movement_list
:
for
delivery_movement
in
movement_list
:
if
delivery_movement
not
in
causality_list
:
if
delivery_movement
not
in
causality_list
:
causality_list
.
append
(
delivery_movement
)
causality_list
.
append
(
delivery_movement
)
property_dict
[
'causality_list'
]
=
causality_list
return
property_dict
return
property_dict
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.DeliveryCausalityAssignmentMovementGroup.py
View file @
de87a9b0
...
@@ -36,9 +36,7 @@ class DeliveryCausalityAssignmentMovementGroup(CausalityAssignmentMovementGroup)
...
@@ -36,9 +36,7 @@ class DeliveryCausalityAssignmentMovementGroup(CausalityAssignmentMovementGroup)
meta_type
=
'ERP5 Delivery Causality Assignment Movement Group'
meta_type
=
'ERP5 Delivery Causality Assignment Movement Group'
portal_type
=
'Delivery Causality Assignment Movement Group'
portal_type
=
'Delivery Causality Assignment Movement Group'
def
_addCausalityToEdit
(
self
,
movement
,
property_dict
=
None
):
def
_addCausalityToEdit
(
self
,
movement
,
property_dict
):
if
property_dict
is
None
:
property_dict
=
{}
if
movement
.
getParentValue
().
isRootAppliedRule
():
if
movement
.
getParentValue
().
isRootAppliedRule
():
# Here movement probably comes from invoice rule, in that situation, we
# Here movement probably comes from invoice rule, in that situation, we
# are not able to go up and find a delivery.
# are not able to go up and find a delivery.
...
@@ -51,10 +49,9 @@ class DeliveryCausalityAssignmentMovementGroup(CausalityAssignmentMovementGroup)
...
@@ -51,10 +49,9 @@ class DeliveryCausalityAssignmentMovementGroup(CausalityAssignmentMovementGroup)
delivery_movement
=
parent
.
getDeliveryValue
()
delivery_movement
=
parent
.
getDeliveryValue
()
if
delivery_movement
is
not
None
:
if
delivery_movement
is
not
None
:
delivery
=
delivery_movement
.
getExplanationValue
()
delivery
=
delivery_movement
.
getExplanationValue
()
causality
=
property_dict
.
ge
t
(
'causality_list'
,
[])
causality
=
property_dict
.
setdefaul
t
(
'causality_list'
,
[])
delivery_url
=
delivery
.
getRelativeUrl
()
delivery_url
=
delivery
.
getRelativeUrl
()
if
delivery_url
not
in
causality
:
if
delivery_url
not
in
causality
:
causality
.
append
(
delivery_url
)
causality
.
append
(
delivery_url
)
property_dict
[
'causality_list'
]
=
causality
return
property_dict
return
property_dict
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