From ab44bf61aa52178e89698c43e9faf180175b8f40 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 28 Jun 2013 12:26:57 +0200 Subject: [PATCH 1/7] [IMP] account_statement_ext - rename profil to profile --- account_statement_ext/statement.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 14566ce0..907cce0e 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -38,7 +38,7 @@ def fixed_write(self, cr, uid, ids, vals, context=None): stat_mod.account_bank_statement.write = fixed_write -class AccountStatementProfil(Model): +class AccountStatementProfile(Model): """ A Profile will contain all infos related to the type of bank statement, and related generated entries. It defines the @@ -47,7 +47,7 @@ class AccountStatementProfil(Model): _name = "account.statement.profile" _inherit = ['mail.thread'] - _description = "Statement Profil" + _description = "Statement Profile" _columns = { 'name': fields.char('Name', required=True), @@ -138,7 +138,7 @@ class AccountBankSatement(Model): _columns = { 'profile_id': fields.many2one( 'account.statement.profile', - 'Profil', + 'Bank Account Profile', required=True, readonly=True, states={'draft': [('readonly', False)]}), @@ -283,7 +283,7 @@ class AccountBankSatement(Model): uid, st_line, context=context) - # get the right partner according to the chosen profil + # get the right partner according to the chosen profile if st_line.statement_id.profile_id.force_partner_on_bank: bank_partner_id = st_line.statement_id.profile_id.partner_id.id return bank_partner_id From 81f89c49f153370c9454a53b09e3a6f9d8eaa982 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 28 Jun 2013 16:16:00 +0200 Subject: [PATCH 2/7] [REF] account_statement_ext - simplify xpath in xml views --- account_statement_ext/statement_view.xml | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/account_statement_ext/statement_view.xml b/account_statement_ext/statement_view.xml index c40c4b7d..2f9d942a 100644 --- a/account_statement_ext/statement_view.xml +++ b/account_statement_ext/statement_view.xml @@ -99,8 +99,8 @@ - - + + @@ -114,35 +114,35 @@ # Make balance visible or not depending on profile - + {'invisible':[('balance_check','=',False)]} - - + + {'invisible':[('balance_check','=',False)]} - - + + - + - + - + - # Adapt onchange signature - + # Adapt onchange signature + - + - + - + From 7085534d0eb22a4f0f5ca93ce15e789e5d0c5845 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 28 Jun 2013 16:20:41 +0200 Subject: [PATCH 3/7] [IMP] account_statement_ext - move profile to top --- account_statement_ext/statement_view.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/account_statement_ext/statement_view.xml b/account_statement_ext/statement_view.xml index 2f9d942a..e0c67d45 100644 --- a/account_statement_ext/statement_view.xml +++ b/account_statement_ext/statement_view.xml @@ -102,9 +102,14 @@ - + + + + From 99a643aed1ee77edfe52216a5ca8d97cc2e45887 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 28 Jun 2013 16:27:41 +0200 Subject: [PATCH 4/7] [IMP] account_statement_ext - hide useless information on bank statement --- account_statement_ext/statement_view.xml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/account_statement_ext/statement_view.xml b/account_statement_ext/statement_view.xml index e0c67d45..0a2047f0 100644 --- a/account_statement_ext/statement_view.xml +++ b/account_statement_ext/statement_view.xml @@ -99,25 +99,17 @@ - + + True - - - - - - - - - - # Make balance visible or not depending on profile {'invisible':[('balance_check','=',False)]} From e22e4191e51695e9ff69460516b2fc0436d5cdc6 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 28 Jun 2013 16:59:51 +0200 Subject: [PATCH 5/7] [IMP] account_statement_ext - add a sequence on bank profile and set the first of the company as default --- account_statement_ext/statement.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 907cce0e..50ff3504 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -48,9 +48,11 @@ class AccountStatementProfile(Model): _inherit = ['mail.thread'] _description = "Statement Profile" + _order = 'sequence' _columns = { 'name': fields.char('Name', required=True), + 'sequence': fields.integer('Sequence', help="Gives a sequence in lists, the first profile will be used as default"), 'partner_id': fields.many2one( 'res.partner', 'Bank/Payment Office partner', @@ -135,12 +137,24 @@ class AccountBankSatement(Model): periods = period_obj.find(cr, uid, dt=context.get('date'), context=context) return periods and periods[0] or False + def _default_profile(self, cr, uid, context=None): + """ + Statement default period + """ + if context is None: + context = {} + user_obj = self.pool.get('res.users') + profile_obj = self.pool.get('account.statement.profile') + user = user_obj.browse(cr, uid, uid, context=context) + profile_ids = profile_obj.search(cr, uid, [('company_id', '=', user.company_id.id)], context=context) + + return profile_ids[0] if profile_ids else False + _columns = { 'profile_id': fields.many2one( 'account.statement.profile', 'Bank Account Profile', required=True, - readonly=True, states={'draft': [('readonly', False)]}), 'credit_partner_id': fields.related( 'profile_id', @@ -175,6 +189,7 @@ class AccountBankSatement(Model): _defaults = { 'period_id': _default_period, + 'profile_id': _default_profile, } def create(self, cr, uid, vals, context=None): From 7f7e0256478f31e9e894472e18e45b2a55d6338d Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 28 Jun 2013 17:00:20 +0200 Subject: [PATCH 6/7] [IMP] account_statement_ext - hide type column in bank statement line --- account_statement_ext/statement_view.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/account_statement_ext/statement_view.xml b/account_statement_ext/statement_view.xml index 0a2047f0..f42d6581 100644 --- a/account_statement_ext/statement_view.xml +++ b/account_statement_ext/statement_view.xml @@ -139,8 +139,9 @@ + # also set type hidden as it has no impact on reconciliation - + From 99bea09c69e125949104b0d6eacbeb07066dface Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Thu, 12 Sep 2013 10:59:55 +0200 Subject: [PATCH 7/7] [IMP] account_statement_ext - docstring for Statement default profile --- account_statement_ext/statement.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 50ff3504..763d226e 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -139,7 +139,10 @@ class AccountBankSatement(Model): def _default_profile(self, cr, uid, context=None): """ - Statement default period + Returns the default statement profile + Default profile is the one with the lowest sequence of user's company + + :return profile_id or False """ if context is None: context = {}