[ADD] Add field to test is account cancel is installed to prevent to have 2 cancel button on statement

This commit is contained in:
vrenaville
2015-07-17 12:04:42 +02:00
parent 268c438775
commit 2dc9f8197c
2 changed files with 13 additions and 1 deletions

View File

@@ -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')

View File

@@ -13,7 +13,8 @@
<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"/>
<field name='account_cancel_installed' invisible="1"/>
<button name="cancel" attrs="{'invisible': ['|', ('journal_entry_id', '=', False),('account_cancel_installed','=',True) ,('state', '=', 'confirm')]}" string="Cancel" type="object" icon="gtk-undo"/>
</xpath>
</field>
</record>