Fix mess when recomputing total amount on invoices

The fix improves the code that manages the recomputation of new-style fields. The code that *prepares* the recomputation is *always* executed, while the code that *actually* recomputes the fields may be skipped with a flag in the context.

Fixes #1456