mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Merge pull request #33 from pedrobaeza/7.0-bank_statement_instant_voucher-fix
[FIX] bank_statement_instant_voucher: Problems in views and some other enhancements
This commit is contained in:
@@ -20,21 +20,20 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
'''
|
||||
"""
|
||||
This parser implements the PATU format support. PATU format is a generic format
|
||||
used by finnish banks.
|
||||
'''
|
||||
from account_banking.parsers import models
|
||||
from tools.translate import _
|
||||
from account_banking_fi_patu.parser import PatuParser
|
||||
"""
|
||||
from openerp.addons.account_banking.parsers import models
|
||||
from openerp.tools.translate import _
|
||||
from openerp.addons.account_banking_fi_patu.parser import PatuParser
|
||||
|
||||
__all__ = ['parser']
|
||||
__all__ = ['Parser']
|
||||
|
||||
|
||||
class transaction(models.mem_bank_transaction):
|
||||
'''
|
||||
Implementation of transaction communication class for account_banking.
|
||||
'''
|
||||
class Transaction(models.mem_bank_transaction):
|
||||
"""Implementation of transaction communication class for account_banking.
|
||||
"""
|
||||
mapping = {
|
||||
"remote_account": "recipientaccount",
|
||||
"remote_currency": "currency",
|
||||
@@ -48,10 +47,8 @@ class transaction(models.mem_bank_transaction):
|
||||
}
|
||||
|
||||
def __init__(self, record, *args, **kwargs):
|
||||
'''
|
||||
Initialize own dict with read values.
|
||||
'''
|
||||
super(transaction, self).__init__(*args, **kwargs)
|
||||
"""Initialize own dict with read values."""
|
||||
super(Transaction, self).__init__(*args, **kwargs)
|
||||
for key in self.mapping:
|
||||
try:
|
||||
setattr(self, key, record[self.mapping[key]])
|
||||
@@ -59,34 +56,30 @@ class transaction(models.mem_bank_transaction):
|
||||
pass
|
||||
|
||||
def is_valid(self):
|
||||
'''
|
||||
Override validity checks.
|
||||
"""Override validity checks.
|
||||
There are certain situations for PATU which can be validated as
|
||||
invalid, but are normal.
|
||||
If eventcode is 730, the transaction was initiated by the bank and
|
||||
doesn't have a destination account.
|
||||
'''
|
||||
"""
|
||||
if self.eventcode in ["720", "710"]:
|
||||
# Withdrawal from and deposit to the account
|
||||
return (self.execution_date and self.transferred_amount and True) \
|
||||
or False
|
||||
|
||||
if self.eventcode and self.eventcode == "730":
|
||||
# The transaction is bank initiated, no remote account is present
|
||||
return (self.execution_date and self.transferred_amount and True) \
|
||||
or False
|
||||
|
||||
return super(transaction, self).is_valid()
|
||||
return super(Transaction, self).is_valid()
|
||||
|
||||
|
||||
class statement(models.mem_bank_statement):
|
||||
'''
|
||||
Implementation of bank_statement communication class of account_banking
|
||||
'''
|
||||
"""Implementation of bank_statement communication class of account_banking
|
||||
"""
|
||||
def __init__(self, record, *args, **kwargs):
|
||||
'''
|
||||
"""
|
||||
Set decent start values based on first transaction read
|
||||
'''
|
||||
"""
|
||||
super(statement, self).__init__(*args, **kwargs)
|
||||
self.id = record["statementnr"]
|
||||
self.local_account = self.convert_bank_account(record["accountnr"])
|
||||
@@ -101,9 +94,7 @@ class statement(models.mem_bank_statement):
|
||||
return "%s-%s" % (bank, account)
|
||||
|
||||
def import_transaction(self, record):
|
||||
'''
|
||||
Import a transaction to the statement
|
||||
'''
|
||||
"""Import a transaction to the statement"""
|
||||
if record["recordid"] == "40":
|
||||
self.end_balance = record["balance"]
|
||||
elif record["recordid"] == "10" or record["recordid"] == "80":
|
||||
@@ -111,10 +102,10 @@ class statement(models.mem_bank_statement):
|
||||
# now, ignore the parent entry
|
||||
if record["receiptcode"] == "E":
|
||||
return
|
||||
self.transactions.append(transaction(record))
|
||||
self.transactions.append(Transaction(record))
|
||||
|
||||
|
||||
class parser(models.parser):
|
||||
class Parser(models.parser):
|
||||
code = 'FIPATU'
|
||||
name = _('PATU statement sheet')
|
||||
doc = _('''\
|
||||
@@ -139,5 +130,3 @@ will parse all statements in a file and import them to OpenERP
|
||||
stmnt.import_transaction(record)
|
||||
result.append(stmnt)
|
||||
return result
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
import model
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import model
|
||||
|
||||
@@ -46,11 +46,12 @@ supported.
|
||||
""",
|
||||
'website': 'http://therp.nl',
|
||||
'images': [],
|
||||
'depends': ['account_voucher'],
|
||||
'depends': [
|
||||
'account_voucher',
|
||||
],
|
||||
'data': [
|
||||
'view/account_voucher_instant.xml',
|
||||
'view/account_bank_statement_line.xml',
|
||||
],
|
||||
"license": 'AGPL-3',
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * bank_statement_instant_voucher
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-09-10 09:46+0000\n"
|
||||
"PO-Revision-Date: 2014-09-10 09:46+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: field:account.voucher.instant,balance:0
|
||||
msgid "Balance"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:_description:0
|
||||
#: model:ir.model,name:bank_statement_instant_voucher.model_account_bank_statement_line
|
||||
#, python-format
|
||||
msgid "Bank Statement Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: field:account.voucher.instant,statement_line_id:0
|
||||
msgid "Bank statement line"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: view:account.voucher.instant:0
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:167
|
||||
#, python-format
|
||||
msgid "Cannot determine statement line"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:258
|
||||
#, python-format
|
||||
msgid "Cannot match a confirmed statement line"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: view:account.voucher.instant:0
|
||||
msgid "Confirm"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: view:account.bank.statement:0
|
||||
#: view:account.voucher.instant:0
|
||||
#: model:ir.actions.act_window,name:bank_statement_instant_voucher.act_instant_voucher
|
||||
msgid "Create matching voucher"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: view:account.voucher.instant:0
|
||||
msgid "Create voucher"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:225
|
||||
#, python-format
|
||||
msgid "Currency on the bank statement line needs to be the same as on the voucher. Currency conversion is not yet supported."
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:79
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:166
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:224
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:234
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:242
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:247
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:257
|
||||
#, python-format
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:_description:0
|
||||
#: model:ir.model,name:bank_statement_instant_voucher.model_account_voucher_instant
|
||||
#, python-format
|
||||
msgid "Instant Voucher"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:80
|
||||
#, python-format
|
||||
msgid "No %s journal defined"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: field:account.voucher.instant,partner_id:0
|
||||
msgid "Partner"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: selection:account.voucher.instant,type:0
|
||||
msgid "Purchase"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: field:account.voucher.instant,ref:0
|
||||
msgid "Reference"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: selection:account.voucher.instant,type:0
|
||||
msgid "Sale"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: field:account.voucher.instant,state:0
|
||||
msgid "State"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:248
|
||||
#, python-format
|
||||
msgid "The amount on the bank statement line needs to be the same as on the voucher. Write-off is not yet supported."
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:235
|
||||
#, python-format
|
||||
msgid "The voucher could not be posted."
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:243
|
||||
#, python-format
|
||||
msgid "The voucher's move line could not be posted."
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: field:account.voucher.instant,voucher_id:0
|
||||
msgid "Voucher"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: code:addons/bank_statement_instant_voucher/model/account_voucher_instant.py:95
|
||||
#, python-format
|
||||
msgid "Voucher for statement line %s.%s"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: field:account.voucher.instant,type:0
|
||||
msgid "Voucher type"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: selection:account.voucher.instant,state:0
|
||||
msgid "confirm"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: selection:account.voucher.instant,state:0
|
||||
msgid "init"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: view:account.voucher.instant:0
|
||||
msgid "or"
|
||||
msgstr ""
|
||||
|
||||
#. module: bank_statement_instant_voucher
|
||||
#: selection:account.voucher.instant,state:0
|
||||
msgid "ready"
|
||||
msgstr ""
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
import account_voucher_instant
|
||||
import account_bank_statement_line
|
||||
# -*- encoding: utf-8 -*-
|
||||
from . import account_voucher_instant
|
||||
from . import account_bank_statement_line
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
<data>
|
||||
<record id="view_banking_bank_statement_form" model="ir.ui.view">
|
||||
<field name="name">Add instant voucher button to bank statement line on statement form</field>
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form" />
|
||||
<field name="inherit_id" ref="account_voucher.view_bank_statement_form_voucher" />
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="priority" eval="30"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='line_ids']/tree/field[@name='voucher_id']"
|
||||
<xpath expr="//field[@name='line_ids']/tree//field[@name='voucher_id']"
|
||||
position="before">
|
||||
<button name="create_instant_voucher" states="draft"
|
||||
string="Create matching voucher"
|
||||
|
||||
@@ -1,45 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="instant_voucher_form" model="ir.ui.view">
|
||||
<field name="name">Instant voucher form view</field>
|
||||
<field name="model">account.voucher.instant</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<field name="state" invisible="1" readonly="1"/>
|
||||
<field name="statement_line_id"/>
|
||||
<field name="ref"/>
|
||||
<newline/>
|
||||
<field name="partner_id"/>
|
||||
<field name="balance"/>
|
||||
<newline/>
|
||||
<form string="Create matching voucher" version="7.0">
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="voucher_id"
|
||||
context="{'statement_line_id': statement_line_id,
|
||||
'form_view_ref': (
|
||||
type == 'sale' and 'account_voucher.view_sale_receipt_form'
|
||||
or 'account_voucher.view_purchase_receipt_form')
|
||||
}"
|
||||
/>
|
||||
<newline/>
|
||||
<newline/>
|
||||
<button icon="gtk-cancel"
|
||||
string="Cancel"
|
||||
name="cancel"
|
||||
type="object"/>
|
||||
<button icon="gtk-ok" string="Confirm"
|
||||
states="ready"
|
||||
name="confirm"
|
||||
type="object"
|
||||
/>
|
||||
<button icon="gtk-ok" string="Create voucher"
|
||||
states="init"
|
||||
name="create_voucher"
|
||||
type="object"
|
||||
/>
|
||||
<field name="state" invisible="1"/>
|
||||
<group>
|
||||
<field name="ref"/>
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="statement_line_id"/>
|
||||
<field name="balance"/>
|
||||
<field name="voucher_id"
|
||||
context="{'statement_line_id': statement_line_id, 'form_view_ref': (type == 'sale' and 'account_voucher.view_sale_receipt_form' or 'account_voucher.view_purchase_receipt_form')}"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Confirm"
|
||||
class="oe_highlight"
|
||||
states="ready"
|
||||
name="confirm"
|
||||
type="object"/>
|
||||
<button string="Create voucher"
|
||||
class="oe_highlight"
|
||||
states="init"
|
||||
name="create_voucher"
|
||||
type="object"/>
|
||||
or
|
||||
<button string="Cancel"
|
||||
class="oe_link"
|
||||
name="cancel"
|
||||
type="object"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Create matching voucher"
|
||||
res_model="account.voucher.instant"
|
||||
src_model="account.bank.statement.line"
|
||||
|
||||
Reference in New Issue
Block a user