From 515f5fbbd7d365651409d6853862ec842bc3d998 Mon Sep 17 00:00:00 2001 From: Jan Grasnick Date: Tue, 9 Oct 2012 12:54:54 +0200 Subject: [PATCH] change domain of account to enable remove of invoice_lines issue2626 review388002 --- invoice.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/invoice.py b/invoice.py index 3035406bc8..866105aa62 100644 --- a/invoice.py +++ b/invoice.py @@ -1325,10 +1325,14 @@ class InvoiceLine(ModelSQL, ModelView): domain=[ ('company', '=', Eval('_parent_invoice', {}).get('company', Eval('context', {}).get('company', 0))), - If(Eval('_parent_invoice', {}).get('type').in_(['out_invoice', - 'out_credit_note']), - ('kind', '=', 'revenue'), - ('kind', '=', 'expense')), + If(Bool(Eval('_parent_invoice')), + If(Eval('_parent_invoice', {}).get('type').in_(['out_invoice', + 'out_credit_note']), + ('kind', '=', 'revenue'), + ('kind', '=', 'expense')), + If(Eval('invoice_type').in_(['out_invoice', 'out_credit_note']), + ('kind', '=', 'revenue'), + ('kind', '=', 'expense'))) ], on_change=['account', 'product', '_parent_invoice.party', '_parent_invoice.type'],