changeset 3711960e29dc in modules/currency:default
details: https://hg.tryton.org/modules/currency?cmd=changeset;node=3711960e29dc
description:
Run all import scripts with active_test disabled
This ensures that all records have the same context and thus can be
saved
together.
issue8730
review264421002
diffstat:
scripts/import_currencies.py | 7 +++----
tests/scenario_currency_import.rst | 5 +++++
2 files changed, 8 insertions(+), 4 deletions(-)
diffs (44 lines):
diff -r dd33e25eb6d4 -r 3711960e29dc scripts/import_currencies.py
--- a/scripts/import_currencies.py Mon Oct 14 00:13:00 2019 +0200
+++ b/scripts/import_currencies.py Thu Oct 24 19:18:42 2019 +0200
@@ -39,9 +39,7 @@
def get_currencies():
Currency = Model.get('currency.currency')
-
- with config.get_config().set_context(active_test=False):
- return {c.code: c for c in Currency.find([])}
+ return {c.code: c for c in Currency.find([])}
def update_currencies(currencies):
@@ -87,7 +85,8 @@
def main(database, config_file=None):
config.set_trytond(database, config_file=config_file)
- do_import()
+ with config.get_config().set_context(active_test=False):
+ do_import()
def do_import():
diff -r dd33e25eb6d4 -r 3711960e29dc tests/scenario_currency_import.rst
--- a/tests/scenario_currency_import.rst Mon Oct 14 00:13:00 2019 +0200
+++ b/tests/scenario_currency_import.rst Thu Oct 24 19:18:42 2019 +0200
@@ -4,6 +4,7 @@
Imports::
+ >>> from proteus import Model
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.currency.scripts import import_currencies
@@ -13,4 +14,8 @@
Import currencies::
+ >>> Currency = Model.get('currency.currency')
+ >>> eur = Currency(name="Euro", symbol="€", code='EUR')
+ >>> eur.save()
+
>>> import_currencies.do_import()