From 3f0d75766d86c8a984f9dbc9c42f18fd3e0b219b Mon Sep 17 00:00:00 2001 From: Ralf Peschke Date: Thu, 24 Sep 2015 10:34:12 +0200 Subject: [PATCH] Prevalidate invoice date on 'in invoice' and 'in credit note' issue4865 review18401002 --- invoice.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/invoice.py b/invoice.py index 5ba7a4aca6..811bb8845b 100644 --- a/invoice.py +++ b/invoice.py @@ -250,9 +250,21 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): 'tryton-go-previous'), }, 'validate_invoice': { + 'pre_validate': + ['OR', + ('invoice_date', '!=', None), + ('type', 'not in', + ['in_invoice', 'in_credit_note']), + ], 'invisible': Eval('state') != 'draft', }, 'post': { + 'pre_validate': + ['OR', + ('invoice_date', '!=', None), + ('type', 'not in', + ['in_invoice', 'in_credit_note']), + ], 'invisible': ~Eval('state').in_(['draft', 'validated']), }, 'pay': {