Reviewers: ,
Please review this at http://codereview.tryton.org/842002/
Affected files:
M invoice.py
Index: invoice.py
===================================================================
--- a/invoice.py
+++ b/invoice.py
@@ -190,6 +190,10 @@
'deletion.'),
'delete_numbered': ('The numbered invoice "%s" can not be '
'deleted.'),
+ 'customer_invoice_cancel_move': ('Customer invoice "%s"
can '
+ 'not be cancelled once posted.'),
+ 'customer_credit_note_cancel_move': ('Customer credit
note '
+ '"%s" can not be cancelled once posted.'),
'period_cancel_move': ('The period of Invoice "%s" is
closed.\n'
'Use the today for cancel move?'),
})
@@ -1036,10 +1040,12 @@
})
def check_cancel_move(self):
- if (self.type in ('out_invoice', 'out_credit_note')
- and self.cancel_move):
- return False
- return True
+ if self.type == 'out_invoice' and self.cancel_move:
+ self.raise_user_error('customer_invoice_cancel_move',
+ (self.rec_name,))
+ if self.type == 'out_credit_note' and self.cancel_move:
+ self.raise_user_error('customer_credit_note_cancel_move',
+ (self.rec_name,))
def get_reconcile_lines_for_amount(self, amount, exclude_lines=None):
'''