Commit 275a868a authored by Titouan Soulard's avatar Titouan Soulard

erp5_trade: SPLIT remove now-useless `isInventoryMovement` getter

Also: add `getTotalQuantity`. Why?
parent 90cd4d73
Pipeline #38692 failed with stage
in 0 seconds
...@@ -29,7 +29,6 @@ from AccessControl import ClassSecurityInfo ...@@ -29,7 +29,6 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.document.DeliveryCell import DeliveryCell from erp5.component.document.DeliveryCell import DeliveryCell
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
class InventoryOffsetCell(DeliveryCell): class InventoryOffsetCell(DeliveryCell):
""" """
...@@ -39,7 +38,6 @@ class InventoryOffsetCell(DeliveryCell): ...@@ -39,7 +38,6 @@ class InventoryOffsetCell(DeliveryCell):
meta_type = "ERP5 Inventory Offset Cell" meta_type = "ERP5 Inventory Offset Cell"
portal_type = "Inventory Offset Cell" portal_type = "Inventory Offset Cell"
add_permission = Permissions.AddPortalContent add_permission = Permissions.AddPortalContent
isInventoryMovement = ConstantGetter("isInventoryMovement", value=True)
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
...@@ -29,7 +29,6 @@ from AccessControl import ClassSecurityInfo ...@@ -29,7 +29,6 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.document.DeliveryLine import DeliveryLine from erp5.component.document.DeliveryLine import DeliveryLine
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
class InventoryOffsetLine(DeliveryLine): class InventoryOffsetLine(DeliveryLine):
""" """
...@@ -39,7 +38,6 @@ class InventoryOffsetLine(DeliveryLine): ...@@ -39,7 +38,6 @@ class InventoryOffsetLine(DeliveryLine):
meta_type = "ERP5 Inventory Offset Line" meta_type = "ERP5 Inventory Offset Line"
portal_type = "Inventory Offset Line" portal_type = "Inventory Offset Line"
add_permission = Permissions.AddPortalContent add_permission = Permissions.AddPortalContent
isInventoryMovement = ConstantGetter("isInventoryMovement", value=True)
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
...@@ -57,3 +55,31 @@ class InventoryOffsetLine(DeliveryLine): ...@@ -57,3 +55,31 @@ class InventoryOffsetLine(DeliveryLine):
, PropertySheet.VariationRange , PropertySheet.VariationRange
, PropertySheet.ItemAggregation , 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
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <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> </value>
</item> </item>
<item> <item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment