[MERGE] forward port of fixes made in v7 addons branch up to revision 8872
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 18 Mar 2013 12:27:17 +0000 (13:27 +0100)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 18 Mar 2013 12:27:17 +0000 (13:27 +0100)
bzr revid: qdp-launchpad@openerp.com-20130318122717-qptmntn26bx4wn8r

1  2 
addons/account_analytic_analysis/account_analytic_analysis_view.xml
addons/auth_signup/res_users.py
addons/auth_signup/res_users_view.xml
addons/crm/crm_lead_view.xml
addons/hr_timesheet_sheet/hr_timesheet_sheet.py
addons/sale/sale.py
addons/web_linkedin/static/src/js/linkedin.js

@@@ -266,20 -263,10 +264,11 @@@ class res_users(osv.Model)
                  raise osv.except_osv(_("Cannot send email: user has no email address."), user.name)
              mail_id = self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, True, context=context)
              mail_state = mail_obj.read(cr, uid, mail_id, ['state'], context=context)
 +
              if mail_state and mail_state['state'] == 'exception':
 -                raise osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name)
 +                raise self.pool.get('res.config.settings').get_config_warning(cr, _("Cannot send email: no outgoing email server configured.\nYou can configure it under %(menu:base_setup.menu_general_configuration)s."), context)
              else:
-                 return {
-                     'type': 'ir.actions.client',
-                     'name': '_(Server Notification)',
-                     'tag': 'action_notify',
-                     'params': {
-                         'title': 'Mail Sent to: %s' % user.name,
-                         'text': 'You can reset the password by yourself using this <a href=%s>link</a>' % user.partner_id.signup_url,
-                         'sticky': True,
-                     }
-                 }
+                 return True
  
      def create(self, cr, uid, values, context=None):
          # overridden to automatically invite user to sign up
                      <header>
                          <field name="state" widget="statusbar"/>
                      </header>
+                     <div class="oe_form_box_info oe_text_center" attrs="{'invisible': [('signup_valid', '!=', True)]}">
+                         <p attrs="{'invisible': [('state', '!=', 'active')]}">
+                             <b>A password reset has been requested for this user. An email containing the following link has been sent:</b>
+                         </p>
+                         <p attrs="{'invisible': [('state', '!=', 'new')]}">
+                             <b>An invitation email containing the following subscription link has been sent:</b>
+                         </p>
+                         <p><field class="oe_inline" name="signup_url" widget="url"/></p>
+                         <field name="signup_valid" invisible="1"/>
+                     </div>
                  </xpath>
                  <!-- add Reset Password button -->
 -                <xpath expr="//div[@class='oe_right oe_button_box']" position="replace">
 -                    <div class="oe_right oe_button_box">
 -                        <button string="Send reset password link by email"
 +                <xpath expr="//div[@class='oe_right oe_button_box']//button" position="replace">
 +                        <button string="Send Reset Password Instructions"
-                                 type="object" name="action_reset_password" />
+                                 type="object" name="action_reset_password"
+                                 attrs="{'invisible': [('state', '!=', 'active')]}"/>
 -                        <button string="Send an invitation email"
++                        <button string="Send an Invitation Email"
+                                 type="object" name="action_reset_password" context="{'create_user': 1}"
+                                 attrs="{'invisible': [('state', '!=', 'new')]}"/>
+                     </div>
                  </xpath>
              </field>
          </record>
Simple merge
Simple merge
@@@ -66,43 -15,15 +66,43 @@@ openerp.web_linkedin = function(instanc
          test_linkedin: function() {
              var self = this;
              return this.test_api_key().then(function() {
 -                if (self.linkedin_added)
 -                    return self.linkedin_def.promise();
 +                if (self.linkedin_added) {
 +                    return self.linkedin_def;
 +                }
 +                self.$linkedin = $('<div class="oe_linkedin_login_hidden" style="display:none;"><script type="in/Login"></script></div>');
 +
 +                self.error_catcher(function (error) {
 +                    if (!!error.caller.match(/API Key is invalid/)) {
 +                        self.linkedin_disabled(error);
 +                        self.$linkedin.remove();
 +                        console.debug("LinkedIn JavaScript removed.");
 +                        self.linkedin_added = false;
 +                        self.error_catcher(false);
 +                        return true;
 +                    } else {
 +                        return false;
 +                    }
 +                });
 +                window.setTimeout(function () {self.error_catcher(false);}, 5000);
 +
 +                $("body").append(self.$linkedin);
                  var tag = document.createElement('script');
                  tag.type = 'text/javascript';
-                 tag.src = "http://platform.linkedin.com/in.js";
+                 tag.src = "https://platform.linkedin.com/in.js";
 -                tag.innerHTML = 'api_key : ' + self.api_key + '\nauthorize : true\nscope: r_network r_contactinfo';
 +                tag.innerHTML = 'api_key : ' + self.api_key + '\nauthorize : true\nscope: r_network r_basicprofile'; // r_contactinfo r_fullprofile r_emailaddress';
 +                
                  document.getElementsByTagName('head')[0].appendChild(tag);
                  self.linkedin_added = true;
 -                $(tag).load(function() {
 +                $(tag).load(function(event) {
 +                    console.debug("LinkedIn JavaScript inserted.");
 +                    IN.Event.on(IN, "frameworkLoaded", function() {
 +                        self.error_catcher(false);
 +                        console.debug("LinkedIn DOM node inserted and frameworkLoaded.");
 +                    });
 +                    IN.Event.on(IN, "systemReady", function() {
 +                        self.linkedin_def.resolve();
 +                        console.debug("LinkedIn systemReady.");
 +                    });
                      IN.Event.on(IN, "auth", function() {
                          self.auth_def.resolve();
                      });