[IMP] account_banking_payment_export: Protect unlink

This commit is contained in:
Pedro M. Baeza
2016-06-14 09:50:19 +02:00
parent 9dc92beb4c
commit 2f1e21c4f8

View File

@@ -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.