From 0ca41750440bd1b8ded252cf475040e8b95a8ec6 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Thu, 27 Mar 2014 10:22:22 +0100 Subject: [PATCH] In account_easy_reconcile, now write-off entries can be created with an analytic account --- account_easy_reconcile/base_reconciliation.py | 3 +++ account_easy_reconcile/easy_reconcile.py | 5 +++++ account_easy_reconcile/easy_reconcile.xml | 2 ++ 3 files changed, 10 insertions(+) diff --git a/account_easy_reconcile/base_reconciliation.py b/account_easy_reconcile/base_reconciliation.py index b50c06b9..b5b40542 100644 --- a/account_easy_reconcile/base_reconciliation.py +++ b/account_easy_reconcile/base_reconciliation.py @@ -188,6 +188,9 @@ class easy_reconcile_base(orm.AbstractModel): period_id = self.pool.get('account.period').find( cr, uid, dt=date, context=context)[0] + if rec.analytic_account_id: + rec_ctx['analytic_id'] = rec.analytic_account_id.id + ml_obj.reconcile( cr, uid, line_ids, diff --git a/account_easy_reconcile/easy_reconcile.py b/account_easy_reconcile/easy_reconcile.py index 7971895e..a6b6dfd9 100644 --- a/account_easy_reconcile/easy_reconcile.py +++ b/account_easy_reconcile/easy_reconcile.py @@ -56,6 +56,9 @@ class easy_reconcile_options(orm.AbstractModel): required=True, string='Date of reconciliation'), 'filter': fields.char('Filter', size=128), + 'analytic_account_id': fields.many2one( + 'account.analytic.account', 'Analytic Account', + help="Analytic account for the write-off"), } _defaults = { @@ -198,6 +201,8 @@ class account_easy_reconcile(orm.Model): rec_method.account_lost_id.id), 'account_profit_id': (rec_method.account_profit_id and rec_method.account_profit_id.id), + 'analytic_account_id': (rec_method.analytic_account_id and + rec_method.analytic_account_id.id), 'journal_id': (rec_method.journal_id and rec_method.journal_id.id), 'date_base_on': rec_method.date_base_on, diff --git a/account_easy_reconcile/easy_reconcile.xml b/account_easy_reconcile/easy_reconcile.xml index 2696419a..eaeaa7f8 100644 --- a/account_easy_reconcile/easy_reconcile.xml +++ b/account_easy_reconcile/easy_reconcile.xml @@ -124,6 +124,7 @@ The lines should have the same amount (with the write-off) and the same referenc + @@ -141,6 +142,7 @@ The lines should have the same amount (with the write-off) and the same referenc +