mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Merge pull request #260 from vrenaville/account_cancel_test_installed
[ADD] Add field to test is account cancel is installed to prevent to …
This commit is contained in:
@@ -62,3 +62,17 @@ 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']
|
||||
res_found_module = ir_module.search_count([
|
||||
('name', '=', 'account_cancel'),
|
||||
('state', '=', 'installed')])
|
||||
if res_found_module:
|
||||
for line in self:
|
||||
line.account_cancel_installed = True
|
||||
|
||||
account_cancel_installed = fields.Boolean(
|
||||
compute='_is_account_cancel_installed',
|
||||
string='Allow Cancelling Entries')
|
||||
|
||||
@@ -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)]}" string="Cancel" type="object" icon="gtk-undo"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user