#3920 (Lino registers the voucher even when exception happens)
by Luc Saffre · in Developers · assigned to Luc Saffre
Summary
For example a journal entry after "No account specified". This can be very irritating.
Children
Comments
- 5 years, 9 months ago by Luc Saffre about #3920 (Lino registers the voucher even when exception happens) : Correction: no. let's assign the number already in full_clean(), i.e. as soon as it is saved for the first time. Because in Presto we have orders that can remain in state "waiting" for quite some time and they should have their number during this time because the number is used e.g. when the documen...
- 5 years, 9 months ago by Luc Saffre about #3920 (Lino registers the voucher even when exception happens) : It's about when to assign the number of a voucher. Until now it was in full_clean(), but I now moved it to register_voucher(). The number of a voucher can remain blank until it is registered. But once it has been assigned, Lino doesn't touch it any more even when the voucher gets de-registered.
- 5 years, 9 months ago by Luc Saffre about #3920 (Lino registers the voucher even when exception happens) : The solution might be to change Model.set_workflow_state() so that save() on the voucher is called only after_state_changed(). Also remove the side effect (self.save()) in get_wanted_movements() of BankStatement and PaymentOrder. I will now wait for the test results before thinking further.
- 5 years, 9 months ago by Luc Saffre about #3920 (Lino registers the voucher even when exception happens) : Yes, movements are currently created *after* having changed the state because otherwise the match isn't correct. The logic with after/before state change is not healthy. We should collect the Movement objects (which would raise our warning), then set the state, then save() them all.