Skip to content
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

Open
wants to merge 1 commit into
base: saas-16.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -4121,7 +4121,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.state = 'draft'

def button_cancel(self):
self.write({'auto_post': 'no', 'state': 'cancel'})
Expand Down
14 changes: 14 additions & 0 deletions addons/account/tests/test_account_move_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,3 +880,17 @@ def test_with_draft_invoices(self):
self.create_send_and_print(invoice_draft)
with self.assertRaises(UserError):
self.create_send_and_print(invoice_posted + invoice_draft)

def test_out_invoice_is_move_sent(self):
invoice = self.init_invoice(move_type='out_invoice', amounts=[1000.0], post=True)
wizard = self.create_send_and_print(invoice)

self.assertEqual(invoice.state, 'posted')
self.assertFalse(invoice.is_move_sent)

wizard.action_send_and_print()
self.assertTrue(invoice.is_move_sent)

invoice.button_draft()
self.assertEqual(invoice.state, 'draft')
self.assertTrue(invoice.is_move_sent)