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
Léo-Paul Géneau
erp5
Commits
f470d414
Commit
f470d414
authored
Jul 29, 2019
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_pdm_ui_test: support Purchase and Internal deliveries too
parent
1a1498fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
24 deletions
+34
-24
bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.py
.../portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.py
+16
-7
bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.xml
...portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.xml
+1
-1
bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_deleteData.py
...Item/portal_skins/erp5_pdm_ui_test/PdmZuite_deleteData.py
+17
-16
No files found.
bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.py
View file @
f470d414
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
order_portal_type
=
"
Sale Order"
order_line_portal_type
=
"
Sale Order Line"
delivery_portal_type
=
"
Sale Packing List"
delivery_line_portal_type
=
"
Sale Packing List Line"
order_portal_type
=
"
%s Order"
%
delivery_type
order_line_portal_type
=
"
%s Order Line"
%
delivery_type
delivery_portal_type
=
"
%s Packing List"
%
delivery_type
delivery_line_portal_type
=
"
%s Packing List Line"
%
delivery_type
delivery_id
=
"erp5_pdm_ui_test_delivery"
delivery_title
=
"erp5_pdm_ui_test_delivery_title"
...
...
@@ -13,10 +13,19 @@ source_node_id = "erp5_pdm_ui_test_source_node"
destination_node_id
=
"erp5_pdm_ui_test_destination_node"
resource_id
=
"erp5_pdm_ui_test_product"
business_process
=
'business_process_module/
erp5_default_business_process'
business_process
_id
=
'
erp5_default_business_process'
quantity
=
1
business_process_module
=
portal
.
getDefaultModule
(
"Business Process"
)
business_process
=
getattr
(
business_process_module
,
business_process_id
,
None
)
if
business_process
is
None
:
business_process
=
business_process_module
.
newContent
(
portal_type
=
"Business Process"
,
id
=
business_process_id
,
reference
=
business_process_id
,
)
# Create an order or a packing list
if
state
in
[
'planned'
,
'ordered'
]:
module
=
portal
.
getDefaultModule
(
order_portal_type
)
...
...
@@ -28,7 +37,7 @@ if state in ['planned', 'ordered']:
source_section
=
'organisation_module/%s'
%
source_node_id
,
destination
=
'organisation_module/%s'
%
destination_node_id
,
destination_section
=
'organisation_module/%s'
%
destination_node_id
,
specialise
=
business_process
,
specialise
_value
=
business_process
,
start_date
=
DateTime
(),
)
order_line
=
order
.
newContent
(
...
...
@@ -51,7 +60,7 @@ else:
source_section
=
'organisation_module/%s'
%
source_node_id
,
destination
=
'organisation_module/%s'
%
destination_node_id
,
destination_section
=
'organisation_module/%s'
%
destination_node_id
,
specialise
=
business_process
,
specialise
_value
=
business_process
,
start_date
=
DateTime
(),
)
delivery_line
=
delivery
.
newContent
(
...
...
bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.xml
View file @
f470d414
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state
</string>
</value>
<value>
<string>
state
, delivery_type="Sale"
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_deleteData.py
View file @
f470d414
...
...
@@ -4,9 +4,6 @@ resource_portal_type = "Product"
node_portal_type
=
"Organisation"
site_portal_type
=
"Category"
order_portal_type
=
"Sale Order"
delivery_portal_type
=
"Sale Packing List"
resource_id
=
"erp5_pdm_ui_test_product"
source_node_id
=
"erp5_pdm_ui_test_source_node"
...
...
@@ -35,18 +32,22 @@ for site_id in (source_site_id, destination_site_id):
base_category
.
manage_delObjects
([
site_id
])
stool
=
portal
.
portal_simulation
# Delete order
module
=
portal
.
getDefaultModule
(
order_portal_type
)
if
getattr
(
module
,
delivery_id
,
None
)
is
not
None
:
delivery
=
getattr
(
module
,
delivery_id
)
stool
.
manage_delObjects
(
delivery
.
getCausalityRelatedIdList
(
portal_type
=
'Applied Rule'
))
module
.
manage_delObjects
([
delivery_id
])
# Delete delivery
module
=
portal
.
getDefaultModule
(
delivery_portal_type
)
if
getattr
(
module
,
delivery_id
,
None
)
is
not
None
:
delivery
=
getattr
(
module
,
delivery_id
)
stool
.
manage_delObjects
(
delivery
.
getCausalityRelatedIdList
(
portal_type
=
'Applied Rule'
))
module
.
manage_delObjects
([
delivery_id
])
for
delivery_type
in
(
"Internal"
,
"Purchase"
,
"Sale"
):
order_portal_type
=
delivery_type
+
" Order"
delivery_portal_type
=
delivery_type
+
" Packing List"
# Delete order
module
=
portal
.
getDefaultModule
(
order_portal_type
)
if
getattr
(
module
,
delivery_id
,
None
)
is
not
None
:
delivery
=
getattr
(
module
,
delivery_id
)
stool
.
manage_delObjects
(
delivery
.
getCausalityRelatedIdList
(
portal_type
=
'Applied Rule'
))
module
.
manage_delObjects
([
delivery_id
])
# Delete delivery
module
=
portal
.
getDefaultModule
(
delivery_portal_type
)
if
getattr
(
module
,
delivery_id
,
None
)
is
not
None
:
delivery
=
getattr
(
module
,
delivery_id
)
stool
.
manage_delObjects
(
delivery
.
getCausalityRelatedIdList
(
portal_type
=
'Applied Rule'
))
module
.
manage_delObjects
([
delivery_id
])
return
"Deleted Successfully."
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