[IMP] base_setup: remove todo 'Default user prefs'
bzr revid: rco@openerp.com-20120419142713-i62wkpfcruqcbf7e
This commit is contained in:
parent
338c582689
commit
049de3aad4
|
@ -18,7 +18,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import pytz
|
||||
|
||||
import simplejson
|
||||
import cgi
|
||||
|
@ -75,61 +74,6 @@ class product_installer(osv.osv_memory):
|
|||
if val.customers == 'import':
|
||||
return {'type': 'ir.actions.act_window'}
|
||||
|
||||
# Define users preferences for new users (ir.values)
|
||||
|
||||
def _lang_get(self, cr, uid, context=None):
|
||||
obj = self.pool.get('res.lang')
|
||||
ids = obj.search(cr, uid, [('translatable','=',True)])
|
||||
res = obj.read(cr, uid, ids, ['code', 'name'], context=context)
|
||||
res = [(r['code'], r['name']) for r in res]
|
||||
return res
|
||||
|
||||
def _tz_get(self,cr,uid, context=None):
|
||||
return [(x, x) for x in pytz.all_timezones]
|
||||
|
||||
class user_preferences_config(osv.osv_memory):
|
||||
_name = 'user.preferences.config'
|
||||
_inherit = 'res.config'
|
||||
_columns = {
|
||||
'context_tz': fields.selection(_tz_get, 'Timezone', size=64,
|
||||
help="Set default for new user's timezone, used to perform timezone conversions "
|
||||
"between the server and the client."),
|
||||
'context_lang': fields.selection(_lang_get, 'Language', required=True,
|
||||
help="Sets default language for the all user interface, when UI "
|
||||
"translations are available. If you want to Add new Language, you can add it from 'Load an Official Translation' wizard from 'Administration' menu."),
|
||||
'view': fields.selection([('simple','Simplified'),
|
||||
('extended','Extended')],
|
||||
'Interface', required=True, help= "If you use OpenERP for the first time we strongly advise you to select the simplified interface, which has less features but is easier. You can always switch later from the user preferences." ),
|
||||
'menu_tips': fields.boolean('Display Tips', help="Check out this box if you want to always display tips on each menu action"),
|
||||
|
||||
}
|
||||
_defaults={
|
||||
'view' : lambda self,cr,uid,*args: self.pool.get('res.users').browse(cr, uid, uid).view or 'simple',
|
||||
'context_lang' : 'en_US',
|
||||
'menu_tips' : True
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(user_preferences_config, self).default_get(cr, uid, fields, context=context)
|
||||
res_default = self.pool.get('ir.values').get(cr, uid, 'default', False, ['res.users'])
|
||||
for id, field, value in res_default:
|
||||
res.update({field: value})
|
||||
return res
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
user_obj = self.pool.get('res.users')
|
||||
user_ids = user_obj.search(cr, uid, [], context=context)
|
||||
for o in self.browse(cr, uid, ids, context=context):
|
||||
user_obj.write(cr , uid, user_ids ,{'context_tz' : o.context_tz, 'context_lang' : o.context_lang, 'view' : o.view, 'menu_tips' : o.menu_tips}, context=context)
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
ir_values_obj.set(cr, uid, 'default', False, 'context_tz', ['res.users'], o.context_tz)
|
||||
ir_values_obj.set(cr, uid, 'default', False, 'context_lang', ['res.users'], o.context_lang)
|
||||
ir_values_obj.set(cr, uid, 'default', False, 'view', ['res.users'], o.view)
|
||||
ir_values_obj.set(cr, uid, 'default', False, 'menu_tips', ['res.users'], o.menu_tips)
|
||||
return {}
|
||||
|
||||
# Specify Your Terminology
|
||||
|
||||
class specify_partner_terminology(osv.osv_memory):
|
||||
|
|
|
@ -1,53 +1,6 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Define default users preferences-->
|
||||
<record id="view_user_preferences_config_form" model="ir.ui.view">
|
||||
<field name="name">Set default users preferences</field>
|
||||
<field name="model">user.preferences.config</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">Define Users's Preferences</attribute>
|
||||
</form>
|
||||
<xpath expr="//separator[@string="title"]" position="attributes">
|
||||
<attribute name="string">Define Users's Preferences</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//label[@string='description']" position="attributes">
|
||||
<attribute name="string">This will set the default preferences for new users and update all existing ones. Afterwards, users are free to change those values on their own user preference form.</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//separator[@string="vsep"]" position="attributes">
|
||||
<attribute name="string"/>
|
||||
<attribute name="rowspan">12</attribute>
|
||||
</xpath>
|
||||
<group string="res_config_contents" position="replace">
|
||||
<group colspan="4">
|
||||
<field colspan="4" name="view"/>
|
||||
<field colspan="4" name="context_lang"/>
|
||||
<field colspan="4" name="context_tz"/>
|
||||
<field colspan="4" name="menu_tips"/>
|
||||
</group>
|
||||
</group>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_user_preferences_config_form" model="ir.actions.act_window">
|
||||
<field name="name">Define default users preferences</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">user.preferences.config</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_user_preferences_config_form"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<record id="config_action_user_preferences_config_form" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_user_preferences_config_form"/>
|
||||
<field name="category_id" ref="base.category_administration_config"/>
|
||||
<field name="type">once</field>
|
||||
</record>
|
||||
|
||||
<!-- Specify Your Terminology Config Wiz-->
|
||||
<record id="base_setup_terminology_form" model="ir.ui.view">
|
||||
<field name="name">Specify Your Terminology</field>
|
||||
|
|
Loading…
Reference in New Issue