[15.0][OU-FIX] fix hr.expense account.move and lines #4577
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix the value of several fields on
account.move
andaccount.move.line
records linked tohr.expense
records.this computes
account.move.line.exclude_from_invoice_tab
differently 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_tab
correctly 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.move
without 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.move
records not directly linked tohr.expense.sheet
records, but linked to anhr.expense
record through theiraccount.move.line
records, since this is howaccount.move._payment_state_matters()
selects the records.