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
1a353a12
Commit
1a353a12
authored
Sep 17, 2024
by
Titouan Soulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_trade: do not show quantity on Order Line view when resource is not set or has variation axes
parent
c990e3cd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
18 deletions
+26
-18
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Movement_isQuantityEditable.py
...em/portal_skins/erp5_trade/Movement_isQuantityEditable.py
+4
-17
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Movement_isQuantityEnabled.py
...tem/portal_skins/erp5_trade/Movement_isQuantityEnabled.py
+22
-1
No files found.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Movement_isQuantityEditable.py
View file @
1a353a12
"""This script is used to know if quantity can be edited by user.
* If this is not a movement (line containing lines or cell), user
cannot edit this line which is just a container, but no actual movement.
* If this line has variation category list, then it means it's a line that
will contain cell, so it's already not possible to set quantity, user have
to create cells and set quantities on cells.
* If items are used, quantity is set by the item quantity.
"""
This script was used to know if quantity can be edited by user.
It is now kept for backward compatibility as it does the same as `Movement_isQuantityEnabled`.
"""
if
not
context
.
isMovement
():
return
False
if
context
.
getVariationCategoryList
(
omit_optional_variation
=
1
)
and
not
'Cell'
in
context
.
getPortalType
():
return
False
return
not
(
context
.
getResource
()
and
context
.
getResourceValue
().
getAggregatedPortalTypeList
())
return
context
.
Movement_isQuantityEnabled
()
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Movement_isQuantityEnabled.py
View file @
1a353a12
return
context
.
isMovement
()
and
not
context
.
getVariationCategoryList
()
"""
This script is used to know if quantity field should be displayed to user.
* If no resource is defined yet, user cannot see quantity, as we still don't
know if resource will have variations or items.
* If this is not a movement (line containing lines or cell), user cannot edit
this line which is just a container, but no actual movement.
* If the resource has variation base category list, then it means it's a line
that will contain cell, so it's already not possible to set quantity, user have
to create cells and set quantities on cells.
"""
if
context
.
getResource
()
is
None
:
return
False
if
not
context
.
isMovement
():
return
False
resource
=
context
.
getResourceValue
()
return
(
'Cell'
in
context
.
getPortalType
())
or
not
resource
.
getVariationBaseCategoryList
()
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