mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[IMP] allow unreconciling bank statement lines by adding the cancel button
Since account_constraint forbids the deletion of account moves that are linked to a bank statement, we add the possibility to delete them from the bank statement itself, to provide a way to fix erroneous matches.
This commit is contained in:
committed by
Adrien Peiffer
parent
b3544b026b
commit
fcb6150d53
@@ -61,6 +61,7 @@ Summary of constraints are:
|
|||||||
'website': 'http://www.camptocamp.com',
|
'website': 'http://www.camptocamp.com',
|
||||||
'data': [
|
'data': [
|
||||||
'view/account_journal.xml',
|
'view/account_journal.xml',
|
||||||
|
'view/account_bank_statement.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp import models, api
|
from openerp import models, api, fields
|
||||||
|
|
||||||
|
|
||||||
class AccountBankStatement(models.Model):
|
class AccountBankStatement(models.Model):
|
||||||
@@ -45,6 +45,14 @@ class AccountBankStatement(models.Model):
|
|||||||
class AccountBankStatementLine(models.Model):
|
class AccountBankStatementLine(models.Model):
|
||||||
_inherit = "account.bank.statement.line"
|
_inherit = "account.bank.statement.line"
|
||||||
|
|
||||||
|
state = fields.Selection(string='Statement state',
|
||||||
|
related='statement_id.state')
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def cancel(self):
|
||||||
|
self = self.with_context(from_parent_object=True)
|
||||||
|
return super(AccountBankStatementLine, self).cancel()
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def process_reconciliation(self, mv_line_dicts):
|
def process_reconciliation(self, mv_line_dicts):
|
||||||
"""Add the from_parent_object key in context in order to be able
|
"""Add the from_parent_object key in context in order to be able
|
||||||
|
|||||||
21
account_constraints/view/account_bank_statement.xml
Normal file
21
account_constraints/view/account_bank_statement.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
<!--
|
||||||
|
Since account_constraint forbids the deletion of account moves that
|
||||||
|
are linked to a bank statement, we add the possibility to delete them
|
||||||
|
from the bank statement itself, to let the user fix erroneous reconciles.
|
||||||
|
-->
|
||||||
|
<record id="bank_statement_cancel_form_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">bank.statement.cancel.form.inherit</field>
|
||||||
|
<field name="model">account.bank.statement</field>
|
||||||
|
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='bank_account_id']" position="after">
|
||||||
|
<field name="state" invisible="1"/>
|
||||||
|
<button name="cancel" attrs="{'invisible': ['|', ('journal_entry_id', '=', False), ('state', '=', 'confirm')]}" string="Cancel" type="object" icon="gtk-undo"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
Reference in New Issue
Block a user