Commit bbb51ff1 authored by Titouan Soulard's avatar Titouan Soulard

erp5_core: cleanup, remove useless methods

parent 8a2bf6ac
Pipeline #39170 failed with stage
in 0 seconds
...@@ -32,7 +32,6 @@ from Acquisition import aq_base ...@@ -32,7 +32,6 @@ from Acquisition import aq_base
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLMatrix import XMLMatrix from Products.ERP5Type.XMLMatrix import XMLMatrix
from erp5.component.document.Movement import Movement
from erp5.component.document.Amount import Amount from erp5.component.document.Amount import Amount
class InventoryLine(XMLMatrix, Amount): class InventoryLine(XMLMatrix, Amount):
...@@ -60,15 +59,6 @@ class InventoryLine(XMLMatrix, Amount): ...@@ -60,15 +59,6 @@ class InventoryLine(XMLMatrix, Amount):
, PropertySheet.ItemAggregation , PropertySheet.ItemAggregation
) )
security.declareProtected(Permissions.AccessContentsInformation,
'hasCellContent')
def hasCellContent(self, base_id="movement"):
"""
Returns True is the line contains cells.
"""
cell_range = XMLMatrix.getCellRange(self, base_id=base_id)
return (cell_range is not None and len(cell_range) > 0)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getQuantity') 'getQuantity')
def getQuantity(self): def getQuantity(self):
...@@ -97,7 +87,7 @@ class InventoryLine(XMLMatrix, Amount): ...@@ -97,7 +87,7 @@ class InventoryLine(XMLMatrix, Amount):
return self.getInventory() return self.getInventory()
else: else:
total_quantity = 0.0 total_quantity = 0.0
for cell in self.getCellValueList(base_id='movement'): for cell in self.getCellValueList(base_id='cell'):
if cell.getInventory() is not None: if cell.getInventory() is not None:
total_quantity += cell.getInventory() total_quantity += cell.getInventory()
return total_quantity return total_quantity
...@@ -111,26 +101,7 @@ class InventoryLine(XMLMatrix, Amount): ...@@ -111,26 +101,7 @@ class InventoryLine(XMLMatrix, Amount):
return self.getPrice() return self.getPrice()
else: else:
total_price = 0.0 total_price = 0.0
for cell in self.getCellValueList(base_id='movement'): for cell in self.getCellValueList(base_id='cell'):
if cell.getPrice() is not None: if cell.getPrice() is not None and cell.getInventory() is not None:
total_price += cell.getPrice() total_price += cell.getPrice() * cell.getInventory()
return total_price return total_price
# Inventory cataloging
security.declareProtected(Permissions.AccessContentsInformation,
'getConvertedInventory')
def getConvertedInventory(self):
"""
provides a default inventory value - None since
no inventory was defined.
"""
return self.getInventory() # XXX quantity unit is missing
# Required for indexing
security.declareProtected(Permissions.AccessContentsInformation,
'getInventoriatedQuantity')
def getInventoriatedQuantity(self):
"""
Take into account efficiency in converted target quantity
"""
return Movement.getInventoriatedQuantity(self)
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