Commit 6cbcb57c authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

define _getInputMovementList(), that helps to make DeliveryRule more simple.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32459 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 00f5b13c
......@@ -58,7 +58,6 @@ class InvoiceRule(DeliveryRule):
invoice movements should not be accountable either.
"""
return 0
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, **kw):
"""
......@@ -68,3 +67,20 @@ class InvoiceRule(DeliveryRule):
self.getPortalInvoiceMovementTypeList() + \
self.getPortalTaxMovementTypeList()
DeliveryRule.expand(self, applied_rule, **kw)
def _getInputMovementList(self, applied_rule):
"""Return list of movements from delivery"""
delivery = applied_rule.getDefaultCausalityValue()
movement_list = []
delivery_movement_type_list = self.getPortalInvoiceMovementTypeList() + \
self.getPortalTaxMovementTypeList()
if delivery is not None:
existing_movement_list = applied_rule.objectValues()
for movement in delivery.getMovementList(
portal_type=delivery_movement_type_list):
simulation_movement = self._getDeliveryRelatedSimulationMovement(
movement)
if simulation_movement is None or \
simulation_movement in existing_movement_list:
movement_list.append(movement)
return movement_list
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