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
275a868a
Commit
275a868a
authored
Dec 20, 2024
by
Titouan Soulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_trade: SPLIT remove now-useless `isInventoryMovement` getter
Also: add `getTotalQuantity`. Why?
parent
90cd4d73
Pipeline
#38692
failed with stage
in 0 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
5 deletions
+32
-5
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.InventoryOffsetCell.py
...em/portal_components/document.erp5.InventoryOffsetCell.py
+0
-2
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.InventoryOffsetLine.py
...em/portal_components/document.erp5.InventoryOffsetLine.py
+28
-2
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.InventoryOffsetLine.xml
...m/portal_components/document.erp5.InventoryOffsetLine.xml
+4
-1
No files found.
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.InventoryOffsetCell.py
View file @
275a868a
...
...
@@ -29,7 +29,6 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
erp5.component.document.DeliveryCell
import
DeliveryCell
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
class
InventoryOffsetCell
(
DeliveryCell
):
"""
...
...
@@ -39,7 +38,6 @@ class InventoryOffsetCell(DeliveryCell):
meta_type
=
"ERP5 Inventory Offset Cell"
portal_type
=
"Inventory Offset Cell"
add_permission
=
Permissions
.
AddPortalContent
isInventoryMovement
=
ConstantGetter
(
"isInventoryMovement"
,
value
=
True
)
# Declarative security
security
=
ClassSecurityInfo
()
...
...
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.InventoryOffsetLine.py
View file @
275a868a
...
...
@@ -29,7 +29,6 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
erp5.component.document.DeliveryLine
import
DeliveryLine
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
class
InventoryOffsetLine
(
DeliveryLine
):
"""
...
...
@@ -39,7 +38,6 @@ class InventoryOffsetLine(DeliveryLine):
meta_type
=
"ERP5 Inventory Offset Line"
portal_type
=
"Inventory Offset Line"
add_permission
=
Permissions
.
AddPortalContent
isInventoryMovement
=
ConstantGetter
(
"isInventoryMovement"
,
value
=
True
)
# Declarative security
security
=
ClassSecurityInfo
()
...
...
@@ -57,3 +55,31 @@ class InventoryOffsetLine(DeliveryLine):
,
PropertySheet
.
VariationRange
,
PropertySheet
.
ItemAggregation
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalQuantity'
)
def
getTotalQuantity
(
self
):
"""
Returns the quantity if no cell or the total quantity if cells
"""
if
not
self
.
hasCellContent
():
return
self
.
getQuantity
()
else
:
total_quantity
=
0.0
for
cell
in
self
.
getCellValueList
(
base_id
=
'movement'
):
if
cell
.
getQuantity
()
is
not
None
:
total_quantity
+=
cell
.
getQuantity
()
return
total_quantity
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalPrice'
)
def
getTotalPrice
(
self
):
"""
Returns the price if no cell or the total price if cells
"""
if
not
self
.
hasCellContent
():
return
self
.
getPrice
()
else
:
total_price
=
0.0
for
cell
in
self
.
getCellValueList
(
base_id
=
'movement'
):
if
cell
.
getPrice
()
is
not
None
:
total_price
+=
cell
.
getPrice
()
return
total_price
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.InventoryOffsetLine.xml
View file @
275a868a
...
...
@@ -35,7 +35,10 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
<tuple>
<string>
W: 60, 2: Arguments number differs from overridden \'getTotalQuantity\' method (arguments-differ)
</string>
<string>
W: 74, 2: Arguments number differs from overridden \'getTotalPrice\' method (arguments-differ)
</string>
</tuple>
</value>
</item>
<item>
...
...
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