[15.0][OU-FIX] fix hr.expense account.move and lines#4577
Conversation
06a9b31 to
ab1834d
Compare
|
I need why this is needed with an example dataset that fails previously. In general, I don't want to call the general method |
|
@pedrobaeza could you tell me in which form this dataset should be presented? about |
|
I mean the records with their field values you have previous the migration and the result after for requiring this recomputation. |
fix the value of several fields on account.move and account.move.line records linked to hr.expense records. Co-authored-by: Miquel Raïch <miquel.raich@forgeflow.com>
ab1834d to
52f5b5a
Compare
fiscalyear_lock_date check prevent modifying old move, but some field should be recomputed to be correct in 15.0.
52f5b5a to
934b1b1
Compare
…recompute The payment_state rework picked from OCA#4577 rebuilt _fill_payment_state keeping only the fiscalyear_lock_date bypass, dropping the reconciliation bypass that 4ac3a16 had introduced for the same _compute_amount() pass. On databases where a reconciled expense move's recomputed amount_total disagrees with its stored line balances, the recompute fires _inverse_amount_total -> write() on reconciled lines -> UserError, aborting the whole 14->15 upgrade. Restore the upstream-merged double bypass.
fix the value of several fields on
account.moveandaccount.move.linerecords linked tohr.expenserecords.this computes
account.move.line.exclude_from_invoice_tabdifferently than #4386 did. the goal remains the same: it should be true for destination lines. the code was assuming that destination lines where the ones with a quantity of 0, but this does not work, as odoo 14 does not set a quantity on those lines and the default value for this field is 1. instead, this field is computed by checking that the account is of type"payable".with
exclude_from_invoice_tabcorrectly set, it is now safe to callaccount.move._compute_amount()to correctly recompute several fields (always_tax_exigible,amount_residual,amount_residual_signed,amount_untaxed,amount_untaxed_signed,payment_state) of theaccount.movewithout changing accounting data.account.move.write()checks that reconciled moves are not changed, and with this code, it succeeds.this code also recomputes these fields for
account.moverecords not directly linked tohr.expense.sheetrecords, but linked to anhr.expenserecord through theiraccount.move.linerecords, since this is howaccount.move._payment_state_matters()selects the records.