Skip to content

Commit

Permalink
[FIX] account: Fix broken tour/test render document in l10n builds
Browse files Browse the repository at this point in the history
  • Loading branch information
smetl committed Jun 5, 2020
1 parent c688046 commit 3ba4495
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
11 changes: 11 additions & 0 deletions addons/account/tests/test_account_onboarding.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
from odoo.tests.common import tagged, HttpCase

import logging

_logger = logging.getLogger(__name__)


@tagged('-at_install', 'post_install', 'document_layout')
class TestAccountDocumentLayout(HttpCase):

def test_render_account_document_layout(self):
report_layout = self.env.ref('web.report_layout_standard')
main_company = self.env.ref('base.main_company')

# Tour can't be runned if the setup if not the generic one.
generic_coa = self.env.ref('l10n_generic_coa.configurable_chart_template', raise_if_not_found=False)
if not main_company.chart_template_id or main_company.chart_template_id != generic_coa:
_logger.info("Test render account document layout skipped: generic coa not found.")
return

main_company.write({
'primary_color': '#123456',
'secondary_color': '#789101',
Expand Down
13 changes: 11 additions & 2 deletions addons/account/tests/test_reconciliation_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@ def test_01_admin_bank_statement_reconciliation(self):
bank_stmt_name = 'BNK/%s/0001' % time.strftime('%Y')
bank_stmt_line = self.env['account.bank.statement'].search([('name', '=', bank_stmt_name)]).mapped('line_ids')
if not bank_stmt_line:
_logger.exception('Could not find bank statement %s' % bank_stmt_name)
_logger.info("Tour bank_statement_reconciliation skipped: bank statement %s not found." % bank_stmt_name)
return

admin = self.env.ref('base.user_admin')

# Tour can't be runned if the setup if not the generic one.
generic_coa = self.env.ref('l10n_generic_coa.configurable_chart_template', raise_if_not_found=False)
if not admin.company_id.chart_template_id or admin.company_id.chart_template_id != generic_coa:
_logger.info("Tour bank_statement_reconciliation skipped: generic coa not found.")
return

# To be able to test reconciliation, admin user must have access to accounting features, so we give him the right group for that
self.env.ref('base.user_admin').write({'groups_id': [(4, self.env.ref('account.group_account_user').id)]})
admin.write({'groups_id': [(4, self.env.ref('account.group_account_user').id)]})

payload = {'action':'bank_statement_reconciliation_view', 'statement_line_ids[]': bank_stmt_line.ids}
prep = requests.models.PreparedRequest()
Expand Down

0 comments on commit 3ba4495

Please sign in to comment.