From 0d262e8890708f1100b44a73753ca6e5e33df808 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 15 Jan 2014 14:46:57 +0100 Subject: [PATCH] [FIX] Minor fixes --- account_statement_one_move/__init__.py | 3 +-- account_statement_one_move/__openerp__.py | 2 +- account_statement_one_move/statement.py | 20 +++++++++++-------- account_statement_one_move/statement_view.xml | 2 -- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/account_statement_one_move/__init__.py b/account_statement_one_move/__init__.py index bf2e6751..141c95fc 100644 --- a/account_statement_one_move/__init__.py +++ b/account_statement_one_move/__init__.py @@ -20,5 +20,4 @@ # ############################################################################### -import statement - +from . import statement diff --git a/account_statement_one_move/__openerp__.py b/account_statement_one_move/__openerp__.py index 5ddb0cc3..266c6ce7 100644 --- a/account_statement_one_move/__openerp__.py +++ b/account_statement_one_move/__openerp__.py @@ -26,7 +26,7 @@ 'category': 'Generic Modules/Others', 'license': 'AGPL-3', 'description': """ - This module allow to groupe all lines of a bank statement in only one move. This feature is optional + This module allows to group all lines of a bank statement in only one move. This feature is optional and can be activated with a checkbox in the bank statement's profile. This is very useful for credit card deposit for example, you won't have a move for each line. diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index e473e01f..ef6d0f21 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -23,14 +23,13 @@ from openerp.osv import fields, orm, osv - -class AccountStatementProfil(orm.Model): +class AccountStatementProfile(orm.Model): _inherit = "account.statement.profile" _columns = { - 'one_move': fields.boolean('One Move', - help="Tic that box if you want OpenERP to generated only" - "one move when the bank statement is validated") - } + 'one_move': fields.boolean( + 'Group Journal Items', + help="Only one Journal Entry will be generated on the " + "validation of the bank statement."), class account_bank_statement(orm.Model): @@ -62,6 +61,7 @@ class account_bank_statement(orm.Model): }) return res + def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: @@ -110,7 +110,9 @@ class account_bank_statement(orm.Model): 'res.currency.compute.account': acc_cur, }) amount = res_currency_obj.compute(cr, uid, st.currency.id, - company_currency_id, st_line.amount, context=context) + company_currency_id, + st_line.amount, + context=context) bank_move_vals = self._prepare_bank_move_line(cr, uid, st_line, move_id, amount, company_currency_id, context=context) @@ -122,6 +124,7 @@ class account_bank_statement(orm.Model): move_obj.post(cr, uid, [move_id], context=context) return True + def button_confirm_bank(self, cr, uid, ids, context=None): st_line_obj = self.pool.get('account.bank.statement.line') if context is None: @@ -142,8 +145,9 @@ class account_bank_statement(orm.Model): done = [] for st in self.browse(cr, uid, ids, context=context): if st.profile_id.one_move: + assert st.line_ids, "This statement does not contain any lines" for move in st.line_ids[0].move_ids: - if move.state <> 'draft': + if move.state != 'draft': move.button_cancel(context=context) move.unlink(context=context) st.write({'state':'draft'}, context=context) diff --git a/account_statement_one_move/statement_view.xml b/account_statement_one_move/statement_view.xml index 3fb1d23d..8a145f22 100644 --- a/account_statement_one_move/statement_view.xml +++ b/account_statement_one_move/statement_view.xml @@ -14,8 +14,6 @@ account_statement_one_move.account_statement.view_form account.statement.profile - - form