mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Merge pull request #275 from Tecnativa/8.0-payment_order-delete_warning
[IMP] account_banking_payment_export: Protect unlink
This commit is contained in:
@@ -42,6 +42,15 @@ class PaymentOrder(models.Model):
|
||||
for order in self:
|
||||
order.bank_line_count = len(order.bank_line_ids)
|
||||
|
||||
@api.multi
|
||||
def unlink(self):
|
||||
for order in self:
|
||||
if order.state not in ('draft', 'cancel'):
|
||||
raise exceptions.Warning(
|
||||
_("You cannot remove any order that is not in 'draft' or "
|
||||
"'cancel' state."))
|
||||
return super(PaymentOrder, self).unlink()
|
||||
|
||||
@api.multi
|
||||
def launch_wizard(self):
|
||||
"""Search for a wizard to launch according to the type.
|
||||
|
||||
Reference in New Issue
Block a user