From 1724794f7b779b2d039035f22ba44594f8deadb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 26 Feb 2008 18:21:28 +0100 Subject: [PATCH] Remove demo on module It will be handle by specific modules --- trytond/config.py | 7 ------- trytond/init.sql | 1 - trytond/ir/module/module.py | 20 +++----------------- trytond/ir/module/module.xml | 2 -- trytond/module.py | 23 ++++++++--------------- trytond/pooler.py | 24 +++++++++++------------- trytond/web_service/db.py | 4 ++-- 7 files changed, 24 insertions(+), 57 deletions(-) diff --git a/trytond/config.py b/trytond/config.py index 37b937faa5..60cc2bba76 100644 --- a/trytond/config.py +++ b/trytond/config.py @@ -34,7 +34,6 @@ class ConfigManager(object): 'smtp_password': False, 'stop_after_init': False, 'data_path': '/var/lib/trytond', - 'without_demo': False, } parser = optparse.OptionParser(version=VERSION) @@ -79,9 +78,6 @@ class ConfigManager(object): group = optparse.OptionGroup(parser, "Modules related options") group.add_option("-i", "--init", dest="init", help="init a module (use \"all\" for all modules)") - group.add_option("--without-demo", dest="without_demo", - help="load demo data for a module " \ - "(use \"all\" for all modules)") group.add_option("-u", "--update", dest="update", help="update a module (use \"all\" for all modules)") parser.add_option_group(group) @@ -162,7 +158,6 @@ class ConfigManager(object): 'verbose', 'debug_mode', 'stop_after_init', - 'without_demo', 'netrpc', 'xmlrpc', 'webdav', @@ -175,8 +170,6 @@ class ConfigManager(object): for i in opt.init.split(','): init[i] = 1 self.options['init'] = init - self.options["demo"] = not opt.without_demo \ - and self.options['init'] or {} update = {} if opt.update: diff --git a/trytond/init.sql b/trytond/init.sql index a1e2679889..737854d630 100644 --- a/trytond/init.sql +++ b/trytond/init.sql @@ -236,7 +236,6 @@ CREATE TABLE ir_module_module ( shortdesc character varying(256), category integer REFERENCES ir_module_category ON DELETE SET NULL, description text, - demo boolean default False, primary key(id) ); ALTER TABLE ir_module_module add constraint name_uniq unique (name); diff --git a/trytond/ir/module/module.py b/trytond/ir/module/module.py index d8420f179f..dd319a20f1 100644 --- a/trytond/ir/module/module.py +++ b/trytond/ir/module/module.py @@ -147,7 +147,6 @@ class Module(OSV): ('to remove', 'To be removed'), ('to install', 'To be installed'), ], string='State', readonly=True) - demo = fields.Boolean('Demo data') license = fields.Selection([('GPL-2', 'GPL-2'), ('Other proprietary', 'Other proprietary')], string='License', readonly=True) @@ -160,9 +159,6 @@ class Module(OSV): def default_state(self, cursor, user, context=None): return 'uninstalled' - def default_demo(self, cursor, user, context=None): - return False - def default_license(self, cursor, user, context=None): return 'GPL-2' @@ -242,21 +238,12 @@ class Module(OSV): parents2 += get_parents(parent, graph) return parents + parents2 dependencies = get_parents(module.name, graph) - module_dep_ids = self.search(cursor, user, [ + module_install_ids = self.search(cursor, user, [ ('name', 'in', dependencies), + ('state', '=', 'uninstalled'), ], context=context) - demo = True - module_install_ids = [module.id] - for module_dep in self.browse(cursor, user, module_dep_ids, - context=context): - if module_dep.state != 'uninstalled': - if not module_dep.demo: - demo = False - else: - module_install_ids.append(module_dep.id) - self.write(cursor, user, module_install_ids, { + self.write(cursor, user, module_install_ids + [module.id], { 'state': 'to install', - 'demo': demo, }, context=context) def state_upgrade(self, cursor, user, ids, context=None): @@ -291,7 +278,6 @@ class Module(OSV): def button_install_cancel(self, cursor, user, ids, context=None): self.write(cursor, user, ids, { 'state': 'uninstalled', - 'demo': False, }, context=context) return True diff --git a/trytond/ir/module/module.xml b/trytond/ir/module/module.xml index 2a5fd03e69..9243a0b137 100644 --- a/trytond/ir/module/module.xml +++ b/trytond/ir/module/module.xml @@ -28,8 +28,6 @@