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
Titouan Soulard
erp5
Commits
c990e3cd
Commit
c990e3cd
authored
Sep 17, 2024
by
Titouan Soulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_trade: disallow setting items on Order Line view when Product has variations
parent
96ca750d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Movement_isAggregateItemListEnabled.py
...l_skins/erp5_trade/Movement_isAggregateItemListEnabled.py
+10
-12
No files found.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Movement_isAggregateItemListEnabled.py
View file @
c990e3cd
"""This script is an helper to replace complex TALES expression
for Base_viewTradeFieldLibrary/my_view_mode_aggregate_title_list.enable
"""
# If the resource accepts items, and the context is a movements (ie. not a line
# already containing cells or line that has variations but not cells yet)
if
context
.
getResource
()
and
context
.
getResourceValue
().
getAggregatedPortalTypeList
()
\
and
context
.
isMovement
()
\
and
((
'Cell'
in
context
.
getPortalType
())
or
not
context
.
getVariationCategoryList
()):
return
True
This script is used to know if a Line or Cell can use Items.
"""
# If the movement already has an aggregate, display it.
if
context
.
getAggregate
():
return
True
# If there's not resource yet, we give a chance to set an item.
if
context
.
getResource
()
is
None
and
context
.
getPortalItemTypeList
():
return
True
# If there is a resource and the context is a movement...
if
context
.
getResource
()
and
context
.
isMovement
():
resource
=
context
.
getResourceValue
()
# ...then the resource must accept Items and not use variations
# (in this case, Items are to be set on cells).
if
resource
.
getAggregatedPortalTypeList
()
and
\
((
'Cell'
in
context
.
getPortalType
())
or
not
resource
.
getVariationBaseCategoryList
()):
return
True
return
False
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