Commit 04f0c24c authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fix typos and improve comments.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30676 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent deb61379
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, interfaces from Products.ERP5Type import Permissions, interfaces
from Products.ERP5.Document.Amount import Amount
class AmountGeneratorMixin: class AmountGeneratorMixin:
""" """
...@@ -44,16 +45,16 @@ class AmountGeneratorMixin: ...@@ -44,16 +45,16 @@ class AmountGeneratorMixin:
# Declarative interfaces # Declarative interfaces
zope.interface.implements(interfaces.IAmountGenerator,) zope.interface.implements(interfaces.IAmountGenerator,)
# Declarative interfaces
security.declareProtected(Permissions.AccessContentsInformation, 'getAggregatedAmountList') security.declareProtected(Permissions.AccessContentsInformation, 'getAggregatedAmountList')
def getAggregatedAmountList(self, context, movement_list=None, rounding=False): def getAggregatedAmountList(self, context, movement_list=None, rounding=False):
""" """
NOTE: very draft placeholder NOTE: very draft placeholder
""" """
# Generic Transformation Algorithm # Generic Transformation Algorithm
# the same algorith should apply to payroll, taxes and MRP transformations # the same algorithm should be applied to payroll, taxes and MRP
# transformations
# Set the common arbitrary base amounts in a dictionnary # Set the common arbitrary base amounts in a dictionary
base_amount = { base_amount = {
'delivery': 1, 'delivery': 1,
'employee': 100, 'employee': 100,
...@@ -80,7 +81,8 @@ class AmountGeneratorMixin: ...@@ -80,7 +81,8 @@ class AmountGeneratorMixin:
ton=(line.getQuantityUnit() == 'ton') * line.getQuantity(), ton=(line.getQuantityUnit() == 'ton') * line.getQuantity(),
# more base applications could be set here # more base applications could be set here
)) ))
# Feed the result with trade model (wihch must be ordered through constraint resolution) # Feed the result with trade model (which must be ordered through
# constraint resolution)
for trade_model_line in trade_model.contentValues(portal_type="Trade Model Line"): for trade_model_line in trade_model.contentValues(portal_type="Trade Model Line"):
if trade_model_line.getResource(): if trade_model_line.getResource():
# This line has a resource, it is an output line # This line has a resource, it is an output line
...@@ -100,16 +102,16 @@ class AmountGeneratorMixin: ...@@ -100,16 +102,16 @@ class AmountGeneratorMixin:
ungrouped_result.append(amount) ungrouped_result.append(amount)
else: else:
# This line has a no resource, it is an intermediate line # This line has a no resource, it is an intermediate line
value = base_amount[trade_model_line.getBaseApplication()] value = base_amount[trade_model_line.getBaseApplication()] * \
*(trade_model_line.getQuantity() or 1.0) (trade_model_line.getQuantity() or 1.0) * \
(trade_model_line.getPrice() or 1.0)
# Quantity is used as a multiplier # Quantity is used as a multiplier
*(trade_model_line.getPrice() or 1.0)
# Price is used as a ratio (also a kind of multiplier) # Price is used as a ratio (also a kind of multiplier)
for key in trade_model_line.getBaseContribution(): for key in trade_model_line.getBaseContribution():
base_amount[key] += value base_amount[key] += value
# Compute the grouped result - It is still unkonwn if grouping should happen # Compute the grouped result - It is still unknown if grouping
# here and in which way - XXX # should happen here and in which way - XXX
grouped_result = SomeMovementGroup(ungrouped_result) grouped_result = SomeMovementGroup(ungrouped_result)
# Return result # Return result
......
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