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
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
d1a3c855
Commit
d1a3c855
authored
Apr 05, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
project task fast input
fix internal API mis-use and other small fixes See merge request
!1583
parents
940f40ce
b84bea2c
Pipeline
#20604
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project_trade/Delivery_updateTaskFastInputDialog.py
.../erp5_project_trade/Delivery_updateTaskFastInputDialog.py
+10
-16
No files found.
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project_trade/Delivery_updateTaskFastInputDialog.py
View file @
d1a3c855
"""At first call, this script prefill values for all tasks that are
"""At first call, this script prefill
s
values for all tasks that are
going to be created. If values are already there, this script check
if
going to be created. If values are already there, this script check
that
information
s are
correct.
information
is
correct.
"""
"""
context
.
log
(
'source_project_title'
,
source_project_title
)
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
line_portal_type
=
"Sale Order Line"
line_portal_type
=
"Sale Order Line"
request
=
context
.
REQUEST
request
=
context
.
REQUEST
from
string
import
zfill
from
string
import
zfill
from
Products.
ERP5Type.Document
import
newTempBase
from
Products.
PythonScripts.standard
import
Object
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
context
.
log
(
'original listbox'
,
listbox
)
initial_value_dict
=
{}
initial_value_dict
=
{}
for
line
in
(
listbox
or
[]):
for
line
in
(
listbox
or
[]):
initial_value_dict
[
line
[
'listbox_key'
]]
=
line
initial_value_dict
[
line
[
'listbox_key'
]]
=
line
...
@@ -19,7 +17,7 @@ listbox = []
...
@@ -19,7 +17,7 @@ listbox = []
validation_errors
=
{}
validation_errors
=
{}
def
getRecursiveLineList
(
current
,
line_list
):
def
getRecursiveLineList
(
current
,
line_list
):
# We parse recursively all delivery line and we keep only ones
# We parse recursively all delivery line and we keep only ones
# without child
s
# without child
sub_line_list
=
current
.
objectValues
(
portal_type
=
line_portal_type
)
sub_line_list
=
current
.
objectValues
(
portal_type
=
line_portal_type
)
if
len
(
sub_line_list
)
==
0
:
if
len
(
sub_line_list
)
==
0
:
if
current
.
getPortalType
()
==
line_portal_type
:
if
current
.
getPortalType
()
==
line_portal_type
:
...
@@ -29,13 +27,10 @@ def getRecursiveLineList(current, line_list):
...
@@ -29,13 +27,10 @@ def getRecursiveLineList(current, line_list):
getRecursiveLineList
(
sub_line
,
line_list
)
getRecursiveLineList
(
sub_line
,
line_list
)
line_list
=
[]
line_list
=
[]
getRecursiveLineList
(
context
,
line_list
)
getRecursiveLineList
(
context
,
line_list
)
context
.
log
(
"line_list"
,
line_list
)
i
=
1
i
=
1
project_search_dict
=
{}
project_search_dict
=
{}
portal
=
context
.
getPortalObject
()
for
line
in
line_list
:
for
line
in
line_list
:
line_dict
=
{}
line_dict
=
{}
#line_dict['listbox_key'] = "%s" % line_id
key
=
zfill
(
i
,
3
)
key
=
zfill
(
i
,
3
)
for
property_name
in
(
'title'
,
'quantity_unit_title'
,
'quantity'
,
for
property_name
in
(
'title'
,
'quantity_unit_title'
,
'quantity'
,
'resource_title'
,
'total_price'
,
'price'
,
'resource_title'
,
'total_price'
,
'price'
,
...
@@ -65,13 +60,13 @@ for line in line_list:
...
@@ -65,13 +60,13 @@ for line in line_list:
else
:
else
:
line_dict
[
'source_project_relative_url'
]
=
result
[
0
].
getRelativeUrl
()
line_dict
[
'source_project_relative_url'
]
=
result
[
0
].
getRelativeUrl
()
if
error_message
:
if
error_message
:
error
=
newTempBase
(
context
,
key
)
validation_errors
[
'listbox_source_project_title_new_%s'
%
key
]
=
Object
(
error
.
edit
(
error_text
=
error_message
)
field_id
=
'listbox_source_project_title_new_%s'
%
key
,
validation_errors
[
'listbox_source_project_title_new_%s'
%
key
]
=
error
getMessage
=
lambda
translateString
,
message
=
error_message
:
translateString
(
message
),
)
listbox
.
append
(
line_dict
)
listbox
.
append
(
line_dict
)
i
+=
1
i
+=
1
context
.
log
(
'listbox'
,
listbox
)
context
.
Base_updateDialogForm
(
listbox
=
listbox
,
update
=
1
,
kw
=
kw
)
context
.
Base_updateDialogForm
(
listbox
=
listbox
,
update
=
1
,
kw
=
kw
)
if
len
(
validation_errors
):
if
len
(
validation_errors
):
...
@@ -101,6 +96,5 @@ if create and len(validation_errors) == 0:
...
@@ -101,6 +96,5 @@ if create and len(validation_errors) == 0:
destination_section
=
delivery_line
.
getDestinationSection
(),
destination_section
=
delivery_line
.
getDestinationSection
(),
destination_decision
=
delivery_line
.
getDestinationDecision
())
destination_decision
=
delivery_line
.
getDestinationDecision
())
return
context
.
Base_redirect
(
form_id
,
keep_items
=
dict
(
return
context
.
Base_redirect
(
form_id
,
keep_items
=
dict
(
portal_status_message
=
translateString
(
'%s Tasks Created.'
%
(
len
(
listbox
),))))
portal_status_message
=
translateString
(
'${task_count} Tasks Created.'
,
mapping
=
{
'task_count'
:
len
(
listbox
)})))
return
context
.
Delivery_viewTaskFastInputDialog
(
listbox
=
listbox
,
**
kw
)
return
context
.
Delivery_viewTaskFastInputDialog
(
listbox
=
listbox
,
**
kw
)
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