Bad where clause in sql expression when getting currencies in reconcile wizard
When the reconciliation wizard is executed and an attempt is made to retrieve the list of currencies to reconcile for the account and party, an error occurs if it does not receive a party as a parameter (it should explicitly receive 'party = None' since an instance of a party without an identifier is indeed valid).
The 'where' clause of this method displays the following:
where = ((line.reconciliation == Null)
& (line.account == account.id)
& (line.party == party.id if party else None))
The result of evaluating the clause is something similar to this:
((("reconciliation" IS NULL) AND ("account" = 1)) AND None)
In fact, this same clause is defined in the 'get_parties' method and is handled differently:
where = ((line.reconciliation == Null)
& (line.account == account.id))
if party:
where &= (line.party == party.id)
This time, the result looks like this:
((("reconciliation" IS NULL) AND ("account" = 1)) AND ("party" IS NULL))
My suggestion is that it should be handled in the same way, or alternatively, set a parenthesis to search for an account without a third party:
& (line.party == (party.id if party else None)))
Or, in reality, to maintain consistency, it can also be handled as in the 'get_parties()' method.