Skip to content

Commit

Permalink
[FIX] account_global_discount: Make tests resilient
Browse files Browse the repository at this point in the history
- Depending on the installed set of modules, the company currency may
  be USD or EUR. If the second case, these tests will fail, so we make
  sure that the company currency is USD for our tests, doing the change
  by SQL, as there's a Python constraint that prevents it.

Not needed in v17 due to: odoo/odoo#107113.
  • Loading branch information
OCA-git-bot authored and hildickethan committed Nov 15, 2023
1 parent b1e2825 commit 2fd9f4e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions account_global_discount/tests/test_global_discount.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ def setUpClass(cls, chart_template_ref=None):
cls.env.ref("base_global_discount.group_global_discount").write(
{"users": [(4, cls.env.user.id)]}
)
cls.currency_eur = cls.env.ref("base.EUR")
cls.currency_usd = cls.env.ref("base.USD")
cls.currency_usd.active = True
# Make sure the currency of the company is USD, as this not always happens
# To be removed in V17: https://github.com/odoo/odoo/pull/107113
cls.company = cls.env.company
cls.env.cr.execute(
"UPDATE res_company SET currency_id = %s WHERE id = %s",
(cls.env.ref("base.USD").id, cls.company.id),
)
cls.account = cls.env["account.account"].create(
{
"name": "Test account",
Expand Down

0 comments on commit 2fd9f4e

Please sign in to comment.