[REM] res.config and res.users cleanups.
removed deprecated configuration wizards removed deprecated busniess card report moved change password wizard to res_users.py bzr revid: al@openerp.com-20131006144020-zyp2jz5vy28m9q3f
This commit is contained in:
parent
31a8dc36e5
commit
6488849191
|
@ -79,7 +79,6 @@ The kernel of OpenERP, needed for all installation.
|
|||
'res/res_bank_view.xml',
|
||||
'res/res_country_view.xml',
|
||||
'res/res_currency_view.xml',
|
||||
'res/wizard/change_password_wizard_view.xml',
|
||||
'res/res_users_view.xml',
|
||||
'res/res_partner_data.xml',
|
||||
'res/ir_property_view.xml',
|
||||
|
|
|
@ -31,8 +31,5 @@ import res_request
|
|||
import res_lang
|
||||
import ir_property
|
||||
|
||||
import report
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
|
@ -1,28 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 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 report import report_sxw
|
||||
#report_sxw.report_sxw('report.partner.list', 'res.partner', 'addons/base/res/partner/report/partner_list.rml')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<addresses>
|
||||
<address type="fields" name="id">
|
||||
<name type="field" name="name"/>
|
||||
<role type="field" name="title"/>
|
||||
<phone type="field" name="phone"/>
|
||||
<email type="field" name="email"/>
|
||||
<mobile type="field" name="mobile"/>
|
||||
<company>Tiny sprl</company>
|
||||
<street>Rue du Vieux Chateau, 21</street>
|
||||
<zip>BE-1457</zip>
|
||||
<city>Walhain</city>
|
||||
<website>http://tiny.be</website>
|
||||
</address>
|
||||
</addresses>
|
|
@ -1,80 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
||||
|
||||
<xsl:variable name="initial_bottom_pos">20.5</xsl:variable>
|
||||
<xsl:variable name="initial_left_pos">0.5</xsl:variable>
|
||||
<xsl:variable name="height_increment">5.5</xsl:variable>
|
||||
<xsl:variable name="width_increment">8.5</xsl:variable>
|
||||
<xsl:variable name="frame_height">5.5cm</xsl:variable>
|
||||
<xsl:variable name="frame_width">8.5cm</xsl:variable>
|
||||
<xsl:variable name="number_columns">3</xsl:variable>
|
||||
<xsl:variable name="max_cards">8</xsl:variable>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="addresses"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="addresses">
|
||||
<document>
|
||||
<template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm"
|
||||
bottomMargin="2.0cm" title="Address list" author="Generated by OpenERP, Fabien Pinckaers">
|
||||
<pageTemplate id="all">
|
||||
<pageGraphics/>
|
||||
<xsl:apply-templates select="address" mode="frames"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<paraStyle name="nospace" fontName="Courier" fontSize="12" spaceBefore="0" spaceAfter="0"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<xsl:apply-templates select="address" mode="story"/>
|
||||
</story>
|
||||
</document>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="address" mode="frames">
|
||||
<xsl:if test="position() < $max_frames + 1">
|
||||
<frame>
|
||||
<xsl:attribute name="width">
|
||||
<xsl:value-of select="$frame_width"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="height">
|
||||
<xsl:value-of select="$frame_height"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="x1">
|
||||
<xsl:value-of select="$initial_left_pos + ((position()-1) mod $number_columns) * $width_increment"/>
|
||||
<xsl:text>cm</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="y1">
|
||||
<xsl:value-of select="$initial_bottom_pos - floor((position()-1) div $number_columns) * $height_increment"/>
|
||||
<xsl:text>cm</xsl:text>
|
||||
</xsl:attribute>
|
||||
</frame>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="address" mode="story">
|
||||
|
||||
<drawCentredString x="105mm" y="28cm" t="1">PACKINGLIST</drawCentredString>
|
||||
<image x="5mm" y="5m" file="addons/base/report/logo-tiny.png"/>
|
||||
<blockTable colWidths="3cm,3cm" style="infos">
|
||||
<tr>
|
||||
<td>Logo</td>
|
||||
<td/>
|
||||
</tr><tr>
|
||||
<td><para><xsl:value-of select="client-id"/></para></td>
|
||||
<td><para><xsl:value-of select="shipping-id"/></para></td>
|
||||
<td><para><xsl:value-of select="picking-date"/></para></td>
|
||||
<td><para><xsl:value-of select="expedition-date"/></para></td>
|
||||
<td><para><xsl:value-of select="command-number"/></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
<para style="nospace"><xsl:value-of select="company"/></para>
|
||||
<para style="nospace"><xsl:value-of select="partner_name"/></para>
|
||||
<para style="nospace"><xsl:value-of select="street"/></para>
|
||||
<para style="nospace"><xsl:value-of select="zip"/><xsl:text> </xsl:text><xsl:value-of select="city"/></para>
|
||||
<para style="nospace"><xsl:value-of select="country"/></para>
|
||||
<nextFrame/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
|
@ -131,6 +131,7 @@ class res_config_configurable(osv.osv_memory):
|
|||
"""
|
||||
raise NotImplementedError(
|
||||
'Configuration items need to implement execute')
|
||||
|
||||
def cancel(self, cr, uid, ids, context=None):
|
||||
""" Method called when the user click on the ``Skip`` button.
|
||||
|
||||
|
@ -184,8 +185,6 @@ class res_config_configurable(osv.osv_memory):
|
|||
if next: return next
|
||||
return self.next(cr, uid, ids, context=context)
|
||||
|
||||
res_config_configurable()
|
||||
|
||||
class res_config_installer(osv.osv_memory, res_config_module_installation_mixin):
|
||||
""" New-style configuration base specialized for addons selection
|
||||
and installation.
|
||||
|
@ -314,7 +313,6 @@ class res_config_installer(osv.osv_memory, res_config_module_installation_mixin)
|
|||
context=context),
|
||||
context=context)
|
||||
|
||||
|
||||
def modules_to_install(self, cr, uid, ids, context=None):
|
||||
""" selects all modules to install:
|
||||
|
||||
|
@ -397,45 +395,6 @@ class res_config_installer(osv.osv_memory, res_config_module_installation_mixin)
|
|||
|
||||
return self._install_modules(cr, uid, modules, context=context)
|
||||
|
||||
res_config_installer()
|
||||
|
||||
DEPRECATION_MESSAGE = 'You are using an addon using old-style configuration '\
|
||||
'wizards (ir.actions.configuration.wizard). Old-style configuration '\
|
||||
'wizards have been deprecated.\n'\
|
||||
'The addon should be migrated to res.config objects.'
|
||||
class ir_actions_configuration_wizard(osv.osv_memory):
|
||||
''' Compatibility configuration wizard
|
||||
|
||||
The old configuration wizard has been replaced by res.config, but in order
|
||||
not to break existing but not-yet-migrated addons, the old wizard was
|
||||
reintegrated and gutted.
|
||||
'''
|
||||
_name='ir.actions.configuration.wizard'
|
||||
_inherit = 'res.config'
|
||||
|
||||
def _next_action_note(self, cr, uid, ids, context=None):
|
||||
next = self._next_action(cr, uid)
|
||||
if next:
|
||||
# if the next one is also an old-style extension, you never know...
|
||||
if next.note:
|
||||
return next.note
|
||||
return _("Click 'Continue' to configure the next addon...")
|
||||
return _("Your database is now fully configured.\n\n"\
|
||||
"Click 'Continue' and enjoy your OpenERP experience...")
|
||||
|
||||
_columns = {
|
||||
'note': fields.text('Next Wizard', readonly=True),
|
||||
}
|
||||
_defaults = {
|
||||
'note': _next_action_note,
|
||||
}
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
_logger.warning(DEPRECATION_MESSAGE)
|
||||
|
||||
ir_actions_configuration_wizard()
|
||||
|
||||
|
||||
class res_config_settings(osv.osv_memory, res_config_module_installation_mixin):
|
||||
""" Base configuration wizard for application settings. It provides support for setting
|
||||
default values, assigning groups to employee users, and installing modules.
|
||||
|
@ -694,4 +653,5 @@ class res_config_settings(osv.osv_memory, res_config_module_installation_mixin):
|
|||
if (action_id):
|
||||
return exceptions.RedirectWarning(msg % values, action_id, _('Go to the configuration panel'))
|
||||
return exceptions.Warning(msg % values)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -17,23 +17,6 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_config_wizard_form" model="ir.ui.view">
|
||||
<field name="name">Compabitiliby configuration wizard</field>
|
||||
<field name="model">ir.actions.configuration.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Next Configuration Step" version="7.0">
|
||||
<group>
|
||||
<field name="note"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="action_next" type="object" string="Continue" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="res_config_installer" model="ir.ui.view">
|
||||
<field name="name">Inheritable view for installer objects</field>
|
||||
<field name="model">res.config.installer</field>
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<report id="res_partner_address_report" model="res.partner" name="res.partner" string="Labels" xml="base/res/report/partner_address.xml" xsl="base/res/report/partner_address.xsl" groups="base.group_no_one"/>
|
||||
<!--
|
||||
<report string="Business Cards" model="res.partner" name="res.partner.businesscard" xml="base/res/report/business_card.xml" xsl="base/res/report/business_card.xsl"/>
|
||||
-->
|
||||
<report
|
||||
id="res_partner_address_report"
|
||||
model="res.partner"
|
||||
name="res.partner"
|
||||
string="Labels"
|
||||
xml="base/res/res_partner_report_address.xml"
|
||||
xsl="base/res/res_partner_report_address.xsl"
|
||||
groups="base.group_no_one"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -34,7 +34,11 @@ from openerp.tools.translate import _
|
|||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class groups(osv.osv):
|
||||
#----------------------------------------------------------
|
||||
# Basic res.groups and res.users
|
||||
#----------------------------------------------------------
|
||||
|
||||
class res_groups(osv.osv):
|
||||
_name = "res.groups"
|
||||
_description = "Access Groups"
|
||||
_rec_name = 'full_name'
|
||||
|
@ -102,8 +106,6 @@ class groups(osv.osv):
|
|||
self.pool['ir.model.access'].call_cache_clearing_methods(cr)
|
||||
return res
|
||||
|
||||
groups()
|
||||
|
||||
class res_users(osv.osv):
|
||||
""" User class. A res.users record models an OpenERP user and is different
|
||||
from an employee.
|
||||
|
@ -516,12 +518,13 @@ class res_users(osv.osv):
|
|||
(uid, module, ext_id))
|
||||
return bool(cr.fetchone())
|
||||
|
||||
|
||||
#
|
||||
# Extension of res.groups and res.users with a relation for "implied" or
|
||||
# "inherited" groups. Once a user belongs to a group, it automatically belongs
|
||||
# to the implied groups (transitively).
|
||||
#----------------------------------------------------------
|
||||
# Implied groups
|
||||
#
|
||||
# Extension of res.groups and res.users with a relation for "implied"
|
||||
# or "inherited" groups. Once a user belongs to a group, it
|
||||
# automatically belongs to the implied groups (transitively).
|
||||
#----------------------------------------------------------
|
||||
|
||||
class cset(object):
|
||||
""" A cset (constrained set) is a set of elements that may be constrained to
|
||||
|
@ -551,7 +554,6 @@ def concat(ls):
|
|||
return res
|
||||
|
||||
|
||||
|
||||
class groups_implied(osv.osv):
|
||||
_inherit = 'res.groups'
|
||||
|
||||
|
@ -618,6 +620,8 @@ class users_implied(osv.osv):
|
|||
super(users_implied, self).write(cr, uid, [user.id], vals, context)
|
||||
return res
|
||||
|
||||
#----------------------------------------------------------
|
||||
# Vitrual checkbox and selection for res.user form view
|
||||
#
|
||||
# Extension of res.groups and res.users for the special groups view in the users
|
||||
# form. This extension presents groups with selection and boolean widgets:
|
||||
|
@ -638,6 +642,7 @@ class users_implied(osv.osv):
|
|||
# any of ID1, ..., IDk is in 'groups_id'
|
||||
# - selection field 'sel_groups_ID1_..._IDk' is ID iff
|
||||
# ID is in 'groups_id' and ID is maximal in the set {ID1, ..., IDk}
|
||||
#----------------------------------------------------------
|
||||
|
||||
def name_boolean_group(id): return 'in_group_' + str(id)
|
||||
def name_boolean_groups(ids): return 'in_groups_' + '_'.join(map(str, ids))
|
||||
|
@ -661,7 +666,6 @@ def partition(f, xs):
|
|||
return yes, nos
|
||||
|
||||
|
||||
|
||||
class groups_view(osv.osv):
|
||||
_inherit = 'res.groups'
|
||||
|
||||
|
@ -869,4 +873,67 @@ class users_view(osv.osv):
|
|||
}
|
||||
return res
|
||||
|
||||
#----------------------------------------------------------
|
||||
# change password wizard
|
||||
#----------------------------------------------------------
|
||||
|
||||
class change_password_wizard(osv.TransientModel):
|
||||
"""
|
||||
A wizard to manage the change of users' passwords
|
||||
"""
|
||||
|
||||
_name = "change.password.wizard"
|
||||
_description = "Change Password Wizard"
|
||||
_columns = {
|
||||
'user_ids': fields.one2many('change.password.user', 'wizard_id', string='Users'),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context == None:
|
||||
context = {}
|
||||
user_ids = context.get('active_ids', [])
|
||||
wiz_id = context.get('active_id', None)
|
||||
res = []
|
||||
users = self.pool.get('res.users').browse(cr, uid, user_ids, context=context)
|
||||
for user in users:
|
||||
res.append((0, 0, {
|
||||
'wizard_id': wiz_id,
|
||||
'user_id': user.id,
|
||||
'user_login': user.login,
|
||||
}))
|
||||
return {'user_ids': res}
|
||||
|
||||
|
||||
def change_password_button(self, cr, uid, id, context=None):
|
||||
wizard = self.browse(cr, uid, id, context=context)[0]
|
||||
user_ids = []
|
||||
for user in wizard.user_ids:
|
||||
user_ids.append(user.id)
|
||||
self.pool.get('change.password.user').change_password_button(cr, uid, user_ids, context=context)
|
||||
return {
|
||||
'type': 'ir.actions.act_window_close',
|
||||
}
|
||||
|
||||
class change_password_user(osv.TransientModel):
|
||||
"""
|
||||
A model to configure users in the change password wizard
|
||||
"""
|
||||
|
||||
_name = 'change.password.user'
|
||||
_description = 'Change Password Wizard User'
|
||||
_columns = {
|
||||
'wizard_id': fields.many2one('change.password.wizard', string='Wizard', required=True),
|
||||
'user_id': fields.many2one('res.users', string='User', required=True),
|
||||
'user_login': fields.char('User Login', readonly=True),
|
||||
'new_passwd': fields.char('New Password'),
|
||||
}
|
||||
_defaults = {
|
||||
'new_passwd': '',
|
||||
}
|
||||
|
||||
def change_password_button(self, cr, uid, ids, context=None):
|
||||
for user in self.browse(cr, uid, ids, context=context):
|
||||
self.pool.get('res.users').write(cr, uid, user.user_id.id, {'password': user.new_passwd})
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -277,5 +277,43 @@
|
|||
<field name="act_window_id" ref="action_res_users_my"/>
|
||||
</record>
|
||||
|
||||
<!-- wizard action on res.users -->
|
||||
<act_window id="change_password_wizard_action"
|
||||
name="Change Password"
|
||||
src_model="res.users"
|
||||
res_model="change.password.wizard"
|
||||
view_type="form" view_mode="form"
|
||||
key2="client_action_multi" target="new"
|
||||
groups="base.group_erp_manager"/>
|
||||
|
||||
<!-- wizard view -->
|
||||
<record id="change_password_wizard_view" model="ir.ui.view">
|
||||
<field name="name">Change Password</field>
|
||||
<field name="model">change.password.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Change Password" version="7.0">
|
||||
<field name="user_ids"/>
|
||||
<footer>
|
||||
<button string="Change Password" name="change_password_button" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- wizard user list view -->
|
||||
<record id="change_password_wizard_user_tree_view" model="ir.ui.view">
|
||||
<field name="name">Change Password Users</field>
|
||||
<field name="model">change.password.user</field>
|
||||
<field name="arch" type="xml">
|
||||
<!-- the user list is editable, but one cannot add or delete rows -->
|
||||
<tree string="Users" editable="bottom" create="false" delete="false">
|
||||
<field name="user_login"/>
|
||||
<field name="new_passwd" required="True" password="True"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.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
|
||||
# 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 change_password_wizard
|
|
@ -1,81 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.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
|
||||
# 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 openerp.osv import fields, osv
|
||||
|
||||
class change_password_wizard(osv.TransientModel):
|
||||
"""
|
||||
A wizard to manage the change of users' passwords
|
||||
"""
|
||||
|
||||
_name = "change.password.wizard"
|
||||
_description = "Change Password Wizard"
|
||||
_columns = {
|
||||
'user_ids': fields.one2many('change.password.user', 'wizard_id', string='Users'),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context == None:
|
||||
context = {}
|
||||
user_ids = context.get('active_ids', [])
|
||||
wiz_id = context.get('active_id', None)
|
||||
res = []
|
||||
users = self.pool.get('res.users').browse(cr, uid, user_ids, context=context)
|
||||
for user in users:
|
||||
res.append((0, 0, {
|
||||
'wizard_id': wiz_id,
|
||||
'user_id': user.id,
|
||||
'user_login': user.login,
|
||||
}))
|
||||
return {'user_ids': res}
|
||||
|
||||
|
||||
def change_password_button(self, cr, uid, id, context=None):
|
||||
wizard = self.browse(cr, uid, id, context=context)[0]
|
||||
user_ids = []
|
||||
for user in wizard.user_ids:
|
||||
user_ids.append(user.id)
|
||||
self.pool.get('change.password.user').change_password_button(cr, uid, user_ids, context=context)
|
||||
return {
|
||||
'type': 'ir.actions.act_window_close',
|
||||
}
|
||||
|
||||
class change_password_user(osv.TransientModel):
|
||||
"""
|
||||
A model to configure users in the change password wizard
|
||||
"""
|
||||
|
||||
_name = 'change.password.user'
|
||||
_description = 'Change Password Wizard User'
|
||||
_columns = {
|
||||
'wizard_id': fields.many2one('change.password.wizard', string='Wizard', required=True),
|
||||
'user_id': fields.many2one('res.users', string='User', required=True),
|
||||
'user_login': fields.char('User Login', readonly=True),
|
||||
'new_passwd': fields.char('New Password'),
|
||||
}
|
||||
_defaults = {
|
||||
'new_passwd': '',
|
||||
}
|
||||
|
||||
def change_password_button(self, cr, uid, ids, context=None):
|
||||
for user in self.browse(cr, uid, ids, context=context):
|
||||
self.pool.get('res.users').write(cr, uid, user.user_id.id, {'password': user.new_passwd})
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- wizard action on res.users -->
|
||||
<act_window id="change_password_wizard_action"
|
||||
name="Change Password"
|
||||
src_model="res.users"
|
||||
res_model="change.password.wizard"
|
||||
view_type="form" view_mode="form"
|
||||
key2="client_action_multi" target="new"
|
||||
groups="base.group_erp_manager"/>
|
||||
|
||||
<!-- wizard view -->
|
||||
<record id="change_password_wizard_view" model="ir.ui.view">
|
||||
<field name="name">Change Password</field>
|
||||
<field name="model">change.password.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Change Password" version="7.0">
|
||||
<field name="user_ids"/>
|
||||
<footer>
|
||||
<button string="Change Password" name="change_password_button" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- wizard user list view -->
|
||||
<record id="change_password_wizard_user_tree_view" model="ir.ui.view">
|
||||
<field name="name">Change Password Users</field>
|
||||
<field name="model">change.password.user</field>
|
||||
<field name="arch" type="xml">
|
||||
<!-- the user list is editable, but one cannot add or delete rows -->
|
||||
<tree string="Users" editable="bottom" create="false" delete="false">
|
||||
<field name="user_login"/>
|
||||
<field name="new_passwd" required="True" password="True"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue