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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
00311942
Commit
00311942
authored
Feb 25, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simulation: when building, edit properties in order defined on movement groups
parent
6fd3252c
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
24 additions
and
46 deletions
+24
-46
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.BaseVariantMovementGroup.py
...rtal_components/document.erp5.BaseVariantMovementGroup.py
+1
-7
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.CategoryMovementGroup.py
.../portal_components/document.erp5.CategoryMovementGroup.py
+2
-1
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.CausalityMovementGroup.py
...portal_components/document.erp5.CausalityMovementGroup.py
+1
-4
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.MonthlyRangeMovementGroup.py
...tal_components/document.erp5.MonthlyRangeMovementGroup.py
+2
-1
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.ParentDeliveryPropertyMovementGroup.py
...ents/document.erp5.ParentDeliveryPropertyMovementGroup.py
+2
-1
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.ParentExplanationMovementGroup.py
...omponents/document.erp5.ParentExplanationMovementGroup.py
+1
-4
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.PropertyMovementGroup.py
.../portal_components/document.erp5.PropertyMovementGroup.py
+3
-1
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.RequirementMovementGroup.py
...rtal_components/document.erp5.RequirementMovementGroup.py
+1
-1
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.RootAppliedRuleCausalityMovementGroup.py
...ts/document.erp5.RootAppliedRuleCausalityMovementGroup.py
+1
-4
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.TitleMovementGroup.py
...tem/portal_components/document.erp5.TitleMovementGroup.py
+1
-3
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.BuilderMixin.py
...TemplateItem/portal_components/mixin.erp5.BuilderMixin.py
+0
-2
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.MovementGroup.py
...mplateItem/portal_components/module.erp5.MovementGroup.py
+9
-17
No files found.
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.BaseVariantMovementGroup.py
View file @
00311942
...
@@ -37,13 +37,7 @@ class BaseVariantMovementGroup(MovementGroup):
...
@@ -37,13 +37,7 @@ class BaseVariantMovementGroup(MovementGroup):
portal_type
=
'Base Variant Movement Group'
portal_type
=
'Base Variant Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
return
{
'_base_category_list'
:
sorted
(
movement
.
getVariationBaseCategoryList
()
or
[])}
category_list
=
movement
.
getVariationBaseCategoryList
()
if
category_list
is
None
:
category_list
=
[]
category_list
.
sort
()
property_dict
[
'_base_category_list'
]
=
category_list
return
property_dict
def
test
(
self
,
document
,
property_dict
,
**
kw
):
def
test
(
self
,
document
,
property_dict
,
**
kw
):
# This movement group does not affect updating.
# This movement group does not affect updating.
...
...
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.CategoryMovementGroup.py
View file @
00311942
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#
#
##############################################################################
##############################################################################
from
collections
import
OrderedDict
from
erp5.component.document.PropertyMovementGroup
import
PropertyMovementGroup
from
erp5.component.document.PropertyMovementGroup
import
PropertyMovementGroup
class
CategoryMovementGroup
(
PropertyMovementGroup
):
class
CategoryMovementGroup
(
PropertyMovementGroup
):
...
@@ -43,7 +44,7 @@ class CategoryMovementGroup(PropertyMovementGroup):
...
@@ -43,7 +44,7 @@ class CategoryMovementGroup(PropertyMovementGroup):
portal_type
=
'Category Movement Group'
portal_type
=
'Category Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
property_dict
=
OrderedDict
()
getProperty
=
movement
.
getProperty
getProperty
=
movement
.
getProperty
for
prop
in
self
.
getTestedPropertyList
():
for
prop
in
self
.
getTestedPropertyList
():
list_prop
=
prop
+
'_list'
list_prop
=
prop
+
'_list'
...
...
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.CausalityMovementGroup.py
View file @
00311942
...
@@ -38,10 +38,7 @@ class CausalityMovementGroup(MovementGroup):
...
@@ -38,10 +38,7 @@ class CausalityMovementGroup(MovementGroup):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
return
{
'_explanation'
:
self
.
_getExplanationRelativeUrl
(
movement
)}
explanation_relative_url
=
self
.
_getExplanationRelativeUrl
(
movement
)
property_dict
[
'_explanation'
]
=
explanation_relative_url
return
property_dict
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
# we don't care the difference of explanation url when updating
# we don't care the difference of explanation url when updating
...
...
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.MonthlyRangeMovementGroup.py
View file @
00311942
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#
#
##############################################################################
##############################################################################
from
collections
import
OrderedDict
from
erp5.component.document.MovementGroup
import
MovementGroup
from
erp5.component.document.MovementGroup
import
MovementGroup
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
erp5.component.module.DateUtils
import
atTheEndOfPeriod
from
erp5.component.module.DateUtils
import
atTheEndOfPeriod
...
@@ -45,7 +46,7 @@ class MonthlyRangeMovementGroup(MovementGroup):
...
@@ -45,7 +46,7 @@ class MonthlyRangeMovementGroup(MovementGroup):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
"""Gather start_date and stop_date, converge them to the end of month.
"""Gather start_date and stop_date, converge them to the end of month.
"""
"""
property_dict
=
{}
property_dict
=
OrderedDict
()
for
property_name
in
self
.
getTestedPropertyList
()
or
(
'start_date'
,
'stop_date'
):
for
property_name
in
self
.
getTestedPropertyList
()
or
(
'start_date'
,
'stop_date'
):
date
=
movement
.
getProperty
(
property_name
,
None
)
date
=
movement
.
getProperty
(
property_name
,
None
)
if
date
is
not
None
:
if
date
is
not
None
:
...
...
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.ParentDeliveryPropertyMovementGroup.py
View file @
00311942
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#
#
##############################################################################
##############################################################################
from
collections
import
OrderedDict
from
erp5.component.document.PropertyMovementGroup
import
PropertyMovementGroup
from
erp5.component.document.PropertyMovementGroup
import
PropertyMovementGroup
from
Products.ERP5Type.Utils
import
UpperCase
from
Products.ERP5Type.Utils
import
UpperCase
...
@@ -41,7 +42,7 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup):
...
@@ -41,7 +42,7 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup):
portal_type
=
'Parent Delivery Property Movement Group'
portal_type
=
'Parent Delivery Property Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
property_dict
=
OrderedDict
()
parent_delivery
=
self
.
_getParentDelivery
(
movement
)
parent_delivery
=
self
.
_getParentDelivery
(
movement
)
if
parent_delivery
is
not
None
:
if
parent_delivery
is
not
None
:
for
prop
in
self
.
getTestedPropertyList
():
for
prop
in
self
.
getTestedPropertyList
():
...
...
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.ParentExplanationMovementGroup.py
View file @
00311942
...
@@ -40,10 +40,7 @@ class ParentExplanationMovementGroup(MovementGroup):
...
@@ -40,10 +40,7 @@ class ParentExplanationMovementGroup(MovementGroup):
portal_type
=
'Parent Explanation Movement Group'
portal_type
=
'Parent Explanation Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
return
{
'parent_explanation_value'
:
movement
.
getParentExplanationValue
()}
parent_explanation_value
=
movement
.
getParentExplanationValue
()
property_dict
[
'parent_explanation_value'
]
=
parent_explanation_value
return
property_dict
def
test
(
self
,
document
,
property_dict
,
**
kw
):
def
test
(
self
,
document
,
property_dict
,
**
kw
):
if
document
.
getParentExplanationValue
()
==
\
if
document
.
getParentExplanationValue
()
==
\
...
...
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.PropertyMovementGroup.py
View file @
00311942
...
@@ -26,8 +26,10 @@
...
@@ -26,8 +26,10 @@
#
#
##############################################################################
##############################################################################
from
collections
import
OrderedDict
from
erp5.component.document.MovementGroup
import
MovementGroup
from
erp5.component.document.MovementGroup
import
MovementGroup
class
PropertyMovementGroup
(
MovementGroup
):
class
PropertyMovementGroup
(
MovementGroup
):
"""
"""
The purpose of MovementGroup is to define how movements are grouped,
The purpose of MovementGroup is to define how movements are grouped,
...
@@ -40,7 +42,7 @@ class PropertyMovementGroup(MovementGroup):
...
@@ -40,7 +42,7 @@ class PropertyMovementGroup(MovementGroup):
portal_type
=
'Property Movement Group'
portal_type
=
'Property Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
property_dict
=
OrderedDict
()
getProperty
=
movement
.
getProperty
getProperty
=
movement
.
getProperty
for
prop
in
self
.
getTestedPropertyList
():
for
prop
in
self
.
getTestedPropertyList
():
property_dict
[
prop
]
=
getProperty
(
prop
)
property_dict
[
prop
]
=
getProperty
(
prop
)
...
...
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.RequirementMovementGroup.py
View file @
00311942
...
@@ -36,7 +36,7 @@ class RequirementMovementGroup(MovementGroup):
...
@@ -36,7 +36,7 @@ class RequirementMovementGroup(MovementGroup):
portal_type
=
'Requirement Movement Group'
portal_type
=
'Requirement Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
return
{
'requirement'
:
self
.
_getRequirementList
(
movement
)}
return
{
'requirement'
:
self
.
_getRequirementList
(
movement
)}
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
# We can always update
# We can always update
...
...
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.RootAppliedRuleCausalityMovementGroup.py
View file @
00311942
...
@@ -39,10 +39,7 @@ class RootAppliedRuleCausalityMovementGroup(MovementGroup):
...
@@ -39,10 +39,7 @@ class RootAppliedRuleCausalityMovementGroup(MovementGroup):
portal_type
=
'Root Applied Rule Causality Movement Group'
portal_type
=
'Root Applied Rule Causality Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
return
{
'root_causality_value_list'
:
[
self
.
_getRootCausalityValue
(
movement
)]}
root_causality_value
=
self
.
_getRootCausalityValue
(
movement
)
property_dict
[
'root_causality_value_list'
]
=
[
root_causality_value
]
return
property_dict
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
def
test
(
self
,
movement
,
property_dict
,
**
kw
):
# We can always update
# We can always update
...
...
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.TitleMovementGroup.py
View file @
00311942
...
@@ -37,9 +37,7 @@ class TitleMovementGroup(MovementGroup):
...
@@ -37,9 +37,7 @@ class TitleMovementGroup(MovementGroup):
portal_type
=
'Title Movement Group'
portal_type
=
'Title Movement Group'
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
return
{
'title'
:
self
.
_getTitle
(
movement
)}
property_dict
[
'title'
]
=
self
.
_getTitle
(
movement
)
return
property_dict
def
test
(
self
,
document
,
property_dict
,
**
kw
):
def
test
(
self
,
document
,
property_dict
,
**
kw
):
# If title is different, we want to update existing document instead
# If title is different, we want to update existing document instead
...
...
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.BuilderMixin.py
View file @
00311942
...
@@ -331,8 +331,6 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -331,8 +331,6 @@ class BuilderMixin(XMLObject, Amount, Predicate):
# 'variation_category' or 'variation_property' pseudo properties,
# 'variation_category' or 'variation_property' pseudo properties,
# which rely on the resource being set to discover which
# which rely on the resource being set to discover which
# categories/properties to set
# categories/properties to set
# XXX-Leo: in the future: using an ordered_dict would be nice,
# but this would have to be respected on Base._edit()
edit_order
=
[]
edit_order
=
[]
property_dict
=
{
'edit_order'
:
edit_order
}
property_dict
=
{
'edit_order'
:
edit_order
}
for
d
in
property_dict_list
:
for
d
in
property_dict_list
:
...
...
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.MovementGroup.py
View file @
00311942
...
@@ -28,11 +28,10 @@
...
@@ -28,11 +28,10 @@
#
#
##############################################################################
##############################################################################
from
collections
import
OrderedDict
from
warnings
import
warn
from
warnings
import
warn
from
Products.PythonScripts.Utility
import
allow_class
from
Products.PythonScripts.Utility
import
allow_class
class
FakeMovementError
(
Exception
)
:
pass
class
MovementGroupError
(
Exception
)
:
pass
class
MovementGroupNode
:
class
MovementGroupNode
:
# XXX last_line_movement_group is a wrong name. Actually, it is
# XXX last_line_movement_group is a wrong name. Actually, it is
...
@@ -60,7 +59,7 @@ class MovementGroupNode:
...
@@ -60,7 +59,7 @@ class MovementGroupNode:
last_line_movement_group
=
self
.
_last_line_movement_group
,
last_line_movement_group
=
self
.
_last_line_movement_group
,
separate_method_name_list
=
self
.
_separate_method_name_list
,
separate_method_name_list
=
self
.
_separate_method_name_list
,
merge_delivery
=
self
.
_merge_delivery
)
merge_delivery
=
self
.
_merge_delivery
)
nested_instance
.
setGroupEdit
(
**
property_dict
)
nested_instance
.
setGroupEdit
(
property_dict
)
split_movement_list
=
nested_instance
.
append
(
movement_list
)
split_movement_list
=
nested_instance
.
append
(
movement_list
)
self
.
_group_list
.
append
(
nested_instance
)
self
.
_group_list
.
append
(
nested_instance
)
return
split_movement_list
return
split_movement_list
...
@@ -93,27 +92,20 @@ class MovementGroupNode:
...
@@ -93,27 +92,20 @@ class MovementGroupNode:
def
getGroupList
(
self
):
def
getGroupList
(
self
):
return
self
.
_group_list
return
self
.
_group_list
def
setGroupEdit
(
self
,
**
kw
):
def
setGroupEdit
(
self
,
kw
):
"""
"""
Store properties for the futur created object
Store properties for the futur
e
created object
"""
"""
self
.
_property_dict
=
kw
self
.
_property_dict
=
kw
def
updateGroupEdit
(
self
,
**
kw
):
"""
Update properties for the futur created object
"""
self
.
_property_dict
.
update
(
kw
)
def
getGroupEditDict
(
self
):
def
getGroupEditDict
(
self
):
"""
"""
Get property dict for the futur created object
Get property dict for the futur
e
created object
"""
"""
property_dict
=
getattr
(
self
,
'_property_dict'
,
{}).
copy
()
return
OrderedDict
([
for
key
in
property_dict
.
keys
():
(
k
,
v
)
if
key
.
startswith
(
'_'
):
for
(
k
,
v
)
in
getattr
(
self
,
'_property_dict'
,
{}).
items
()
del
(
property_dict
[
key
])
if
not
k
.
startswith
(
'_'
)])
return
property_dict
def
getCurrentMovementGroup
(
self
):
def
getCurrentMovementGroup
(
self
):
return
self
.
_movement_group
return
self
.
_movement_group
...
...
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