Browse Source

Merge pull request #1 from NL66278/8.0-new-backport-from-master-therp

Code clean-up, add demo data for tests and disable journal auto-creation
pull/6/head
Alexis de Lattre 10 years ago
parent
commit
9d3242b7fe
  1. 11
      account_bank_statement_import/account_bank_statement_import.py
  2. 4
      account_bank_statement_import_ofx/__openerp__.py
  3. 27
      account_bank_statement_import_ofx/demo/demo_data.xml

11
account_bank_statement_import/account_bank_statement_import.py

@ -158,10 +158,11 @@ class account_bank_statement_import(osv.TransientModel):
# If there is no journal, create one (and its account)
# I think it's too dangerous, so I disable that code by default -- Alexis de Lattre
if context.get('allow_auto_create_journal') and not journal_id and account_number:
journal_id = self._create_journal(cr, uid, currency_id, account_number, context=context)
if bank_account_id:
bank_pool.write(cr, uid, [bank_account_id], {'journal_id': journal_id}, context=context)
# -- Totally disabled, Ronald Portier
# if context.get('allow_auto_create_journal') and not journal_id and account_number:
# journal_id = self._create_journal(cr, uid, currency_id, account_number, context=context)
# if bank_account_id:
# bank_pool.write(cr, uid, [bank_account_id], {'journal_id': journal_id}, context=context)
# If we couldn't find/create a journal, everything is lost
if not journal_id:
@ -174,7 +175,7 @@ class account_bank_statement_import(osv.TransientModel):
wmca_pool = self.pool.get('wizard.multi.charts.accounts')
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
vals_account = {'currency_id': currency_id, 'acc_name': account_number, 'account_type': 'bank', 'currency_id': currency_id}
vals_account = {'currency_id': currency_id, 'acc_name': account_number, 'account_type': 'bank'}
vals_account = wmca_pool._prepare_bank_account(cr, uid, company, vals_account, context=context)
account_id = self.pool.get('account.account').create(cr, uid, vals_account, context=context)

4
account_bank_statement_import_ofx/__openerp__.py

@ -25,7 +25,9 @@ base account_bank_statement_import module has been imported, or manually
create periods for the year 2013.
""",
'data' : [],
'demo': [],
'demo': [
'demo/demo_data.xml',
],
'auto_install': False,
'installable': True,
}

27
account_bank_statement_import_ofx/demo/demo_data.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="ofx_bank_journal" model="account.journal">
<field name="name">Bank Journal - (test ofx)</field>
<field name="code">TBNKOFX</field>
<field name="type">bank</field>
<field name="sequence_id" ref="account.sequence_bank_journal"/>
<field name="default_debit_account_id" ref="account.usd_bnk"/>
<field name="default_credit_account_id" ref="account.usd_bnk"/>
<field name="user_id" ref="base.user_root"/>
<field name="currency" ref="base.USD"/>
</record>
<record id="ofx_company_bank" model="res.partner.bank">
<field name="owner_name">Your Company</field>
<field name="acc_number">123456</field>
<field name="partner_id" ref="base.partner_root"></field>
<field name="company_id" ref="base.main_company"></field>
<field name="journal_id" ref="ofx_bank_journal"></field>
<field name="state">bank</field>
<field name="bank" ref="base.res_bank_1"/>
</record>
</data>
</openerp>
Loading…
Cancel
Save