From 4de5e6b8576d923c149e9d4e613adbf762e3631a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?= Date: Wed, 27 Jun 2012 08:42:22 +0200 Subject: [PATCH] [IMP] Set a default account on a new bank statement line when manual entry (lp:c2c-financial-addons/6.1 rev 24.1.40) --- account_statement_ext/statement.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 276ce259..95459d4f 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -515,6 +515,9 @@ class AccountBankSatementLine(Model): periods = self.pool.get('account.period').find(cursor, user, dt=date) return periods and periods[0] or False + def _get_default_account(self, cursor, user, context=None): + return self.get_values_for_line(cursor, user, context = context)['account_id'] + _columns = { # Set them as required + 64 char instead of 32 'ref': fields.char('Reference', size=64, required=True), @@ -522,6 +525,7 @@ class AccountBankSatementLine(Model): } _defaults = { 'period_id': _get_period, + 'account_id': _get_default_account, } def get_values_for_line(self, cr, uid, profile_id = False, partner_id = False, line_type = False, amount = False, context = None):