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
ff6c76fd
Commit
ff6c76fd
authored
Oct 28, 2019
by
Xiaowu Zhang
Committed by
Titouan Soulard
Mar 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_production_planning: reduce attribute access
parent
15572381
Changes
2
Hide 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 @
ff6c76fd
...
...
@@ -33,9 +33,10 @@ while tmp_date < stop_date:
tmp_date
=
addToDate
(
tmp_date
,
{
'day'
:
7
})
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'
),)):
line_list
.
append
((
int
(
product
.
getUid
()),
'%s/%s'
%
(
product
.
getReference
(),
product
.
getTitle
())))
if
context
.
getValidationState
()
in
(
'draft'
):
if
validation_state
in
(
'draft'
,
):
continue
# Now check existed production order to add more columns
product_uid
=
product
.
getUid
()
...
...
@@ -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
())
#Not lost already created cell
keyToId
=
context
.
keyToId
cell_get
=
context
.
get
for
cell_keys
in
context
.
getCellKeys
():
cell_id
=
context
.
keyToId
(
cell_keys
)
cell_id
=
keyToId
(
cell_keys
)
if
cell_id
is
not
None
:
cell
=
c
ontext
.
get
(
cell_id
)
cell
=
c
ell_
get
(
cell_id
)
if
cell
is
not
None
:
[
_
,
tmp_start_date
]
=
cell_keys
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 @
ff6c76fd
...
...
@@ -5,20 +5,26 @@ production_planning = state_change['object']
portal
=
production_planning
.
getPortalObject
()
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
():
cell_id
=
production_planning
.
keyToId
(
cell_keys
)
cell_id
=
keyToId
(
cell_keys
)
if
cell_id
is
not
None
:
cell
=
production_planning
.
get
(
cell_id
)
cell
=
get_cell
(
cell_id
)
if
cell
is
not
None
:
cell_quantity
=
cell
.
getQuantity
()
production_order_line
=
cell
.
getSpecialiseValue
()
if
production_order_line
:
if
production_order_line
.
getQuantity
()
!=
cell
.
getQuantity
()
:
production_order_line
.
edit
(
quantity
=
cell
.
getQuantity
()
)
if
production_order_line
.
getQuantity
()
!=
cell
_quantity
:
production_order_line
.
edit
(
quantity
=
cell
_quantity
)
portal
.
portal_workflow
.
doActionFor
(
production_order_line
,
"edit_action"
,
comment
=
'Modified by production planning %s'
%
production_planning
.
getRelativeUrl
()
)
elif
cell
.
getQuantity
()
:
comment
=
'Modified by production planning %s'
%
relative_url
)
elif
cell
_quantity
:
# It's a new cell, create producton order&production order line
[
resource_uid
,
start_date
]
=
cell_keys
# Check if it existes a production order for the date
...
...
@@ -26,7 +32,7 @@ for cell_keys in production_planning.getCellKeys():
'portal_type'
:
'Production Order'
,
'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
):
production_order
=
production_order_list
[
0
]
else
:
...
...
@@ -47,12 +53,12 @@ for cell_keys in production_planning.getCellKeys():
production_order_line
=
production_order
.
newContent
(
portal_type
=
'Production Order Line'
,
resource_uid
=
resource_uid
,
quantity
=
cell
.
getQuantity
()
)
quantity
=
cell
_quantity
)
cell
.
edit
(
specialise_value
=
production_order_line
)
portal
.
portal_workflow
.
doActionFor
(
production_order_line
,
"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'
):
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