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>
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();
});