Commit c549080c authored by Jérome Perrin's avatar Jérome Perrin

test if the tax rule will actually do something before applying it


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20557 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7347b3b9
......@@ -105,3 +105,13 @@ class TaxRule(DeliveryRule):
# Pass to base class
Rule.expand(self, applied_rule, force=force, **kw)
def test(self, context, *args, **kw):
"""Test if this rule can be applied.
We return false immediatly if the rule won't create any simulation
movement, to prevent creating an empty applied rule.
"""
if not (context.DeliveryMovement_getCorrespondingTaxLineList()):
return False
return DeliveryRule.test(self, context, *args, **kw)
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