[ADD]CODA Notes and statement lines views
bzr revid: dle@openerp.com-20121207141450-i5kzwm1ojvkw42hy
This commit is contained in:
parent
bee5426c70
commit
a0a3f862cc
|
@ -20,6 +20,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import l10n_be_coda
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -1,6 +1,97 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem name="Import CODA File" parent="account.menu_finance_bank_and_cash" id="menu_account_coda_import" action="action_account_coda_import" sequence="40"/>
|
||||
<record id="view_bank_statement_coda_form" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.form</field>
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<page name="statement_line_ids" position="after">
|
||||
<page string="CODA Notes" name="coda_note">
|
||||
<field name="coda_note"/>
|
||||
</page>
|
||||
</page>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_bank_statement_line_coda_form" model="ir.ui.view">
|
||||
<field name="name">bank.statement.line.coda.form</field>
|
||||
<field name="model">account.bank.statement.line</field>
|
||||
<field name="priority">10</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="CODA Statement Line" version="7.0" create="false">
|
||||
<group col="4">
|
||||
<field name="statement_id"/>
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
<field name="ref" readonly="0"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="type" />
|
||||
<field domain="[('type', '<>', 'view')]" name="account_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="sequence" readonly="0"/>
|
||||
</group>
|
||||
<separator string="Notes"/>
|
||||
<field name="note"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_account_bank_statement_line_coda_tree" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.line.coda.tree</field>
|
||||
<field name="model">account.bank.statement.line</field>
|
||||
<field name="priority">10</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom" string="Statement lines">
|
||||
<field name="sequence" readonly="1" invisible="1"/>
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
<field name="ref"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
|
||||
<field name="type" on_change="onchange_type(partner_id, type)"/>
|
||||
<field name="account_id" options='{"no_open":True}' domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]"/>
|
||||
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]"/>
|
||||
<field name="amount"/>
|
||||
<field name="note"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_bank_statement_line_coda_filter" model="ir.ui.view">
|
||||
<field name="name">bank.statement.line.coda.filter</field>
|
||||
<field name="model">account.bank.statement.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Bank Transactions">
|
||||
<field name="name" filter_domain="['|', ('name','ilike',self), ('ref','ilike',self)]" string="Bank Transaction"/>
|
||||
<filter name="debit" string="Debit" domain="[('amount','>',0)]" icon="terp-folder-green" help="Debit Transactions."/>
|
||||
<filter name="credit" string="Credit" domain="[('amount','<',0)]" icon="terp-folder-orange" help="Credit Transactions."/>
|
||||
<field name="statement_id"/>
|
||||
<group expand="0" string="Extended Filters...">
|
||||
<field name="account_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="type"/>
|
||||
<field name="note"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group string="Group By..." expand="0">
|
||||
<filter string="Partner" context="{'group_by':'partner_id'}" icon="terp-folder-green"/>
|
||||
<filter string="Statement" context="{'group_by':'statement_id'}" icon="terp-folder-orange"/>
|
||||
<filter string="Fin.Account" context="{'group_by':'account_id'}" icon="terp-folder-yellow"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_bank_statement_line_coda" model="ir.actions.act_window">
|
||||
<field name="name">Bank Statement Lines</field>
|
||||
<field name="res_model">account.bank.statement.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'block_statement_line_delete' : 1}</field>
|
||||
<field name="search_view_id" ref="view_bank_statement_line_coda_filter"/>
|
||||
<field name="view_id" ref="view_account_bank_statement_line_coda_tree"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Bank Statement Lines" parent="account.menu_finance_bank_and_cash" id="menu_account_bank_statement_line_coda" action="action_account_bank_statement_line_coda" sequence="8"/>
|
||||
<menuitem name="Import CODA File" parent="account.menu_finance_bank_and_cash" id="menu_account_coda_import" action="action_account_coda_import" sequence="10"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -188,8 +188,6 @@ class account_coda_import(osv.osv_memory):
|
|||
infoLine['transaction_code'] = rmspaces(line[34:36])
|
||||
infoLine['transaction_category'] = rmspaces(line[36:39])
|
||||
infoLine['communication'] = rmspaces(line[40:113])
|
||||
infoLine['amount'] = 0.0
|
||||
infoLine['type'] = 'information'
|
||||
statement['lines'].append(infoLine)
|
||||
elif line[1] == '2':
|
||||
if infoLine['ref'] != rmspaces(line[2:10]):
|
||||
|
@ -205,8 +203,6 @@ class account_coda_import(osv.osv_memory):
|
|||
comm_line['sequence'] = len(statement['lines']) + 1
|
||||
comm_line['ref'] = rmspaces(line[2:10])
|
||||
comm_line['communication'] = rmspaces(line[32:112])
|
||||
comm_line['amount'] = 0.0
|
||||
comm_line['type'] = 'communication'
|
||||
statement['lines'].append(comm_line)
|
||||
elif line[0] == '8':
|
||||
# new balance record
|
||||
|
@ -229,6 +225,7 @@ class account_coda_import(osv.osv_memory):
|
|||
if not statement['balance_end_real']:
|
||||
statement['balance_end_real'] = statement['balance_start'] + statement['balancePlus'] - statement['balanceMin']
|
||||
for i, statement in enumerate(statements):
|
||||
statement['coda_note'] = ''
|
||||
data = {
|
||||
'name': '[' + statement['date'] + ']' + statement['description'],
|
||||
'date': statement['date'],
|
||||
|
@ -239,7 +236,20 @@ class account_coda_import(osv.osv_memory):
|
|||
}
|
||||
statement['id'] = self.pool.get('account.bank.statement').create(cr, uid, data, context=context)
|
||||
for line in statement['lines']:
|
||||
if line['type'] == 'normal':
|
||||
if line['type'] == 'information':
|
||||
if line['transaction_type'] in transaction_types:
|
||||
line['transaction_type'] = transaction_types[line['transaction_type']][1]
|
||||
if line['transaction_category'] in transaction_categories:
|
||||
line['transaction_category'] = transaction_categories[line['transaction_category']]
|
||||
if line['transaction_family'] in transaction_codes:
|
||||
transaction_family = transaction_codes[line['transaction_family']]
|
||||
line['transaction_family'] = transaction_family[0]
|
||||
if line['transaction_code'] in transaction_family[1]:
|
||||
line['transaction_code'] = transaction_family[1][line['transaction_code']]
|
||||
statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Date: ' + str(line['entryDate']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'],'\n'])
|
||||
elif line['type'] == 'communication':
|
||||
statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'],'\n'])
|
||||
elif line['type'] == 'normal':
|
||||
note = []
|
||||
if 'counterpartyName' in line and line['counterpartyName'] != '':
|
||||
note.append(_('Counter Party') + ': ' + line['counterpartyName'])
|
||||
|
@ -259,7 +269,6 @@ class account_coda_import(osv.osv_memory):
|
|||
if 'counterpartyAddress' in line and line['counterpartyAddress'] != '':
|
||||
note.append(_('Counter Party Address') + ': ' + line['counterpartyAddress'])
|
||||
line['name'] = "\n".join(filter(None, [line['counterpartyName'], line['communication']]))
|
||||
|
||||
partner = None
|
||||
partner_id = None
|
||||
invoice = False
|
||||
|
@ -342,8 +351,6 @@ class account_coda_import(osv.osv_memory):
|
|||
if 'communication_type' in line:
|
||||
if line['communication_type'] in communication_types:
|
||||
line['communication_type'] = communication_types[line['communication_type']]
|
||||
else:
|
||||
line['communication_type'] = 'Unknown'
|
||||
note.append(_('Communication Type') + ': ' + line['communication_type'])
|
||||
if line['transaction_type'] in transaction_types:
|
||||
line['transaction_type'] = transaction_types[line['transaction_type']][1]
|
||||
|
@ -374,7 +381,8 @@ class account_coda_import(osv.osv_memory):
|
|||
'voucher_id': line['voucher_id'],
|
||||
}
|
||||
self.pool.get('account.bank.statement.line').create(cr, uid, data, context=context)
|
||||
|
||||
if statement['coda_note'] != '':
|
||||
self.pool.get('account.bank.statement').write(cr, uid, [statement['id']], {'coda_note': statement['coda_note']}, context=context)
|
||||
account_coda_import()
|
||||
|
||||
transaction_types = {
|
||||
|
|
Loading…
Reference in New Issue