[IMP] base.config.settings: improve code and view

bzr revid: rco@openerp.com-20120419132911-khnhgthoe4qawdup
This commit is contained in:
Raphael Collet 2012-04-19 15:29:11 +02:00
parent 0c1f7acc27
commit a5a2971c72
2 changed files with 34 additions and 56 deletions

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -19,42 +19,23 @@
#
##############################################################################
from osv import fields, osv
from osv import osv, fields
class general_configuration(osv.osv_memory):
_name = 'general.configuration'
_name = 'base.config.settings'
_inherit = 'res.config.settings'
_columns = {
'module_multi_company': fields.boolean('Active Multi company',
help ="""It allow to installs the multi_company module."""),
'module_portal': fields.boolean('Customer Portal',
help ="""It installs the portal module."""),
'module_multi_company': fields.boolean('Multi Company',
help="""Work in multi-company environments, with appropriate security access between companies.
This installs the module multi_company."""),
'module_portal': fields.boolean('Portal',
help="""Define a portal for your customers or suppliers. The portal is a group of
external users that has specific access rights and rules.
This installs the module portal."""),
'module_share': fields.boolean('Share',
help ="""It installs the share module."""),
help="""Share OpenERP documents (records) with external users.
This installs the module share."""),
}
def base_setup_company(self, cr, uid, ids, context=None):
if context is None:
context = {}
data_obj = self.pool.get('ir.model.data')
user = self.pool.get('res.users').browse(cr, uid, uid)
context.update({'res_id': user.company_id.id})
company_view_id = data_obj.get_object_reference(cr, uid, 'base', 'view_company_form')
if company_view_id:
company_view_id = company_view_id and company_view_id[1] or False
return {
'view_mode': 'form',
'view_type': 'form',
'res_model': 'res.company',
'res_id': int(context.get('res_id')),
'views': [(company_view_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'current',
'nodestroy':True,
'context': context,
}
general_configuration()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -2,40 +2,37 @@
<data>
<record id="view_general_configuration" model="ir.ui.view">
<field name="name">General Application</field>
<field name="model">general.configuration</field>
<field name="name">General Settings</field>
<field name="model">base.config.settings</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string ="General Application">
<separator string="Company Settings" colspan="4"/>
<group colspan="4" col="4">
<group colspan="2" col="2">
<label string="Set Company Header and Footer :"/>
<button name="base_setup_company" string="Header and Footer" type="object" icon="gtk-go-forward"/>
</group>
<group colspan="2" col="2">
<form string="General Settings" layout="manual">
<div class="oe_form_topbar">
<button string="Apply" type="object" name="execute"/>
<button string="Cancel" special="cancel"/>
</div>
<sheet layout="auto">
<separator string="Company Settings" colspan="4"/>
<field name="module_multi_company"/>
</group>
</group>
<separator string="Others" colspan="4"/>
<group colspan="4" col="4">
<field name="module_share"/>
<field name="module_portal"/>
</group>
<separator string="Others" colspan="4"/>
<field name="module_share"/>
<newline/>
<field name="module_portal"/>
</sheet>
</form>
</field>
</record>
<record id="action_general_configuration" model="ir.actions.act_window">
<field name="name">Configure General Application</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">general.configuration</field>
<field name="view_id" ref="view_general_configuration"/>
<field name="view_type">form</field>
<field name="name">General Settings</field>
<field name="res_model">base.config.settings</field>
<field name="view_mode">form</field>
<field name="target">inline</field>
</record>
<menuitem id="menu_general_configuration" name="General Setting" parent="base.menu_config" sequence="9" action="action_general_configuration"/>
<menuitem id="menu_general_configuration" name="Settings" parent="base.menu_config"
sequence="50" action="action_general_configuration"/>
</data>
</openerp>