[IMP]Move the field journal_id in the main module.

By moving the field in the main module the others parsers can use it without duplicate it
This commit is contained in:
Laurent Mignon (ACSONE)
2015-06-08 14:15:46 +02:00
parent 6db13fce6a
commit 3744b5a60b
7 changed files with 54 additions and 56 deletions

View File

@@ -27,6 +27,20 @@ class AccountBankStatementImport(models.TransientModel):
_name = 'account.bank.statement.import'
_description = 'Import Bank Statement'
@api.model
def _get_hide_journal_field(self):
""" Return False if the journal_id can't be provided by the parsed
file and must be provided by the wizard.
See account_bank_statement_import_qif """
return True
journal_id = fields.Many2one(
'account.journal', string='Journal',
help='Accounting journal related to the bank statement you\'re '
'importing. It has be be manually chosen for statement formats which '
'doesn\'t allow automatic journal detection (QIF for example).')
hide_journal_field = fields.Boolean(
'Hide the journal field in the view', default=_get_hide_journal_field)
data_file = fields.Binary(
'Bank Statement File', required=True,
help='Get you bank statements in electronic format from your bank '

View File

@@ -9,6 +9,12 @@
<field name="arch" type="xml">
<form string="Import Bank Statements">
<field name="data_file"/>
<field name="hide_journal_field" invisible="1"/>
<label for="journal_id"/>
<field name="journal_id"
domain="[('type', '=', 'bank')]"
attrs="{'invisible': [('hide_journal_field', '=', True)]}"
context="{'default_type':'bank'}"/>
<br/><br/><b> How to import your bank statement :</b>
<br/><label string= "1. Download your bank statements from your bank website."/>
<br/><label string= "2. Make sure you have installed the right module to support the file format."/>

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-02-20 00:25+0000\n"
"PO-Revision-Date: 2015-02-20 00:25+0000\n"
"POT-Creation-Date: 2015-06-08 12:02+0000\n"
"PO-Revision-Date: 2015-06-08 12:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -16,13 +16,13 @@ msgstr ""
"Plural-Forms: \n"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:269
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:313
#, python-format
msgid "%d transactions had already been imported and were ignored."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:269
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:316
#, python-format
msgid "1 transaction had already been imported and was ignored."
msgstr ""
@@ -48,15 +48,19 @@ msgid "A bank account transactions can be imported only once !"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:271
#: sql_constraint:res.partner.bank:0
msgid "Account Number must be unique"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:319
#, python-format
msgid "Already imported items"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:182
#, python-format
msgid "Bank"
#: model:ir.model,name:account_bank_statement_import.model_res_partner_bank
msgid "Bank Accounts"
msgstr ""
#. module: account_bank_statement_import
@@ -75,13 +79,13 @@ msgid "Cancel"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:169
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:200
#, python-format
msgid "Cannot find in which journal import this statement. Please manually select a journal."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:99
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:129
#, python-format
msgid "Could not make sense of the given file.\n"
"Did you install the module to support this type of file ?"
@@ -114,8 +118,12 @@ msgstr ""
#. module: account_bank_statement_import
#: model:ir.actions.act_window,name:account_bank_statement_import.action_account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_import
#: model:ir.ui.menu,name:account_bank_statement_import.menu_account_bank_statement_import
msgid "Import"
msgstr ""
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr ""
@@ -140,31 +148,36 @@ msgid "Last Updated on"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:146
#: field:res.partner.bank,sanitized_acc_number:0
msgid "Sanitized Account Number"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:181
#, python-format
msgid "The account of this statement is linked to another journal."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:157
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:195
#, python-format
msgid "The currency of the bank statement is not the same as the currency of the journal !"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:104
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:136
#, python-format
msgid "This file doesn't contain any statement."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:112
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:144
#, python-format
msgid "This file doesn't contain any transaction."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:261
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:305
#, python-format
msgid "You have already imported that file."
msgstr ""

View File

@@ -11,9 +11,6 @@
'depends': [
'account_bank_statement_import'
],
'data': [
'account_bank_statement_import_qif_view.xml'
],
'auto_install': False,
'installable': True,
}

View File

@@ -4,7 +4,7 @@ import dateutil.parser
import StringIO
from openerp.tools.translate import _
from openerp import api, models, fields
from openerp import api, models
from openerp.exceptions import Warning
@@ -15,14 +15,6 @@ class AccountBankStatementImport(models.TransientModel):
def _get_hide_journal_field(self):
return self.env.context.get('journal_id') and True
journal_id = fields.Many2one(
'account.journal', string='Journal',
help='Accounting journal related to the bank statement you\'re '
'importing. It has be be manually chosen for statement formats which '
'doesn\'t allow automatic journal detection (QIF for example).')
hide_journal_field = fields.Boolean(
'Hide the journal field in the view', default=_get_hide_journal_field)
@api.model
def _get_journal(self, currency_id, bank_account_id, account_number):
""" As .QIF format does not allow us to detect the journal, we need to

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="account_bank_statement_import_view_inherited" model="ir.ui.view">
<field name="name">Import Bank Statements Inherited</field>
<field name="model">account.bank.statement.import</field>
<field name="priority" eval="20"/>
<field name="inherit_id" ref="account_bank_statement_import.account_bank_statement_import_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='data_file']" position="after">
<field name="hide_journal_field" invisible="1"/>
<label for="journal_id"/>
<field name="journal_id"
domain="[('type', '=', 'bank')]"
attrs="{'invisible': [('hide_journal_field', '=', True)]}"
context="{'default_type':'bank'}"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-08 09:10+0000\n"
"PO-Revision-Date: 2015-06-08 09:10+0000\n"
"POT-Creation-Date: 2015-06-08 12:01+0000\n"
"PO-Revision-Date: 2015-06-08 12:01+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -21,7 +21,7 @@ msgid "Accounting journal related to the bank statement you're importing. It has
msgstr ""
#. module: account_bank_statement_import_qif
#: code:addons/account_bank_statement_import_qif/account_bank_statement_import_qif.py:62
#: code:addons/account_bank_statement_import_qif/account_bank_statement_import_qif.py:54
#, python-format
msgid "Could not decipher the QIF file."
msgstr ""
@@ -42,7 +42,7 @@ msgid "Journal"
msgstr ""
#. module: account_bank_statement_import_qif
#: code:addons/account_bank_statement_import_qif/account_bank_statement_import_qif.py:106
#: code:addons/account_bank_statement_import_qif/account_bank_statement_import_qif.py:98
#, python-format
msgid "This file is either not a bank statement or is not correctly formed."
msgstr ""