[MERGE]: Merge with lp:~openerp-dev/openobject-addons/trunk-rework-addons-23-march-aag

bzr revid: rpa@tinyerp.com-20110413133441-ece8itsj3jofpxup
This commit is contained in:
Rucha (Open ERP) 2011-04-13 19:04:41 +05:30
commit 765cc4eb79
10 changed files with 262 additions and 5 deletions

View File

@ -37,6 +37,7 @@ It also helps to easily configure your company.
'depends': ['base'],
'init_xml': ['base_setup_data.xml'],
'update_xml': ['security/ir.model.access.csv',
'wizard/res_company_logo_view.xml',
'base_setup_installer.xml',
'base_setup_todo.xml',
],

View File

@ -111,7 +111,7 @@
<record id="migrade_application_installer_modules_todo" model="ir.actions.todo">
<field name="action_id" ref="action_migrade_application_installer_modules"/>
<field name="type">normal_recurring</field>
<field name="type">normal</field>
</record>
<!-- Import or create customers configartion view -->
@ -160,9 +160,109 @@
<!-- register configuration wizard -->
<record id="config_wizard_res_product_installer" model="ir.actions.todo">
<field name="action_id" ref="action_import_create_installer"/>
<field name="type">normal</field>
<field name="type">normal_recurring</field>
<field name="state">skip</field>
</record>
<!-- Define default users preferences-->
<record id="view_user_preferences_config_form" model="ir.ui.view">
<field name="name">Define 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 default users preferences</attribute>
</form>
<xpath expr='//separator[@string="title"]' position='attributes'>
<attribute name='string'>Define default users preferences</attribute>
</xpath>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">Specify default values. These data are just default values, each user is free to change his own preferences.</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>
<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>
<!-- Register configuration wizard -->
<record id="config_action_user_preferences_config_form" model="ir.actions.todo">
<field name="action_id" ref="action_user_preferences_config_form"/>
<field name="type">normal</field>
</record>
<!-- Config Wiz Give access to others users -->
<record id="action_config_access_other_user" model="ir.actions.act_window">
<field name="name">Give access to others users</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.users</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="base.view_users_form"/>
</record>
<!-- register configuration wizard -->
<record id="config_wizard_action_config_user_form" model="ir.actions.todo">
<field name="action_id" ref="action_config_access_other_user"/>
<field name="type">normal</field>
<field name="target">current</field>
<field name="sequence">1000</field>
<field name="state">cancel</field>
</record>
<!-- Inherit company Form -->
<record id="view_inherit_res_company_logo" model="ir.ui.view">
<field name="name">Upload Logo11</field>
<field name="model">res.company</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//page[@string='General Information']" position="replace">
<page string="General Information">
<group colspan="4">
<field name="rml_header1" colspan="4"/>
<field name="rml_footer1" colspan="4"/>
<field name="rml_footer2" colspan="4"/>
<field name="currency_id" colspan="2"/>
</group>
<separator string="" colspan="4"/>
<button name="createReport" string="Preview Reports" type="object" icon="gtk-print"/>
<button name="%(action_res_company_logo)d"
string="Upload/Change Logo" type="action" icon="gtk-open"/>
</page>
</xpath>
</data>
</field>
</record>
</data>
</openerp>

View File

@ -20,6 +20,7 @@
##############################################################################
from osv import fields, osv
import pooler
import pytz
class base_setup_installer(osv.osv_memory):
_name = 'base.setup.installer'
@ -203,4 +204,50 @@ class product_installer(osv.osv_memory):
product_installer()
# Define default users preferences config wiz
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 new user's user interface, when UI "
"translations are available"),
'view': fields.selection([('simple','Simplified'),
('extended','Extended')],
'Interface', required=True ),
'menu_tips': fields.boolean('Menu 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 execute(self, cr, uid, ids, context=None):
for o in self.browse(cr, uid, ids, 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 {}
user_preferences_config()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,25 @@
# -*- 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/>.
#
##############################################################################
import res_company_logo
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,49 @@
# -*- 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 osv import fields, osv
import os
import tools
from tools.translate import _
class res_company_logo(osv.osv_memory):
_name = 'res.company.logo'
_columns = {
'logo' : fields.binary('Logo'),
}
_defaults={
'logo':lambda self,cr,uid,c: self.pool.get('res.company').browse(cr, uid, uid,c).logo,
}
def execute(self, cr, uid, ids, context=None):
if context is None:
context = {}
record_id = context.get('active_id', False) or False
comp_obj = self.pool.get("res.company")
get_val = self.browse(cr, uid, ids)[0]
comp_obj.write(cr, uid, record_id, {'logo': get_val.logo}, context=context)
return {'type': 'ir.actions.act_window_close'}
res_company_logo()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_res_company_logo" model="ir.ui.view">
<field name="name">res.company.logo.form</field>
<field name="model">res.company.logo</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Upload Logo">
<separator string="Upload your company logo in JPG or PNG with a format similar to 450*150 pixels" colspan="4"/>
<field colspan="4" height="150" name="logo" widget="image" nolabel="1"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<label string="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Upload" name="execute" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_res_company_logo" model="ir.actions.act_window">
<field name="name">Set Logo</field>
<field name="res_model">res.company.logo</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_res_company_logo"/>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -60,6 +60,7 @@
<record id="outlook_installer_todo" model="ir.actions.todo">
<field name="action_id" ref="action_outlook_installer"/>
<field name="type">normal</field>
<field name="sequence">4</field>
</record>

View File

@ -15,7 +15,8 @@
<record id="config_wizard_res_product_installer" model="ir.actions.todo">
<field name="action_id" ref="product_form_config_action"/>
<field name="target">current</field>
<field name="type">normal</field>
<field name="type">normal_recurring</field>
<field name="sequence">20</field>
<field name="state">skip</field>
</record>

View File

@ -574,7 +574,7 @@
<!-- register configuration wizard -->
<record id="config_wizard_step_sale_picking_policy" model="ir.actions.todo">
<field name="action_id" ref="action_config_picking_policy"/>
<field name="type">normal_recurring</field>
<field name="type">normal</field>
<field name="groups_id" eval="[(6,0,[ref('base.group_extended')])]"/>
</record>

View File

@ -61,7 +61,7 @@
<record id="thunderbird_installer_todo" model="ir.actions.todo">
<field name="action_id" ref="action_thunderbird_installer"/>
<field name="type">normal_recurring</field>
<field name="type">normal</field>
<field name="sequence">3</field>
</record>