Commit 22880a4e authored by Yoshinori Okuji's avatar Yoshinori Okuji

Use the portal method to retrieve invoice movement types instead of hardcoding them.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37591 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 412c3179
...@@ -46,12 +46,14 @@ class InvoiceMovementGroup(MovementGroup): ...@@ -46,12 +46,14 @@ class InvoiceMovementGroup(MovementGroup):
def _getInvoiceUid(self, simulation_movement): def _getInvoiceUid(self, simulation_movement):
parent_rule = simulation_movement.getParentValue() parent_rule = simulation_movement.getParentValue()
portal = self.getPortalObject()
invoice_movement_types = portal.getPortalInvoiceMovementTypeList()
while not parent_rule.isRootAppliedRule(): while not parent_rule.isRootAppliedRule():
parent_simulation_movement = parent_rule.getParentValue() parent_simulation_movement = parent_rule.getParentValue()
grand_parent_rule = parent_simulation_movement.getParentValue() grand_parent_rule = parent_simulation_movement.getParentValue()
parent_delivery = parent_simulation_movement.getDeliveryValue() parent_delivery = parent_simulation_movement.getDeliveryValue()
if parent_delivery is not None and \ if parent_delivery is not None and \
parent_delivery.getPortalType() == 'Invoice Line': parent_delivery.getPortalType() in invoice_movement_types:
return parent_delivery.getExplanationValue().getUid() return parent_delivery.getExplanationValue().getUid()
parent_rule = grand_parent_rule parent_rule = grand_parent_rule
return None return None
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