From 2dc9f8197c5c7038f88608614e426afed496e4ab Mon Sep 17 00:00:00 2001 From: vrenaville Date: Fri, 17 Jul 2015 12:04:42 +0200 Subject: [PATCH 1/2] [ADD] Add field to test is account cancel is installed to prevent to have 2 cancel button on statement --- account_constraints/model/account_bank_statement.py | 11 +++++++++++ account_constraints/view/account_bank_statement.xml | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/account_constraints/model/account_bank_statement.py b/account_constraints/model/account_bank_statement.py index e1a3b35de..2aa438e90 100644 --- a/account_constraints/model/account_bank_statement.py +++ b/account_constraints/model/account_bank_statement.py @@ -62,3 +62,14 @@ class AccountBankStatementLine(models.Model): self = self.with_context(from_parent_object=True) return super(AccountBankStatementLine, self)\ .process_reconciliation(mv_line_dicts) + + @api.multi + def _is_account_cancel_installed(self): + ir_module = self.env['ir.module.module'] + account_cancel = ir_module.search([('name', '=', 'account_cancel'), + ('state', '=', 'installed')]) + return bool(account_cancel) + + account_cancel_installed = fields.Boolean( + compute='_is_account_cancel_installed', + string='Allow Cancelling Entries') diff --git a/account_constraints/view/account_bank_statement.xml b/account_constraints/view/account_bank_statement.xml index b1c7f3e48..f9ca7f3c8 100644 --- a/account_constraints/view/account_bank_statement.xml +++ b/account_constraints/view/account_bank_statement.xml @@ -13,7 +13,8 @@ -