New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] account: Remove invoice_pdf_report_id
on reset to draft
#161991
base: saas-16.3
Are you sure you want to change the base?
Conversation
03c87f4
to
4ec9ad4
Compare
Hello, thanks for this PR but that is not what we want. |
Hello @JulienAlardot thank you for your review and comments. First create an invoice, send and print If the original pdf is not removed, the new one is not regenerated (and is_move_sent is not updated). |
dd9c674
to
2cc4af7
Compare
Hello @JulienAlardot, I have made changes so that |
d7a52db
to
7c5a642
Compare
After further discussion with PO, the fix is what we want, but we would need it in 16.3 (send&Print rework) |
@@ -4152,7 +4152,7 @@ def button_draft(self): | |||
move.mapped('line_ids.analytic_line_ids').unlink() | |||
|
|||
self.mapped('line_ids').remove_move_reconcile() | |||
self.write({'state': 'draft', 'is_move_sent': False}) | |||
self.write({'state': 'draft'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.write({'state': 'draft'}) | |
self.state = 'draft' |
Since there's only one field left :p
def test_out_invoice_is_move_sent(self): | ||
invoice = self.init_invoice(move_type='out_invoice', amounts=[1000.0], post=True) | ||
option_vals = self.env['account.move.send']._get_wizard_vals_restrict_to({'checkbox_send_mail': True}) | ||
wizard = self.create_send_and_print(invoice, **option_vals) | ||
|
||
wizard.action_send_and_print() | ||
self.assertTrue(invoice.is_move_sent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating the test would be nice, something like
- Posting a move
- Testing the state
- Send & Print
- Testing the state
- Reset to draft
- Testing the state
could work, maybe also testing how it changes when deleting the pdf
7c5a642
to
2991b81
Compare
e30ceb0
to
2c5ccb3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the commit message Notes:
section? It still mentions the v17.0. It should be mentioning ef9e266 16.3 commit
Current Behavior: is_move_sent is not updated if there is an existing invoice_pdf_report_id. Purpose of this PR: Remove the `is_move_sent`: False on when resetting the account move to draft. This guarantees, that once the move has been sent via action_send_and_print, it will be marked as sent. Steps to Reproduce on Runbot: Create and Send and Print invoice. (is_move_sent is set to True) Reset invoice to draft. (is_move_sent is set to False) Confirm and resend invoice using Send and Print wizard. (is_move_sent remains False, expected to be changed to True) Notes: This PR odoo#116698 added a _compute in Odoo 16, however it was removed in saas-16.3 with this PR odoo#125392. is_move_sent is not updated on the second Send and Print because of the existing invoice_pdf_report_id (generated and linked during the first Send and Print). opw-3849109
2c5ccb3
to
7d29132
Compare
Current Behavior:
is_move_sent
is not updated if there is an existinginvoice_pdf_report_id
.Purpose of this PR:
Remove the
invoice_pdf_report_id
when resetting invoice to draft so that when the invoice is sent again (using the Send and Print wizard),is_move_sent
is updated.Steps to Reproduce on Runbot:
is_move_sent
is set to True)is_move_sent
is set to False)is_move_sent
remains False, expected to be changed to True)Notes:
This PR #116698 added a _compute in Odoo 16, however it was removed in Odoo 17 with this PR #125392.
is_move_sent
is not updated on the second Send and Print because of the existinginvoice_pdf_report_id
(generated and linked during the first Send and Print).opw-3849109