diff --git a/addons/account/test/account_invoice_state.yml b/addons/account/test/account_invoice_state.yml index 91a6f9aa229..345e175e404 100644 --- a/addons/account/test/account_invoice_state.yml +++ b/addons/account/test/account_invoice_state.yml @@ -46,13 +46,6 @@ - !record {model: account.invoice.cancel, id: account_invoice_cancel_0}: {} -- - I clicked on Cancel Invoices Button -- - !python {model: account.invoice.cancel, id: False}: | - self.browse(ref("account_invoice_cancel_0")).with_context({"lang": 'en_US', - "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_state")], - "type": "out_invoice", "active_id": ref("account_invoice_state"), }).invoice_cancel() - I check that customer invoice is in the cancel state - diff --git a/addons/account/wizard/account_invoice_state.py b/addons/account/wizard/account_invoice_state.py index 7dd8f49a400..1b5aa387a66 100644 --- a/addons/account/wizard/account_invoice_state.py +++ b/addons/account/wizard/account_invoice_state.py @@ -21,24 +21,3 @@ class AccountInvoiceConfirm(models.TransientModel): raise UserError(_("Selected invoice(s) cannot be confirmed as they are not in 'Draft' state.")) record.action_invoice_open() return {'type': 'ir.actions.act_window_close'} - - -class AccountInvoiceCancel(models.TransientModel): - """ - This wizard will cancel the all the selected invoices. - If in the journal, the option allow cancelling entry is not selected then it will give warning message. - """ - - _name = "account.invoice.cancel" - _description = "Cancel the Selected Invoices" - - @api.multi - def invoice_cancel(self): - context = dict(self._context or {}) - active_ids = context.get('active_ids', []) or [] - - for record in self.env['account.invoice'].browse(active_ids): - if record.state in ('cancel', 'paid'): - raise UserError(_("Selected invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state.")) - record.action_invoice_cancel() - return {'type': 'ir.actions.act_window_close'} diff --git a/addons/account/wizard/account_invoice_state_view.xml b/addons/account/wizard/account_invoice_state_view.xml index 50233b713ad..068f2ac6557 100644 --- a/addons/account/wizard/account_invoice_state_view.xml +++ b/addons/account/wizard/account_invoice_state_view.xml @@ -26,27 +26,5 @@ res_model="account.invoice.confirm" src_model="account.invoice" view_mode="form" target="new" view_type="form" /> - - account.invoice.cancel.form - account.invoice.cancel - -
- -
-
-
- - - Cancel Selected Invoices - account.invoice.cancel - form - form - - new - -