diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 07767328a55..818bfef978e 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -328,8 +328,8 @@ class account_cash_statement(osv.osv): statement_pool = self.pool.get('account.bank.statement') for statement in statement_pool.browse(cr, uid, ids, context=context): vals = {} - - if not self._user_allow(cr, uid, statement.id, context=context): + force_allow = context.get('force_allow',False) + if not force_allow and not self._user_allow(cr, uid, statement.id, context=context): raise osv.except_osv(_('Error !'), _('User %s does not have rights to access %s journal !' % (statement.user_id.name, statement.journal_id.name))) if statement.name and statement.name == '/': diff --git a/addons/account/test/account_cash_statement.yml b/addons/account/test/account_cash_statement.yml index 03d0d54db83..67e6d4d2607 100644 --- a/addons/account/test/account_cash_statement.yml +++ b/addons/account/test/account_cash_statement.yml @@ -26,7 +26,7 @@ I clicked on Open CashBox button to open the cashbox - !python {model: account.bank.statement}: | - self.button_open(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), }) + self.button_open(cr, uid, [ref("account_bank_statement_1")], {"force_allow":True, "lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), }) - I check that now bank statement is in the "Open" state