mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[imp] display a warning in any case when cancelling the statement. the message changes if there are some unreconciled lines
This commit is contained in:
@@ -43,7 +43,9 @@
|
||||
|
||||
When the user confirms or cancels the whole statement, we keep the
|
||||
previous functionality, and then we change the state in all statement
|
||||
lines. We also add a warning if any lines are reconciled.
|
||||
lines. We also add a warning if any lines are reconciled. If no lines
|
||||
are reconciled, we show a generic warning because the operation could
|
||||
take a long time.
|
||||
|
||||
When the user confirms or cancels a statement line, we update the state
|
||||
of the line, and if necessary we update the state of the whole
|
||||
|
||||
@@ -49,19 +49,19 @@ class Statement(orm.Model):
|
||||
"""Check if there is any reconciliation. Return action."""
|
||||
st_line_obj = self.pool['account.bank.statement.line']
|
||||
for statement in self.browse(cr, uid, ids, context=context):
|
||||
if st_line_obj.has_reconciliation(
|
||||
ctx = context.copy()
|
||||
ctx['default_reconcile_warning'] = st_line_obj.has_reconciliation(
|
||||
cr,
|
||||
uid,
|
||||
[line.id for line in statement.line_ids],
|
||||
context=context):
|
||||
# ask confirmation, we have some reconciliation already
|
||||
context=context)
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'wizard.cancel.statement',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'context': context,
|
||||
'context': ctx,
|
||||
}
|
||||
|
||||
self.do_cancel(cr, uid, ids, context=context)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
###############################################################################
|
||||
"""Wizard to Cancel a Statement."""
|
||||
|
||||
from openerp.osv import orm
|
||||
from openerp.osv import orm, fields
|
||||
|
||||
|
||||
class wizard_cancel_statement(orm.TransientModel):
|
||||
@@ -30,9 +30,14 @@ class wizard_cancel_statement(orm.TransientModel):
|
||||
_name = "wizard.cancel.statement"
|
||||
_description = "Cancel Statement"
|
||||
_columns = {
|
||||
'reconcile_warning': fields.boolean(
|
||||
'Show reconcile warning',
|
||||
help='This is a hidden field set with a default in the context '
|
||||
'to choose between two different warning messages in the view.'
|
||||
),
|
||||
}
|
||||
|
||||
def unreconcile(self, cr, uid, ids, context=None):
|
||||
def do_cancel_button(self, cr, uid, ids, context=None):
|
||||
"""Proceed and cancel the statement, return Action.
|
||||
|
||||
This will delete the move.line and the reconciliation.
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
<field name="model">wizard.cancel.statement</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Reconciled Entries" version="7.0">
|
||||
<separator string="Unreconciliation"/>
|
||||
<label string="Some entries are already reconciled. Do you want to unreconcile them and proceed?"/>
|
||||
<separator string="Cancel statement"/>
|
||||
<field name="reconcile_warning" invisible="1" />
|
||||
<label attrs="{'invisible': [('reconcile_warning', '=', False)]}" string="Some entries are already reconciled. Do you want to unreconcile them and proceed?"/>
|
||||
<label attrs="{'invisible': [('reconcile_warning', '=', True)]}" string="Cancelling the statement will delete the generated Journal Entries (if un posted) and could take a long time for a long statement. Do you want to proceed?"/>
|
||||
<footer>
|
||||
<button name="unreconcile" string="Unreconcile" type="object" class="oe_highlight"/>
|
||||
<button name="do_cancel_button" string="Proceed" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
|
||||
Reference in New Issue
Block a user