[FIX] Minor fixes

This commit is contained in:
Florian da Costa
2014-01-15 14:46:57 +01:00
parent ac625c78e9
commit 0d262e8890
4 changed files with 14 additions and 13 deletions

View File

@@ -20,5 +20,4 @@
#
###############################################################################
import statement
from . import statement

View File

@@ -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.

View File

@@ -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)

View File

@@ -14,8 +14,6 @@
<field name="name">account_statement_one_move.account_statement.view_form</field>
<field name="model">account.statement.profile</field>
<field name="inherit_id" ref="account_statement_ext.statement_importer_view_form" />
<field eval="16" name="priority"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="balance_check" position="after">
<field name="one_move"/>