From 90dc966fc9abe558cffe2fb7dcd792606ddd47ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Br=C3=BCckl?= Date: Fri, 30 Jan 2015 15:22:21 +0100 Subject: [PATCH] decimal places price --- setup/lib/cli.py | 55 +++++++++++++++++++++--------------------- setup/lib/config_at.py | 5 ++-- setup/lib/functions.py | 12 ++++++++- 3 files changed, 42 insertions(+), 30 deletions(-) diff --git a/setup/lib/cli.py b/setup/lib/cli.py index 9395f041..03e7a21d 100755 --- a/setup/lib/cli.py +++ b/setup/lib/cli.py @@ -41,7 +41,7 @@ def main(): 'install_module_sale', 'setup_accounting', 'setup_accounting2', - 'set_admin_rights', + 'set_admin_rights', ] if cmd == 'setup': @@ -55,61 +55,62 @@ def main(): 'stock_config', 'set_incoterms', 'purchase_config', - 'set_date_format', - 'set_company', - 'set_taxes', - 'set_uom', - 'set_steuerzuordnung', - 'setup_journals', - 'set_currencies', + 'set_date_format', + 'set_company', + 'set_taxes', + 'set_uom', + 'set_steuerzuordnung', + 'setup_journals', + 'set_currencies', + 'set_decimal_price', ] if cmd == 'rollout': methods = [ 'login', - 'set_dokumentennummern', - 'set_dmi_noupdate', - 'dmi_confirm_inventory', - ] - + 'set_dokumentennummern', + 'set_dmi_noupdate', + 'dmi_confirm_inventory', + ] + if cmd == 'update': instance.config.module_name = argv[2] methods = [ 'login', - 'update_module', - ] + 'update_module', + ] if cmd == 'install': instance.config.module_name = argv[2] methods = [ 'login', - 'install_module', - ] + 'install_module', + ] if cmd == 'update_modules': methods = [ 'login', - 'update_modules', - ] + 'update_modules', + ] if cmd == 'update_all': methods = [ 'login', - 'update_all', - ] + 'update_all', + ] if not methods: _usage() - + print env - - for method in methods: + + for method in methods: res = getattr(instance, method)() print "%s: %s" % (res and "OK " or "ERROR ", getattr(instance, method).__doc__) if not res: return False - + print "\nAbgeschlossen." - + if __name__ == "__main__": - main() + main() diff --git a/setup/lib/config_at.py b/setup/lib/config_at.py index 2e8e700d..d7f2e536 100644 --- a/setup/lib/config_at.py +++ b/setup/lib/config_at.py @@ -7,8 +7,9 @@ class Config(): self.chart_of_accounts = 'l10n_at' self.sales_tax = '20% MwSt' self.purchase_tax = '20% VSt' - self.chart_template_id = 2 # Austrian Chart of Account - + self.chart_template_id = 2 # Austrian Chart of Account + self.digits = 2 #Nachkommastellen Preis + self.company_data = { 'name': 'Camadeus GmbH', 'street': 'Kriehubergasse 16', diff --git a/setup/lib/functions.py b/setup/lib/functions.py index 5fe2ab43..489d2411 100755 --- a/setup/lib/functions.py +++ b/setup/lib/functions.py @@ -483,4 +483,14 @@ class CamadeusFunctions(): if inventory.get('state','') == 'confirm': return self._execute('stock.inventory', 'action_done', [inventory_id]) - return True \ No newline at end of file + return True + + def set_decimal_price(self): + """Dezimalstellen Preis setzen""" + + # Set all currencies to active + ids = self._execute('decimal.precision', 'search', [('name','=','Product Price')]) + res = self._execute('decimal.precision', 'write', ids, {'digits': self.config.digits}) + if not res: + return False + return True \ No newline at end of file