Add 'default rule' in account_statement_rule

The account_statement_rule is a nice module which takes a lot of work out of our hands. But IMO there can be another improvement to the module.

The module walks through a list of rules, checks them and if the rule applies, it gives the statement line back with an amount. When no rule applies, no statement line is added.

The improvement will be twofold:

  1. Based on the rule, statement lines are created with a certain amount. It is not required that the statement line should have the total amount, so multiple statement lines can be created. This is the normal behavior. The module however should check the pending amount and if it’s ‘0’, it should stop checking the other rules as they don’t make any sense anymore. This makes it possible to have more rules which is not necessarily needed because you can create multiple statement lines from one rule.
  2. When point 1. is working, default rule(s) can be created. Those rules are the last ones to be checked and basically are always ‘True’ so statement lines are always created. In my case I want to have two default rules, one for payment (creditor) and one for receiving (debitor) because both are always going to the default accounts and I get most of this kind of statement lines.

The whole idea is like the firewall. A set of rules which are checked from top to bottom and when one fits, the packet is allowed. At the end there is the default deny rule.

Any thoughts on this?

For me it is a mistake. The system should apply only the first matching rule.

I’m totally fine with that. But that’s not the case at the moment. When I have my default rule at the bottom, and there is another rule higher in the list, I get two statement lines for the same origin. Both rules are a match with the origin and both create a statement line with the amount and the account I set on the rule.

So when your idea was working, I should only get one statement line from the first rule with the right account. And that’s all I want :slight_smile:

The bug is fixed and now I get the the result I wanted. The fix should be in the next update hopefully.

1 Like