Commit 4ee585d8 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ERP5/Document: Fix pylint warnings.

parent d672defe
This diff is collapsed.
This diff is collapsed.
......@@ -34,64 +34,62 @@ from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from Products.ERP5.Document.DeliveryCell import DeliveryCell
class InventoryCell(DeliveryCell):
"""
An InventoryCell allows to define specific inventory
for each variation of a resource in an inventory line.
"""
"""
An InventoryCell allows to define specific inventory
for each variation of a resource in an inventory line.
"""
meta_type = 'ERP5 Inventory Cell'
portal_type = 'Inventory Cell'
add_permission = Permissions.AddPortalContent
isInventoryMovement = ConstantGetter('isInventoryMovement', value=True)
meta_type = 'ERP5 Inventory Cell'
portal_type = 'Inventory Cell'
add_permission = Permissions.AddPortalContent
isInventoryMovement = ConstantGetter('isInventoryMovement', value=True)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.InventoryMovement
, PropertySheet.Task
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.Predicate
, PropertySheet.MappedValue
, PropertySheet.ItemAggregation
)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.InventoryMovement
, PropertySheet.Task
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.Predicate
, PropertySheet.MappedValue
, PropertySheet.ItemAggregation
)
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalInventory')
def getTotalInventory(self):
"""
Returns the inventory, as cells are not supposed to contain more cells.
"""
return self.getInventory()
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalInventory')
def getTotalInventory(self):
"""
Returns the inventory, as cells are not supposed to contain more cells.
"""
security.declareProtected(Permissions.AccessContentsInformation, 'getQuantity')
def getQuantity(self):
"""
Computes a quantity which allows to reach inventory
"""
if not self.hasCellContent():
# First check if quantity already exists
quantity = self._baseGetQuantity()
if quantity not in (0.0, 0, None):
return quantity
# Make sure inventory is defined somewhere (here or parent)
if getattr(aq_base(self), 'inventory', None) is None:
return 0.0 # No inventory defined, so no quantity
return self.getInventory()
else:
return None
security.declareProtected(Permissions.AccessContentsInformation, 'getQuantity')
def getQuantity(self):
"""
Computes a quantity which allows to reach inventory
"""
if not self.hasCellContent():
# First check if quantity already exists
quantity = self._baseGetQuantity()
if quantity not in (0.0, 0, None):
return quantity
# Make sure inventory is defined somewhere (here or parent)
if getattr(aq_base(self), 'inventory', None) is None:
return 0.0 # No inventory defined, so no quantity
return self.getInventory()
else:
return None
# 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
# 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
\ No newline at end of file
......@@ -36,112 +36,110 @@ from Products.ERP5.Document.Movement import Movement
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
class InventoryLine(DeliveryLine):
"""
An Inventory Line describe the inventory of a resource, by variations.
"""
meta_type = 'ERP5 Inventory Line'
portal_type = 'Inventory Line'
add_permission = Permissions.AddPortalContent
isInventoryMovement = ConstantGetter('isInventoryMovement', value=True)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.InventoryMovement
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.VariationRange
, PropertySheet.ItemAggregation
)
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalInventory')
def getTotalInventory(self):
"""
An Inventory Line describe the inventory of a resource, by variations.
Returns the inventory if no cell or the total inventory if cells
"""
meta_type = 'ERP5 Inventory Line'
portal_type = 'Inventory Line'
add_permission = Permissions.AddPortalContent
isInventoryMovement = ConstantGetter('isInventoryMovement', value=True)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.InventoryMovement
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.VariationRange
, PropertySheet.ItemAggregation
)
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalInventory')
def getTotalInventory(self):
"""
Returns the inventory if no cell or the total inventory if cells
"""
if not self.hasCellContent():
return self.getInventory()
else:
total_quantity = 0.0
for cell in self.getCellValueList(base_id='movement'):
if cell.getInventory() is not None:
total_quantity += cell.getInventory()
return total_quantity
security.declareProtected(Permissions.AccessContentsInformation,
'getQuantity')
def getQuantity(self):
"""
Computes a quantity which allows to reach inventory
"""
if not self.hasCellContent():
# First check if quantity already exists
quantity = self._baseGetQuantity()
if quantity not in (0.0,0,None):
return quantity
# Make sure inventory is defined somewhere (here or parent)
inventory = getattr(aq_base(self), 'inventory', None)
if inventory is not None:
return inventory
if not self.hasCellContent():
return self.getInventory()
else:
total_quantity = 0.0
for cell in self.getCellValueList(base_id='movement'):
if cell.getInventory() is not None:
total_quantity += cell.getInventory()
return total_quantity
security.declareProtected(Permissions.AccessContentsInformation,
'getQuantity')
def getQuantity(self):
"""
Computes a quantity which allows to reach inventory
"""
if not self.hasCellContent():
# First check if quantity already exists
quantity = self._baseGetQuantity()
if quantity not in (0.0,0,None):
return quantity
else:
return None
# 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)
# XXX: Dirty but required for erp5_banking_core
getBaobabSourceUid = lambda x: x.getSourceUid()
getBaobabSourceUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationUid = lambda x: x.getDestinationUid()
getBaobabDestinationUid__roles__ = PermissionRole(Permissions.View)
getBaobabSourceSectionUid = lambda x: x.getSourceSectionUid()
getBaobabSourceSectionUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationSectionUid = lambda x: x.getDestinationSectionUid()
getBaobabDestinationSectionUid__roles__ = PermissionRole(Permissions.View)
getBaobabSourcePaymentUid = lambda x: x.getSourcePaymentUid()
getBaobabSourcePaymentUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationPaymentUid = lambda x: x.getDestinationPaymentUid()
getBaobabDestinationPaymentUid__roles__ = PermissionRole(Permissions.View)
getBaobabSourceFunctionUid = lambda x: x.getSourceFunctionUid()
getBaobabSourceFunctionUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationFunctionUid = lambda x: x.getDestinationFunctionUid()
getBaobabDestinationFunctionUid__roles__ = PermissionRole(Permissions.View)
getBaobabSourceProjectUid = lambda x: x.getSourceProjectUid()
getBaobabSourceProjectUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationProjectUid = lambda x: x.getDestinationProjectUid()
getBaobabDestinationProjectUid__roles__ = PermissionRole(Permissions.View)
# Make sure inventory is defined somewhere (here or parent)
inventory = getattr(aq_base(self), 'inventory', None)
if inventory is not None:
return inventory
return quantity
else:
return None
# 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)
# XXX: Dirty but required for erp5_banking_core
getBaobabSourceUid = lambda x: x.getSourceUid()
getBaobabSourceUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationUid = lambda x: x.getDestinationUid()
getBaobabDestinationUid__roles__ = PermissionRole(Permissions.View)
getBaobabSourceSectionUid = lambda x: x.getSourceSectionUid()
getBaobabSourceSectionUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationSectionUid = lambda x: x.getDestinationSectionUid()
getBaobabDestinationSectionUid__roles__ = PermissionRole(Permissions.View)
getBaobabSourcePaymentUid = lambda x: x.getSourcePaymentUid()
getBaobabSourcePaymentUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationPaymentUid = lambda x: x.getDestinationPaymentUid()
getBaobabDestinationPaymentUid__roles__ = PermissionRole(Permissions.View)
getBaobabSourceFunctionUid = lambda x: x.getSourceFunctionUid()
getBaobabSourceFunctionUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationFunctionUid = lambda x: x.getDestinationFunctionUid()
getBaobabDestinationFunctionUid__roles__ = PermissionRole(Permissions.View)
getBaobabSourceProjectUid = lambda x: x.getSourceProjectUid()
getBaobabSourceProjectUid__roles__ = PermissionRole(Permissions.View)
getBaobabDestinationProjectUid = lambda x: x.getDestinationProjectUid()
getBaobabDestinationProjectUid__roles__ = PermissionRole(Permissions.View)
\ No newline at end of file
......@@ -33,59 +33,57 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.DeliveryCell import DeliveryCell
class OrderCell(DeliveryCell):
"""
A OrderCell allows to define specific quantities
for each variation of a resource in a delivery line.
"""
"""
A OrderCell allows to define specific quantities
for each variation of a resource in a delivery line.
"""
meta_type = 'ERP5 Order Cell'
portal_type = 'Order Cell'
isCell = 1
meta_type = 'ERP5 Order Cell'
portal_type = 'Order Cell'
isCell = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.Arrow
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.Predicate
, PropertySheet.MappedValue
, PropertySheet.ItemAggregation
)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.Arrow
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.Predicate
, PropertySheet.MappedValue
, PropertySheet.ItemAggregation
)
def reindexObject(self, *k, **kw):
"""
Reindex children and simulation
"""
self.recursiveReindexObject(*k,**kw)
def reindexObject(self, *k, **kw):
"""
Reindex children and simulation
"""
self.recursiveReindexObject(*k,**kw)
security.declareProtected(Permissions.AccessContentsInformation,
'isMovement')
def isMovement(self):
"""
should be considered as a movement if the parent does not have sub lines
"""
return not self.getParentValue().hasLineContent()
security.declareProtected(Permissions.AccessContentsInformation,
'isMovement')
def isMovement(self):
"""
should be considered as a movement if the parent does not have sub lines
"""
return not self.getParentValue().hasLineContent()
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalPrice')
def getTotalPrice(self, default=0.0, *args, **kw):
"only return a value if self is a movement"
if not self.isMovement():
return default
return DeliveryCell.getTotalPrice(self, default=default, *args, **kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalQuantity')
def getTotalQuantity(self, default=0.0, *args, **kw):
"only return a value if self is a movement"
if not self.isMovement():
return default
return DeliveryCell.getTotalQuantity(self, default=default, *args, **kw)
def getTotalPrice(self, default=0.0, *args, **kw):
"only return a value if self is a movement"
if not self.isMovement():
return default
return DeliveryCell.getTotalPrice(self, default=default, *args, **kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalQuantity')
def getTotalQuantity(self, default=0.0, *args, **kw):
"only return a value if self is a movement"
if not self.isMovement():
return default
return DeliveryCell.getTotalQuantity(self, default=default, *args, **kw)
\ No newline at end of file
......@@ -32,27 +32,26 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.DeliveryLine import DeliveryLine
class OrderLine(DeliveryLine):
"""
A order line defines quantity and price
"""
"""
A order line defines quantity and price
"""
meta_type = 'ERP5 Order Line'
portal_type = 'Order Line'
meta_type = 'ERP5 Order Line'
portal_type = 'Order Line'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.DublinCore
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.VariationRange
, PropertySheet.ItemAggregation
)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.DublinCore
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.VariationRange
, PropertySheet.ItemAggregation
)
\ No newline at end of file
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