diff --git a/setup/lib/cli.py b/setup/lib/cli.py index 5106df6b..d0b015a4 100755 --- a/setup/lib/cli.py +++ b/setup/lib/cli.py @@ -57,7 +57,8 @@ def main(): 'set_taxes', 'set_uom', 'set_steuerzuordnung', - 'setup_journals', + 'setup_journals', + 'set_currencies', ] if cmd == 'rollout': diff --git a/setup/lib/config_at.py b/setup/lib/config_at.py index c38baa22..a44cee41 100644 --- a/setup/lib/config_at.py +++ b/setup/lib/config_at.py @@ -50,7 +50,12 @@ class Config(): 'Kunde Ausland', 'Kunde EU (ohne USt-ID)', 'Kunde EU Unternehmen (mit USt-ID)', - ] + ] + + # Aktive Währungen + self.valid_currencies = [ + 'EUR', + ] # Allgemeine Einstellungen self.base_config = { diff --git a/setup/lib/functions.py b/setup/lib/functions.py index 13977342..dde397e5 100755 --- a/setup/lib/functions.py +++ b/setup/lib/functions.py @@ -264,6 +264,25 @@ class CamadeusFunctions(): wizard_id = self._execute('wizard.multi.charts.accounts', 'create', vals) res = self._execute('wizard.multi.charts.accounts', 'action_next', [wizard_id]) return True + + def set_currencies(self): + """Währungen setzen""" + + c = self.config + + # Set all currencies to active + ids = self._execute('res.currency', 'search', ['|',('active','=',True),('active','=',False)]) + res = self._execute('res.currency', 'write', ids, {'active': True}) + if not res: + return False + + # Set all other UOMs to inactive + inactive_ids = self._execute('res.currency', 'search', [('name','not in',c.valid_currencies)]) + res = self._execute('res.currency', 'write', inactive_ids, {'active': False}) + if not res: + return False + + return True def uninstall_chat(self): """Chat-Modul deinstallieren """