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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
b1211f98
Commit
b1211f98
authored
May 19, 2020
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Feb 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_base: Order Builder Add Constraint to identify Mergeable Order and Merge Them
parent
3a7e1316
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
351 additions
and
0 deletions
+351
-0
bt5/erp5_base/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
...rtalTypePropertySheetTemplateItem/property_sheet_list.xml
+3
-0
bt5/erp5_base/PropertySheetTemplateItem/portal_property_sheets/OrderBuilderConstraint.xml
...ateItem/portal_property_sheets/OrderBuilderConstraint.xml
+66
-0
bt5/erp5_base/PropertySheetTemplateItem/portal_property_sheets/OrderBuilderConstraint/order_to_merge_constraint.xml
...eets/OrderBuilderConstraint/order_to_merge_constraint.xml
+110
-0
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/OrderBuilder_hasOrderListThatCanBeMerged.py
...ins/erp5_base/OrderBuilder_hasOrderListThatCanBeMerged.py
+11
-0
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/OrderBuilder_hasOrderListThatCanBeMerged.xml
...ns/erp5_base/OrderBuilder_hasOrderListThatCanBeMerged.xml
+62
-0
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/OrderBuilder_mergeOrderList.py
...tem/portal_skins/erp5_base/OrderBuilder_mergeOrderList.py
+35
-0
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/OrderBuilder_mergeOrderList.xml
...em/portal_skins/erp5_base/OrderBuilder_mergeOrderList.xml
+62
-0
bt5/erp5_base/bt/template_portal_type_property_sheet_list
bt5/erp5_base/bt/template_portal_type_property_sheet_list
+1
-0
bt5/erp5_base/bt/template_property_sheet_id_list
bt5/erp5_base/bt/template_property_sheet_id_list
+1
-0
No files found.
bt5/erp5_base/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
View file @
b1211f98
...
...
@@ -11,6 +11,9 @@
<item>
ItemAggregation
</item>
<item>
Reference
</item>
</portal_type>
<portal_type
id=
"Order Builder"
>
<item>
OrderBuilderConstraint
</item>
</portal_type>
<portal_type
id=
"Organisation"
>
<item>
DefaultImage
</item>
</portal_type>
...
...
bt5/erp5_base/PropertySheetTemplateItem/portal_property_sheets/OrderBuilderConstraint.xml
0 → 100644
View file @
b1211f98
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Property Sheet"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderBuilderConstraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Property Sheet
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
bt5/erp5_base/PropertySheetTemplateItem/portal_property_sheets/OrderBuilderConstraint/order_to_merge_constraint.xml
0 → 100644
View file @
b1211f98
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Script Constraint"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_identity_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_range_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
constraint_type/audit
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
criterion_property
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
order_to_merge_constraint
</string>
</value>
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
membership_criterion_category
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Script Constraint
</string>
</value>
</item>
<item>
<key>
<string>
script_id
</string>
</key>
<value>
<string>
OrderBuilder_hasOrderListThatCanBeMerged
</string>
</value>
</item>
<item>
<key>
<string>
string_index
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
test_method_id
</string>
</key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/OrderBuilder_hasOrderListThatCanBeMerged.py
0 → 100644
View file @
b1211f98
mergeable_order_list_list
=
context
.
getMergeableDeliveryListList
()
if
not
mergeable_order_list_list
:
return
()
if
fixit
:
context
.
OrderBuilder_mergeOrderList
(
mergeable_order_list_list
)
return
[
context
.
Base_translateString
(
"The Following Orders can be merged ${order_list_list}"
,
mapping
=
{
'order_list_list'
:
str
([[
x
.
getRelativeUrl
()
for
x
in
y
]
for
y
in
mergeable_order_list_list
])
}
)]
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/OrderBuilder_hasOrderListThatCanBeMerged.xml
0 → 100644
View file @
b1211f98
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<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>
fixit=False, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderBuilder_hasOrderListThatCanBeMerged
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/OrderBuilder_mergeOrderList.py
0 → 100644
View file @
b1211f98
"""
Script to be customized to merge deliveries
Here we pick the order that was created first
"""
portal
=
context
.
getPortalObject
()
translateString
=
portal
.
Base_translateString
for
order_list
in
mergeable_order_list_list
:
order_list
=
sorted
(
order_list
,
key
=
lambda
x
:
x
.
getCreationDate
(),
)
main_order
=
order_list
.
pop
(
0
)
for
order
in
order_list
:
line_list
=
order
.
objectValues
()
if
line_list
:
cb_data
=
order
.
manage_cutObjects
([
x
.
getId
()
for
x
in
line_list
])
main_order
.
manage_pasteObjects
(
cb_data
)
order
.
cancel
(
comment
=
translateString
(
"Merged with ${main_order_reference}"
,
mapping
=
{
'main_order_reference'
:
main_order
.
getReference
()
}
)
)
portal
.
portal_workflow
.
doActionFor
(
main_order
,
'edit_action'
,
comment
=
translateString
(
"${order_reference} was merged with this order"
,
mapping
=
{
'order_reference'
:
order
.
getReference
()
}
)
)
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/OrderBuilder_mergeOrderList.xml
0 → 100644
View file @
b1211f98
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<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>
mergeable_order_list_list
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderBuilder_mergeOrderList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_base/bt/template_portal_type_property_sheet_list
View file @
b1211f98
...
...
@@ -4,6 +4,7 @@ External Identifier | Coordinate
External Identifier | SimpleItem
Notification Message | ItemAggregation
Notification Message | Reference
Order Builder | OrderBuilderConstraint
Organisation | DefaultImage
Person | DefaultImage
Person | ERP5User
...
...
bt5/erp5_base/bt/template_property_sheet_id_list
View file @
b1211f98
CurrencyConstraint
LoginConstraint
OrderBuilderConstraint
PreviousCausalityMovementGroup
TemplateToolERP5LoginUserManagerConstraint
CareerConstraint
\ 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