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
Klaus Wölfel
erp5
Commits
573e3956
Commit
573e3956
authored
Oct 28, 2019
by
Xiaowu Zhang
Committed by
Klaus Wölfel
Apr 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_production_planning: reduce attribute access
parent
93e79cd0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
bt5/erp5_production_planning/SkinTemplateItem/portal_skins/erp5_production_planning/ProductionPlanning_getCellRange.py
...p5_production_planning/ProductionPlanning_getCellRange.py
+6
-3
bt5/erp5_production_planning/WorkflowTemplateItem/portal_workflow/production_planning_interaction_workflow/scripts/ProductionPlanning_applyProductionPlanningChanges.py
...ipts/ProductionPlanning_applyProductionPlanningChanges.py
+15
-9
No files found.
bt5/erp5_production_planning/SkinTemplateItem/portal_skins/erp5_production_planning/ProductionPlanning_getCellRange.py
View file @
573e3956
...
@@ -33,9 +33,10 @@ while tmp_date < stop_date:
...
@@ -33,9 +33,10 @@ while tmp_date < stop_date:
tmp_date
=
addToDate
(
tmp_date
,
{
'day'
:
7
})
tmp_date
=
addToDate
(
tmp_date
,
{
'day'
:
7
})
line_list
=
[]
line_list
=
[]
validation_state
=
context
.
getValidationState
()
for
product
in
portal
.
portal_catalog
(
portal_type
=
'Product'
,
product_line_relative_url
=
'product_line/car'
,
sort_on
=
((
'uid'
,
'ascending'
),)):
for
product
in
portal
.
portal_catalog
(
portal_type
=
'Product'
,
product_line_relative_url
=
'product_line/car'
,
sort_on
=
((
'uid'
,
'ascending'
),)):
line_list
.
append
((
int
(
product
.
getUid
()),
'%s/%s'
%
(
product
.
getReference
(),
product
.
getTitle
())))
line_list
.
append
((
int
(
product
.
getUid
()),
'%s/%s'
%
(
product
.
getReference
(),
product
.
getTitle
())))
if
context
.
getValidationState
()
in
(
'draft'
):
if
validation_state
in
(
'draft'
,
):
continue
continue
# Now check existed production order to add more columns
# Now check existed production order to add more columns
product_uid
=
product
.
getUid
()
product_uid
=
product
.
getUid
()
...
@@ -54,10 +55,12 @@ for product in portal.portal_catalog(portal_type='Product', product_line_relativ
...
@@ -54,10 +55,12 @@ for product in portal.portal_catalog(portal_type='Product', product_line_relativ
column_dict
[
tmp_start_date
.
Date
()]
=
'%s, week %s'
%
(
tmp_start_date
.
Date
(),
tmp_start_date
.
week
())
column_dict
[
tmp_start_date
.
Date
()]
=
'%s, week %s'
%
(
tmp_start_date
.
Date
(),
tmp_start_date
.
week
())
#Not lost already created cell
#Not lost already created cell
keyToId
=
context
.
keyToId
cell_get
=
context
.
get
for
cell_keys
in
context
.
getCellKeys
():
for
cell_keys
in
context
.
getCellKeys
():
cell_id
=
context
.
keyToId
(
cell_keys
)
cell_id
=
keyToId
(
cell_keys
)
if
cell_id
is
not
None
:
if
cell_id
is
not
None
:
cell
=
c
ontext
.
get
(
cell_id
)
cell
=
c
ell_
get
(
cell_id
)
if
cell
is
not
None
:
if
cell
is
not
None
:
[
_
,
tmp_start_date
]
=
cell_keys
[
_
,
tmp_start_date
]
=
cell_keys
if
tmp_start_date
not
in
column_dict
:
if
tmp_start_date
not
in
column_dict
:
...
...
bt5/erp5_production_planning/WorkflowTemplateItem/portal_workflow/production_planning_interaction_workflow/scripts/ProductionPlanning_applyProductionPlanningChanges.py
View file @
573e3956
...
@@ -5,20 +5,26 @@ production_planning = state_change['object']
...
@@ -5,20 +5,26 @@ production_planning = state_change['object']
portal
=
production_planning
.
getPortalObject
()
portal
=
production_planning
.
getPortalObject
()
created_production_order_dict
=
{}
created_production_order_dict
=
{}
keyToId
=
production_planning
.
keyToId
get_cell
=
production_planning
.
get
relative_url
=
production_planning
.
getRelativeUrl
()
catalog_method
=
portal
.
portal_catalog
for
cell_keys
in
production_planning
.
getCellKeys
():
for
cell_keys
in
production_planning
.
getCellKeys
():
cell_id
=
production_planning
.
keyToId
(
cell_keys
)
cell_id
=
keyToId
(
cell_keys
)
if
cell_id
is
not
None
:
if
cell_id
is
not
None
:
cell
=
production_planning
.
get
(
cell_id
)
cell
=
get_cell
(
cell_id
)
if
cell
is
not
None
:
if
cell
is
not
None
:
cell_quantity
=
cell
.
getQuantity
()
production_order_line
=
cell
.
getSpecialiseValue
()
production_order_line
=
cell
.
getSpecialiseValue
()
if
production_order_line
:
if
production_order_line
:
if
production_order_line
.
getQuantity
()
!=
cell
.
getQuantity
()
:
if
production_order_line
.
getQuantity
()
!=
cell
_quantity
:
production_order_line
.
edit
(
quantity
=
cell
.
getQuantity
()
)
production_order_line
.
edit
(
quantity
=
cell
_quantity
)
portal
.
portal_workflow
.
doActionFor
(
portal
.
portal_workflow
.
doActionFor
(
production_order_line
,
production_order_line
,
"edit_action"
,
"edit_action"
,
comment
=
'Modified by production planning %s'
%
production_planning
.
getRelativeUrl
()
)
comment
=
'Modified by production planning %s'
%
relative_url
)
elif
cell
.
getQuantity
()
:
elif
cell
_quantity
:
# It's a new cell, create producton order&production order line
# It's a new cell, create producton order&production order line
[
resource_uid
,
start_date
]
=
cell_keys
[
resource_uid
,
start_date
]
=
cell_keys
# Check if it existes a production order for the date
# Check if it existes a production order for the date
...
@@ -26,7 +32,7 @@ for cell_keys in production_planning.getCellKeys():
...
@@ -26,7 +32,7 @@ for cell_keys in production_planning.getCellKeys():
'portal_type'
:
'Production Order'
,
'portal_type'
:
'Production Order'
,
'delivery.start_date'
:
{
'query'
:
start_date
,
'type'
:
'date'
}
'delivery.start_date'
:
{
'query'
:
start_date
,
'type'
:
'date'
}
}
}
production_order_list
=
portal
.
portal_catalog
(
**
kw
)
production_order_list
=
catalog_method
(
**
kw
)
if
len
(
production_order_list
):
if
len
(
production_order_list
):
production_order
=
production_order_list
[
0
]
production_order
=
production_order_list
[
0
]
else
:
else
:
...
@@ -47,12 +53,12 @@ for cell_keys in production_planning.getCellKeys():
...
@@ -47,12 +53,12 @@ for cell_keys in production_planning.getCellKeys():
production_order_line
=
production_order
.
newContent
(
production_order_line
=
production_order
.
newContent
(
portal_type
=
'Production Order Line'
,
portal_type
=
'Production Order Line'
,
resource_uid
=
resource_uid
,
resource_uid
=
resource_uid
,
quantity
=
cell
.
getQuantity
()
)
quantity
=
cell
_quantity
)
cell
.
edit
(
specialise_value
=
production_order_line
)
cell
.
edit
(
specialise_value
=
production_order_line
)
portal
.
portal_workflow
.
doActionFor
(
portal
.
portal_workflow
.
doActionFor
(
production_order_line
,
production_order_line
,
"edit_action"
,
"edit_action"
,
comment
=
'Added by production planning %s'
%
production_planning
.
getRelativeUrl
()
)
comment
=
'Added by production planning %s'
%
relative_url
)
if
portal
.
portal_workflow
.
isTransitionPossible
(
production_planning
,
'apply'
):
if
portal
.
portal_workflow
.
isTransitionPossible
(
production_planning
,
'apply'
):
production_planning
.
apply
()
production_planning
.
apply
()
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