← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-server/ysa-server-framework into lp:openobject-server

 

Ysa(Open ERP) has proposed merging lp:~openerp-dev/openobject-server/ysa-server-framework into lp:openobject-server.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  #632927 User password should not be displayed/sent
  https://bugs.launchpad.net/bugs/632927
  #672886 crash system report in testing and reports
  https://bugs.launchpad.net/bugs/672886
  #686561 Demo and Admin users share the same address by default, preventing different emails to be set
  https://bugs.launchpad.net/bugs/686561

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/ysa-server-framework/+merge/44782

Solved the following bugs and commit in this branch.

https://bugs.launchpad.net/openobject-server/+bug/632927
https://bugs.launchpad.net/openobject-server/+bug/686561
https://bugs.launchpad.net/openobject-server/+bug/672886

-- 
https://code.launchpad.net/~openerp-dev/openobject-server/ysa-server-framework/+merge/44782
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-server/ysa-server-framework.
=== modified file 'bin/addons/base/base_demo.xml'
--- bin/addons/base/base_demo.xml	2010-10-01 16:37:17 +0000
+++ bin/addons/base/base_demo.xml	2010-12-28 11:14:52 +0000
@@ -1,14 +1,27 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
     <data noupdate="1">
+
+        <record id="demo_address" model="res.partner.address">
+            <field name="name">Fabien Dupont</field>
+            <field name="street">Chaussee de Namur</field>
+            <field name="zip">1367</field>
+            <field name="city">Gerompont</field>
+            <field name="phone">(+32).81.81.37.00</field>
+            <field name="type">default</field>
+            <field model="res.country" name="country_id" ref="be"/>
+            <!-- Company ID will be set later -->
+            <field name="company_id" eval="None"/>
+        </record>
+
         <record id="user_demo" model="res.users">
             <field name="login">demo</field>
             <field name="password">demo</field>
             <field name="name">Demo User</field>
             <field name="signature">Mr Demo</field>
-            <field name="address_id" ref="main_address"/>
+            <field name="address_id" ref="demo_address"/>
             <field name="company_id" ref="main_company"/>
-            <field name="groups_id" eval="[(6,0,[ref('base.group_user')])]"/> 
+            <field name="groups_id" eval="[(6,0,[ref('base.group_user')])]"/>
         </record>
     </data>
 </openerp>

=== modified file 'bin/addons/base/base_update.xml'
--- bin/addons/base/base_update.xml	2010-10-28 16:28:52 +0000
+++ bin/addons/base/base_update.xml	2010-12-28 11:14:52 +0000
@@ -69,6 +69,33 @@
     Users
     ======================
     -->
+
+        <record id="view_change_user_password_form" model="ir.ui.view">
+            <field name="name">change.user.password</field>
+            <field name="model">change.user.password</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Change Password">
+	                <field name="current_password" password="True" readonly="0" colspan="4"/>
+	                <field name="new_password" password="True" readonly="0" colspan="4"/>
+	                <field name="confirm_password" password="True" readonly="0" colspan="4"/>
+                    <separator colspan="4" />
+                    <label align="0.0" colspan="2" string=""/>
+                    <button colspan="1" icon="gtk-cancel" special="cancel" string="Cancel"/>
+                    <button colspan="1" icon="gtk-execute" name="change_password" string="Change" type="object"/>
+                </form>
+            </field>
+        </record>
+
+        <record id="action_view_change_password_form" model="ir.actions.act_window">
+            <field name="name">Change Password</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">change.user.password</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="target">new</field>
+        </record>
+
         <record id="view_users_form_simple_modif" model="ir.ui.view">
             <field name="name">res.users.form.modif</field>
             <field name="model">res.users</field>
@@ -87,12 +114,13 @@
                             <newline/>
                         </page>
                          <page string="Preferences">
-                            <field name="password" password="True" readonly="0" />
                             <field name="context_lang" completion="1" readonly="0"/>
+                            <field name="context_tz" completion="1" readonly="0"/>
                             <label string="" colspan="1"/>
                             <label colspan="3" string="You must logout and login again after changing your password."/>
-                            <field name="context_tz" completion="1" readonly="0"/>
                             <field name="menu_tips" colspan="2" readonly="0"/>
+                            <label string="" colspan="1"/>
+                            <button name="%(action_view_change_password_form)d" string="Change Password" type="action" icon="gtk-execute"/>
                             <separator string="Email &amp; Signature" colspan="4"/>
                             <group colspan="4"><field name="user_email" widget="email" readonly="0"/></group>
                             <field colspan="4" name="signature" readonly="0" nolabel="1"/>

=== modified file 'bin/addons/base/res/res_user.py'
--- bin/addons/base/res/res_user.py	2010-12-14 16:29:19 +0000
+++ bin/addons/base/res/res_user.py	2010-12-28 11:14:52 +0000
@@ -448,7 +448,7 @@
             return True
         cr = pooler.get_db(db).cursor()
         try:
-            cr.execute('SELECT COUNT(1) FROM res_users WHERE id=%s AND password=%s AND active=%s', 
+            cr.execute('SELECT COUNT(1) FROM res_users WHERE id=%s AND password=%s AND active=%s',
                         (int(uid), passwd, True))
             res = cr.fetchone()[0]
             if not bool(res):
@@ -547,7 +547,7 @@
             if len(user_names) >= 5:
                 user_names = user_names[:5]
                 user_names += '...'
-            raise osv.except_osv(_('Warning !'), 
+            raise osv.except_osv(_('Warning !'),
                         _('Group(s) cannot be deleted, because some user(s) still belong to them: %s !') % \
                             ', '.join(user_names))
         return super(groups2, self).unlink(cr, uid, ids, context=context)
@@ -574,5 +574,33 @@
 
 res_config_view()
 
+class change_user_password(osv.osv_memory):
+    _name = 'change.user.password'
+    _columns = {
+        'current_password':fields.char('Current Password', size=64, required=True, help="Enter your current password."),
+        'new_password': fields.char('New Password', size=64, required=True, help="Enter new password."),
+        'confirm_password': fields.char('Confirm Password', size=64, required=True, help="Enter new password again for confirmation."),
+    }
+    _defaults={
+        'current_password' : '',
+        'new_password' : '',
+        'confirm_password' : '',
+    }
+
+    def change_password(self, cr, uid, ids, context=None):
+        user_obj = self.pool.get('res.users')
+        if ids:
+            current_password = user_obj.browse(cr, uid, uid, context).password
+            password_rec = self.browse(cr, uid, ids[0], context)
+            if password_rec.new_password != password_rec.confirm_password:
+                raise osv.except_osv(_('Warning !'), _('New password and confirm password does not match !'))
+            elif current_password != password_rec.current_password:
+                raise osv.except_osv(_('Warning !'), _('Current password does not match !'))
+            else:
+                user_obj.write(cr, uid, [uid], {'password': password_rec.new_password}, context)
+        return {}
+
+change_user_password()
+
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 

=== modified file 'bin/report/render/rml2pdf/utils.py'
--- bin/report/render/rml2pdf/utils.py	2010-11-23 15:19:30 +0000
+++ bin/report/render/rml2pdf/utils.py	2010-12-28 11:14:52 +0000
@@ -131,7 +131,7 @@
                     pass
                 if isinstance(txt, basestring):
                     result += str2xml(txt)
-                elif (txt is not None) and (txt is not False):
+                elif txt and (txt is not None) and (txt is not False):
                     result += ustr(txt)
         return result