[IMP] account: remove 'cancel' button in bank statements

that button was not useful: the only way to cancel a bank statement is to unreconcile the entries. And to unreconcile the entries you have to set your bank statement back to draft.  Was PR #16632
This commit is contained in:
chv-odoo
2017-08-25 10:59:05 +02:00
committed by qdp-odoo
parent a7ebd8a5f4
commit 8bc292afcd
4 changed files with 1 additions and 23 deletions
@@ -218,13 +218,6 @@ class AccountBankStatement(models.Model):
'target': 'new'
}
@api.multi
def button_cancel(self):
for statement in self:
if any(line.journal_entry_ids.ids for line in statement.line_ids):
raise UserError(_('A statement cannot be canceled when its lines are reconciled.'))
self.state = 'open'
@api.multi
def check_confirm_bank(self):
if self.journal_type == 'cash' and not self.currency_id.is_zero(self.difference):
-1
View File
@@ -561,7 +561,6 @@
<field name="all_lines_reconciled" invisible="1" />
<button name="%(action_bank_reconcile_bank_statements)d" string="Reconcile" type="action" class="oe_highlight" attrs="{'invisible':['|','|',('all_lines_reconciled','=',True),('line_ids','=',[]),('state', '!=', 'open')]}"/>
<button name="check_confirm_bank" string="Validate" type="object" class="oe_highlight" attrs="{'invisible':['|','|',('all_lines_reconciled','=',False),('line_ids','=',[]),('state', '!=', 'open')]}"/>
<button name="button_cancel" states="confirm" string="Cancel Statement" type="object"/>
<field name="state" widget="statusbar" statusbar_visible="open,confirm"/>
</header>
<sheet>
@@ -12,18 +12,4 @@ class BankStatement(models.Model):
def button_draft(self):
self.state = 'open'
@api.multi
def button_cancel(self):
return super(BankStatement, self.with_context(bank_statement_cancel=True)).button_cancel()
class BankStatementLine(models.Model):
_inherit = 'account.bank.statement.line'
@api.multi
def cancel(self):
if not self.env.context.get('bank_statement_cancel'):
for line in self:
if line.statement_id.state == 'confirm':
raise UserError(_("Please set the bank statement to New before canceling."))
return super(BankStatementLine, self).cancel()
@@ -38,7 +38,7 @@
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='button_cancel']" position="after">
<xpath expr="//button[@name='check_confirm_bank']" position="after">
<button name="button_draft" states="confirm" string="Reset to New" type="object"/>
</xpath>
</field>