[IMP] improved code to handle error when user email address is not given
bzr revid: tpa@tinyerp.com-20140402092549-vrvchbmlpkaq4p80
This commit is contained in:
parent
350d7b07f3
commit
46b164ea2e
|
@ -611,6 +611,7 @@ class website_forum(http.Controller):
|
|||
request.registry['res.partner'].write( cr, uid, [user.partner_id.id], {
|
||||
'name': post.get('name'),
|
||||
'website': post.get('website'),
|
||||
'email': post.get('email'),
|
||||
'city': post.get('city'),
|
||||
'country_id': post.get('country'),
|
||||
'website_description': post.get('description'),
|
||||
|
|
|
@ -21,3 +21,4 @@
|
|||
|
||||
import gamification
|
||||
import forum
|
||||
import ir_http
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import traceback
|
||||
import werkzeug
|
||||
import openerp
|
||||
from openerp.http import request
|
||||
from openerp.osv import orm
|
||||
|
||||
class ir_http(orm.AbstractModel):
|
||||
_inherit = 'ir.http'
|
||||
|
||||
def _handle_exception(self, exception=None, code=500):
|
||||
#At this time it gives error when user's email address is not configured instead of raise exception so redirect user to update profile.
|
||||
#when website will handle exception then remove this code.
|
||||
if exception and exception[1] and exception[1] == "Unable to send email, please configure the sender's email address or alias.":
|
||||
forum = request.httprequest.path.strip('/forum').split('/')
|
||||
return werkzeug.utils.redirect("/forum/%s/edit/profile/%s" % (forum[0],request.uid))
|
||||
return super(ir_http, self)._handle_exception(exception)
|
|
@ -657,12 +657,16 @@
|
|||
<input name="user_id" t-att-value="user.id" type="hidden"/>
|
||||
<label class="col-md-2 control-label mb16" for="user.name">Real name</label>
|
||||
<div class="col-md-7 mb16">
|
||||
<input type="text" class="col-md-7 mb16 form-control" name="name" required="True" t-attf-value="#{user.name or ''}"/>
|
||||
<input type="text" class="col-md-7 mb16 form-control" name="name" required="True" t-attf-value="#{user.name}"/>
|
||||
</div>
|
||||
<label class="col-md-2 control-label mb16" for="user.partner_id.website">Website</label>
|
||||
<div class="col-md-7 mb16">
|
||||
<input type="text" class="form-control" name="website" t-attf-value="#{user.partner_id.website or ''}"/>
|
||||
</div>
|
||||
<label class="col-md-4 control-label mb16" for="user.partner_id.email">Email</label>
|
||||
<div class="col-md-7 mb16">
|
||||
<input type="text" class="form-control" name="email" required="True" t-attf-value="#{user.partner_id.email}"/>
|
||||
</div>
|
||||
<label class="col-md-4 control-label mb16" for="user.partner_id.city">City</label>
|
||||
<div class="col-md-7 mb16">
|
||||
<input type="text" class="form-control" name="city" t-attf-value="#{user.partner_id.city or ''}"/>
|
||||
|
|
Loading…
Reference in New Issue