[18.0][FIX] hr_expense_invoice: Allow mixed expense reports (with and without invoices)#331
Open
dtec-landoo wants to merge 1 commit intoOCA:18.0from
Open
[18.0][FIX] hr_expense_invoice: Allow mixed expense reports (with and without invoices)#331dtec-landoo wants to merge 1 commit intoOCA:18.0from
dtec-landoo wants to merge 1 commit intoOCA:18.0from
Conversation
d47a79c to
9b7ad07
Compare
… without invoices)
9b7ad07 to
ac6157d
Compare
Author
|
Hi! I've just updated the PR. All the CI checks, tests, and Codecov coverage are now completely green. It is ready for review whenever you have a moment. Let me know if you need any further changes. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of the issue/feature:
Fixes an issue where expense reports containing a mix of expenses with an associated vendor bill and expenses without a vendor bill could not be processed, raising an "Invalid Operation" error.
Currently, the hr_expense_invoice module assumes that either all or none of the expenses in a report have an associated invoice. When a mixed report is submitted, the _check_can_create_move constraint and the _do_create_moves method fail to handle the non-invoiced lines properly, crashing the approval/posting process.
This PR fixes the issue by:
Steps to reproduce:
Current behavior:
An "Invalid Operation" (or validation) error is raised because the system tries to process the mixed lines uniformly, failing to generate the standard accounting entries for the non-invoiced expenses. This forces the user to split the expenses into separate reports.
Expected behavior:
The mixed expense report is successfully approved and posted. Non-invoiced expenses generate their standard journal entries, and invoiced expenses are processed correctly alongside them within the same report.
Fixes #330