Commit e6660089 authored by Titouan Soulard's avatar Titouan Soulard

erp5_trade: add `getTotalQuantity` method to offset

parent 203310cf
...@@ -55,3 +55,31 @@ class InventoryOffsetLine(DeliveryLine): ...@@ -55,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