diff options
| author | nch@tinyerp.com <> | 2010-05-12 14:01:34 +0530 |
|---|---|---|
| committer | nch@tinyerp.com <> | 2010-05-12 14:01:34 +0530 |
| commit | 6428a5398fee574f6fada4fc0cc9732f5d1fe3db (patch) | |
| tree | d840481019586f711f853838dea7b5757897ef70 /addons/base_setup | |
| parent | c00448168e4375de7ebc0ec1f8f0b588dd1bea58 (diff) | |
| parent | eebfdc9e077788b58c811718a4d796be5f68b65e (diff) | |
[MERGE]:usability improvements for configuration & installer wizards
bzr revid: nch@tinyerp.com-20100512083134-0vpsq428xurh61gp
Diffstat (limited to 'addons/base_setup')
| -rw-r--r-- | addons/base_setup/__init__.py | 36 | ||||
| -rw-r--r-- | addons/base_setup/__openerp__.py | 2 | ||||
| -rw-r--r-- | addons/base_setup/base_setup_data.xml | 40 | ||||
| -rw-r--r-- | addons/base_setup/base_setup_installer.xml | 46 | ||||
| -rw-r--r-- | addons/base_setup/base_setup_todo.xml | 59 | ||||
| -rw-r--r-- | addons/base_setup/gtk_contact_form.py | 99 | ||||
| -rw-r--r-- | addons/base_setup/gtk_contact_form.xml | 77 | ||||
| -rw-r--r-- | addons/base_setup/installer.py | 22 | ||||
| -rw-r--r-- | addons/base_setup/todo.py | 12 |
9 files changed, 322 insertions, 71 deletions
diff --git a/addons/base_setup/__init__.py b/addons/base_setup/__init__.py index e4a4c3c80d8..3b78c6cb557 100644 --- a/addons/base_setup/__init__.py +++ b/addons/base_setup/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # @@ -15,16 +15,21 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import installer import todo +import gtk_contact_form import wizard - -from osv import osv +import os +import base64 +import random +import tools +from osv import fields, osv import netsvc +from tools.translate import _ class base_setup_config_choice(osv.osv_memory): """ @@ -32,6 +37,29 @@ class base_setup_config_choice(osv.osv_memory): _name = 'base.setup.config' logger = netsvc.Logger() + def _get_image(self, cr, uid, context=None): + file_no = str(random.randint(1,3)) + path = os.path.join('base','res','config_pixmaps/%s.png'%file_no) + file_data = tools.file_open(path,'rb').read() + return base64.encodestring(file_data) + + def get_users(self, cr, uid, context={}): + user_obj = self.pool.get('res.users') + user_ids = user_obj.search(cr, uid, []) + users = user_obj.browse(cr, uid, user_ids) + user_str = '\n'.join(map(lambda x: ' - %s: %s / %s' % (x.name, x.login, x.password), users)) + return _('The following users have been installed on your database: \n')+ user_str + + _columns = { + 'installed_users':fields.text('Installed Users', readonly=True), + 'config_logo' : fields.binary('Image', readonly=True), + } + + _defaults = { + 'installed_users':get_users, + 'config_logo' : _get_image + } + def set_default_menu(self, cr, uid, menu, context=None): user = self.pool.get('res.users')\ .browse(cr, uid, uid, context=context) diff --git a/addons/base_setup/__openerp__.py b/addons/base_setup/__openerp__.py index c6dd64d7bcc..ee0cc6a8f56 100644 --- a/addons/base_setup/__openerp__.py +++ b/addons/base_setup/__openerp__.py @@ -43,7 +43,7 @@ 'init_xml': ['base_setup_data.xml'], 'update_xml': ['security/ir.model.access.csv', 'base_setup_installer.xml', - 'base_setup_todo.xml',], + 'base_setup_todo.xml','gtk_contact_form.xml'], 'demo_xml': ['base_setup_demo.xml'], 'installable': True, 'active': True, diff --git a/addons/base_setup/base_setup_data.xml b/addons/base_setup/base_setup_data.xml index 0feb39bd563..90d48de5eba 100644 --- a/addons/base_setup/base_setup_data.xml +++ b/addons/base_setup/base_setup_data.xml @@ -6,25 +6,27 @@ <field name="model">base.setup.config</field> <field name="type">form</field> <field name="arch" type="xml"> - <form string="Setup"> - <group colspan="4"> - <image name="gtk-dialog-info"/> - <group colspan="2" col="4"> - <separator colspan="4" string="Installation Done"/> - <label align="0.0" colspan="4" - string="Your new database is now fully installed."/> - <label align="0.0" colspan="4" - string="You can start configuring the system or connect directly to the database using the default setup."/> - </group> - </group> - <separator string="" colspan="4"/> - <button name="menu" icon="gtk-ok" type="object" - string="Use Directly"/> - <button name="config" icon="gtk-go-forward" type="object" - string="Start Configuration"/> - </form> - </field> - </record> + <form string="Setup"> + <group colspan="4" col="8" width="600"> + <group> + <field name="config_logo" widget="image" width="150" height="100" nolabel="1" colspan="1"/> + </group> + <group colspan="6"> + <separator string="Installation Done" colspan="8"/> + <label align="0.0" string="Your new database is now fully installed." colspan="8"/> + <field name="installed_users" nolabel= "1" colspan="8"/> + <label align="0.0" colspan="8" string="You can start configuring the system or connect directly to the database as an administrator."/> + </group> + </group> + <group colspan="8" col="8"> + <separator string="" colspan="8"/> + <label string="" colspan="6"/> + <button name="menu" icon="gtk-ok" type="object" string="Use Directly" colspan="1"/> + <button name="config" icon="gtk-go-forward" type="object" string="Start Configuration" colspan="1"/> + </group> + </form> + </field> + </record> <record id="action_base_setup" model="ir.actions.act_window"> <field name="name">Setup</field> diff --git a/addons/base_setup/base_setup_installer.xml b/addons/base_setup/base_setup_installer.xml index 3b1a98f4d05..2b4a870236a 100644 --- a/addons/base_setup/base_setup_installer.xml +++ b/addons/base_setup/base_setup_installer.xml @@ -10,29 +10,32 @@ <form position="attributes"> <attribute name="string">Base Setup Modules Installation</attribute> </form> - <separator string="title" position="attributes"> - <attribute name="string">Install Modules</attribute> - </separator> <xpath expr="//label[@string='description']" position="attributes"> <attribute name="string" - >Now that OpenERP is installed, we have selected applications commonly useful to users which you can install directly, as well as sets of applications for more specific types or groups of businesses (the vertical modules). + >Now that OpenERP is installed, We have selected applications commonly useful to users which you can install directly, as well as sets of applications for more specific types or groups of businesses (the vertical modules). If you don't think you need any of these right now, you can easily install them later on.</attribute> </xpath> + <xpath expr='//separator[@string="vsep"]' position='attributes'> + <attribute name='string'></attribute> + <attribute name='rowspan'>15</attribute> + </xpath> + <separator string="title" position="attributes"> + <attribute name="string">Install Generic Modules</attribute> + </separator> <group colspan="8"> - <separator string="Generic Modules" colspan="4"/> - <field name="crm"/> <field name="sale"/> - <field name="project"/> <field name="knowledge"/> - <field name="stock"/> <field name="mrp"/> - <field name="account"/> <field name="purchase"/> - <field name="hr"/> <field name="point_of_sale"/> - <field name="marketing"/> <field name="misc_tools"/> - <field name="report_designer"/> - <separator string="Vertical Modules" colspan="4"/> - <field name="profile_association"/> - <field name="profile_auction"/> - <field name="profile_bookstore"/> + <field name="crm" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> + <field name="project" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="knowledge" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> + <field name="stock" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="mrp" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> + <field name="account" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="purchase" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> + <field name="hr" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="point_of_sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)" groups="base.group_extended"/> + <field name="marketing" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)" groups="base.group_extended"/> <field name="misc_tools" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> + <field name="report_designer" groups="base.group_extended" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> + <separator string="Install Specific Business Modules" colspan="4"/> + <field name="profile_association" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> + <field name="profile_auction" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> + <field name="profile_bookstore" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> </group> </data> </field> @@ -52,5 +55,16 @@ If you don't think you need any of these right now, you can easily install them <field name="action_id" ref="action_base_setup_installer"/> <field name="sequence">2</field> </record> + <record id="base_setup_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">base_setup_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_base_setup_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/base_setup/base_setup_todo.xml b/addons/base_setup/base_setup_todo.xml index 08691e60d35..eb108aef229 100644 --- a/addons/base_setup/base_setup_todo.xml +++ b/addons/base_setup/base_setup_todo.xml @@ -10,33 +10,44 @@ <form position="attributes"> <attribute name="string">Main Company Setup</attribute> </form> - + <xpath expr="//label[@string='description']" position="attributes"> + <attribute name="string">Information of your company will be used to custiomize your documents like Invoices, Sale Orders,...</attribute> + </xpath> + <xpath expr='//separator[@string="title"]' position='attributes'> + <attribute name='string'>Configure Your Company</attribute> + </xpath> + <xpath expr='//separator[@string="vsep"]' position='attributes'> + <attribute name='rowspan'>23</attribute> + <attribute name='string'></attribute> + </xpath> <group string="res_config_contents" position="replace"> - <field name="company_id" invisible="1"/> - - <separator string="Configure Your Company" colspan="4"/> - <field name="name" colspan="4" required="True"/> - <newline/> - <field name="street"/> - <field name="street2"/> - <field name="zip"/> - <field name="city"/> - <field name="country_id"/> - <field name="state_id"/> - <field name="email"/> - <field name="phone"/> - <field name="currency"/> + <group colspan="5"> + <group colspan="2"> + <field name="company_id" invisible="1"/> + <field name="name" colspan="4" required="True"/> + <newline/> + <field name="street"/> + <field name="street2"/> + <field name="zip"/> + <field name="city"/> + <field name="country_id"/> + <field name="state_id"/> + <field name="email"/> + <field name="phone"/> + <field name="currency" widget="selection"/> - <separator string="Report Information" colspan="4"/> - <field name="rml_header1" colspan="4"/> - <field name="rml_footer1" colspan="4"/> - <field name="rml_footer2" colspan="4"/> + <separator string="Report Information" colspan="4"/> + <field name="rml_header1" colspan="4"/> + <field name="rml_footer1" colspan="4"/> + <field name="rml_footer2" colspan="4"/> - <separator colspan="4" - string="Your Logo - Use a size of about 450x150 pixels."/> - <field colspan="4" name="logo" widget="image" - nolabel="1"/> - </group> + <separator colspan="4" + string="Your Logo - Use a size of about 450x150 pixels."/> + <field colspan="4" name="logo" widget="image" + nolabel="1"/> + </group> + </group> + </group> <xpath expr='//button[@name="action_skip"]' position='replace'/> </data> diff --git a/addons/base_setup/gtk_contact_form.py b/addons/base_setup/gtk_contact_form.py new file mode 100644 index 00000000000..b1d01cecb66 --- /dev/null +++ b/addons/base_setup/gtk_contact_form.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## +from operator import itemgetter + +from osv import osv, fields +import netsvc +import tools +from tools import misc + +class base_gtkcontactform(osv.osv_memory): + """ + """ + _name = 'base.gtkcontactform' + _inherit = 'res.config' + logger = netsvc.Logger() + + def default_get(self, cr, uid, fields_list=None, context=None): + ''' set email and phone number selected in the previous company information + form ''' + defaults = super(base_gtkcontactform, self)\ + .default_get(cr, uid, fields_list=fields_list, context=context) + company_id = self.pool.get('base.setup.company').search(cr, uid, []) + company = self.pool.get('base.setup.company').read(cr, uid, company_id) + company = company and company[0] or False + if company: + defaults.update({'email':company.get('email',''), + 'phone': company.get('phone','')}) + return defaults + + _columns = { + 'name':fields.char('Your Name', size=64, required=True), + 'job':fields.char('Job Title', size=64,), + 'email':fields.char('E-mail', size=64, required=True), + 'phone':fields.char('Phone', size=64, required=True), + 'total_employees':fields.selection([('1-5','1-5'),('5-20','5-20'),('20-100','20-100'),('100-500','100-500'),('500','500+')], 'No Of Employees', size=32), + 'industry':fields.selection([('apparel','Apparel'),('banking','Banking'),('biotechnology','Biotechnology'),('chemicals','Chemicals'),('communications','Communications'), + ('construction','Construction'),('consulting','Consulting'),('education','Education'),('electronics','Electronics'),('energy','Energy'),('engineering','Engineering'), + ('entertainment','Entertainment'),('environmental','Environmental'),('finance','Finance'),('government','Government'),('healthcare','Healthcare'),('hospitality','Hospitality'), + ('insurance','Insurance'),('machinery','Machinery'),('manufacturing','Manufacturing'),('media','Media'),('notforprofit','Not For Profit'), + ('recreation','Recreation'),('retail','Retail'),('shipping','Shipping'),('technology','Technology'),('telecommunications','Telecommunications'), + ('transportation','Transportation'),('utilities','Utilities'),('other','Other'), + ], 'Industry', size=32), + 'use_openerp':fields.boolean('We plan to use OpenERP'), + 'already_using_openerp':fields.boolean('Already using OpenERP'), + 'sell_openerp':fields.boolean('Plan to sell OpenERP'), + 'already_selling__openerp':fields.boolean('Already selling OpenERP'), + + 'features':fields.boolean('The features of OpenERP'), + 'saas':fields.boolean('OpenERP Online Solutions (SaaS)'), + 'partners_program':fields.boolean('OpenERP Partners Program (for integrators)'), + 'support':fields.boolean('Support and Maintenance Solutions'), + 'training':fields.boolean('OpenERP Training Program'), + 'other':fields.boolean('Other'), + 'ebook':fields.boolean('ebook'), + 'updates':fields.boolean('updates'), + } + def execute(self, cr, uid, ids, context=None): + company_id = self.pool.get('base.setup.company').search(cr, uid, []) + company_data = self.pool.get('base.setup.company').read(cr, uid, company_id) + company_data = company_data and company_data[0] or False + country1 = '' + if company_data and company_data.get('country_id', False): + country = self.pool.get('res.country').read(cr, uid, company_data['country_id'],['name'])['name'] + for res in self.read(cr, uid, ids): + email = res.get('email','') + result = "\ncompany: "+ str(company_data.get('name','')) + result += "\nname: " + str(res.get('name','')) + result += "\nphone: " + str(res.get('phone','')) + result += "\ncity: " + str(company_data.get('city','')) + result += "\ncountry: " + str(country) + result += "\nindustry: " + str(res.get('industry', '')) + result += "\ntotal_employees: " + str(res.get('total_employees', '')) + result += "\nplan_use: " + str(res.get('use_openerp', False)) + result += "\nsell_openerp: " + str(res.get('sell_openerp', False)) + result += "\nebook: " + str(res.get('ebook',False)) + result += "\ngtk: " + str(True) + misc.upload_data(email, result, type='SURVEY') + + + +base_gtkcontactform()
\ No newline at end of file diff --git a/addons/base_setup/gtk_contact_form.xml b/addons/base_setup/gtk_contact_form.xml new file mode 100644 index 00000000000..c4fe08207dd --- /dev/null +++ b/addons/base_setup/gtk_contact_form.xml @@ -0,0 +1,77 @@ +<openerp> + <data> + <record id="view_base_setup_contact" model="ir.ui.view"> + <field name="name">Contact information</field> + <field name="model">base.gtkcontactform</field> + <field name="type">form</field> + <field name="inherit_id" ref="base.res_config_view_base"/> + <field name="arch" type="xml"> + <data> + <form position="attributes"> + <attribute name="string">Contact Information</attribute> + </form> + <xpath expr="//label[@string='description']" position="attributes"> + <attribute name="string">Information about you and the company you are related too. The Basic information related to the company has already been collected and some more information required by you to fill.</attribute> + </xpath> + <xpath expr='//separator[@string="title"]' position='attributes'> + <attribute name='string'>Do You Need Them ?</attribute> + <attribute name='colspan'>4</attribute> + </xpath> + <xpath expr='//separator[@string="vsep"]' position='attributes'> + <attribute name='rowspan'>22</attribute> + <attribute name='string'></attribute> + </xpath> + <group string="res_config_contents" position="replace"> + <group colspan="4" height="450" width="600"> + <group colspan="4"> + <field name="ebook" nolabel="1"/> + <label align="0.0" string="I want to receive the Open ERP ebook (PDF) by email." colspan="3"/> + <field name="updates" nolabel="1"/> + <label align="0.0" string="Yes, I would like to receive information updates from OpenERP." colspan="3"/> + </group> + <group colspan="4" attrs="{'invisible':[('ebook','=',False),('updates','=',False)]}"> + <separator colspan="4" string="About You"/> + <field name="name" colspan="2" required="True"/> + <field name="job" colspan="2"/> + <field name="email" colspan="2"/> + <field name="phone" colspan="2"/> + <field name="total_employees" colspan="2"/> + <field name="industry" colspan="2"/> + </group> + <group colspan="4" attrs="{'invisible':[('ebook','=',False),('updates','=',False)]}"> + <separator string="Your projects with OpenERP" colspan="4"/> + <field name="use_openerp" align="0.0" colspan="1"/> + <field name="already_using_openerp" align="0.0" colspan="1"/> + <field name="sell_openerp" align="0.0" colspan="1"/> + <field name="already_selling__openerp" align="0.0" colspan="1"/> + <separator colspan="4" string="You would like to know more about"/> + <field name="features" align="0.0" colspan="1"/> + <field name="training" align="0.0" colspan="1"/> + <field name="saas" align="0.0" colspan="1"/> + <field name="support" align="0.0" colspan="1"/> + <field name="partners_program" align="0.0" colspan="1"/> + <field name="other" align="0.0" colspan="1"/> + </group> + </group> + </group> + </data> + </field> + </record> + + <record id="action_base_contact" model="ir.actions.act_window"> + <field name="name">Setup contact information</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">base.gtkcontactform</field> + <field name="view_id" ref="view_base_setup_contact"/> + <field name="view_type">form</field> + <field name="view_mode">form</field> + <field name="target">new</field> + </record> + + <record id="base_setup_contact_todo" model="ir.actions.todo"> + <field name="action_id" ref="action_base_contact"/> + <field name="sequence">1</field> + <field name="restart">onskip</field> + </record> + </data> +</openerp> diff --git a/addons/base_setup/installer.py b/addons/base_setup/installer.py index d86e5f61796..13b37c67e1f 100644 --- a/addons/base_setup/installer.py +++ b/addons/base_setup/installer.py @@ -69,7 +69,7 @@ class base_setup_installer(osv.osv_memory): help="Helps you manage your marketing campaigns step by step."), 'misc_tools':fields.boolean('Miscellaneous Tools', help="Lets you install various interesting but non-essential " - "tools."), + "tools like Survey, Lunch,..."), 'report_designer':fields.boolean('Advanced Reporting', help="Lets you install various tools to simplify and enhance " "OpenERP's report creation."), @@ -90,5 +90,25 @@ class base_setup_installer(osv.osv_memory): _defaults = { 'crm': True, } + + + def onchange_moduleselection(self, cr, uid, ids, *args): + progress = self._progress(cr, uid) - (2.5 * len(filter(lambda x: x==1, args))) + if progress <= 5.0: + progress = 5.0 + return {'value':{'progress':progress}} + + def modules_to_install(self, cr, uid, ids, context=None): + modules = super(base_setup_installer, self).modules_to_install(cr, uid, ids, context=context) + interface_id = self.pool.get('res.config.view').search(cr, uid, []) + interface = self.pool.get('res.config.view').read(cr, uid, interface_id)[0] + modules_selected = self.read(cr, uid, ids)[0] + added_modules = [] + if interface.get('view', '') == 'simple' : + if modules_selected.get('mrp', False): + added_modules.append('mrp_jit') + if modules_selected.get('knowledge', False): + added_modules.append('document_ftp') + return modules | set(added_modules) base_setup_installer() diff --git a/addons/base_setup/todo.py b/addons/base_setup/todo.py index d23ac71d60b..6d161d581f8 100644 --- a/addons/base_setup/todo.py +++ b/addons/base_setup/todo.py @@ -48,23 +48,23 @@ class base_setup_company(osv.osv_memory): cr, uid, 'res.country.state', context=context) def _get_all_countries(self, cr, uid, context=None): return self._get_all(cr, uid, 'res.country', context=context) - def _get_all_currencies(self, cr, uid, context=None): - return self._get_all(cr, uid, 'res.currency', context=context) def default_get(self, cr, uid, fields_list=None, context=None): """ get default company if any, and the various other fields from the company's fields """ + base_mod = self.pool.get('ir.module.module').search(cr, uid, [('name','ilike','base')]) + base_mod_rec = self.pool.get('ir.module.module').browse(cr, uid, base_mod)[0] defaults = super(base_setup_company, self)\ .default_get(cr, uid, fields_list=fields_list, context=context) - companies = self.pool.get('res.company') company_id = companies.search(cr, uid, [], limit=1, order="id") if not company_id or 'company_id' not in fields_list: return defaults company = companies.browse(cr, uid, company_id[0]) - defaults['company_id'] = company.id + if not base_mod_rec.demo: + return defaults defaults['currency'] = company.currency_id.id for field in ['name','logo','rml_header1','rml_footer1','rml_footer2']: defaults[field] = company[field] @@ -90,7 +90,7 @@ class base_setup_company(osv.osv_memory): 'country_id':fields.selection(_get_all_countries, 'Countries'), 'email':fields.char('E-mail', size=64), 'phone':fields.char('Phone', size=64), - 'currency':fields.selection(_get_all_currencies, 'Currency', required=True), + 'currency':fields.many2one('res.currency', 'Currency', required=True), 'rml_header1':fields.char('Report Header', size=200, help='''This sentence will appear at the top right corner of your reports. We suggest you to put a slogan here: @@ -112,7 +112,6 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701'''), if not getattr(payload, 'company_id', None): raise ValueError('Case where no default main company is setup ' 'not handled yet') - company = payload.company_id company.write({ 'name':payload.name, @@ -120,6 +119,7 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701'''), 'rml_footer1':payload.rml_footer1, 'rml_footer2':payload.rml_footer2, 'logo':payload.logo, + 'currency_id':payload.currency.id, }) company.partner_id.write({ |
