[REM] account: remove account.invoice.cancel
Removed useless class, not used except in a yml test.
This commit is contained in:
@@ -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
|
||||
-
|
||||
|
||||
@@ -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'}
|
||||
|
||||
@@ -26,27 +26,5 @@
|
||||
res_model="account.invoice.confirm" src_model="account.invoice"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
<record id="account_invoice_cancel_view" model="ir.ui.view">
|
||||
<field name="name">account.invoice.cancel.form</field>
|
||||
<field name="model">account.invoice.cancel</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Cancel Selected Invoices">
|
||||
<footer>
|
||||
<button string="Cancel Invoices" name="invoice_cancel" type="object" default_focus="1" class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-default" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_cancel" model="ir.actions.act_window">
|
||||
<field name="name">Cancel Selected Invoices</field>
|
||||
<field name="res_model">account.invoice.cancel</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_invoice_cancel_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user