From 8961e6b68210b7dcfe5695d820814a52dbd08577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 3 Oct 2011 23:30:42 +0200 Subject: [PATCH] Fix credit to copy analytic_accounts issue1829 review130001 --- invoice.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/invoice.py b/invoice.py index 1ba06a0fdf..17fa67c181 100644 --- a/invoice.py +++ b/invoice.py @@ -184,6 +184,16 @@ class InvoiceLine(ModelSQL, ModelView): return new_ids[0] return new_ids + def _credit(self, line): + selection_obj = Pool().get('analytic_account.account.selection') + + result = super(InvoiceLine, self)._credit(line) + + if line.analytic_accounts: + selection_id = selection_obj.copy(line.analytic_accounts.id) + result['analytic_accounts'] = selection_id + return result + def get_move_line(self, line): values = super(InvoiceLine, self).get_move_line(line) if line.analytic_accounts and line.analytic_accounts.accounts: