[FIX] Removed password from sent email. Fixed naming in order to pass runbot's test.

bzr revid: vta@openerp.com-20121120073948-1ojettqx7mjb1k75
This commit is contained in:
vta vta@openerp.com 2012-11-20 08:39:48 +01:00
parent 20a50a1866
commit 73750e33b9
4 changed files with 12 additions and 18 deletions

View File

@ -39,7 +39,6 @@ You have been given access to %(portal)s.
Your login account data is: Your login account data is:
Database: %(db)s Database: %(db)s
Username: %(login)s Username: %(login)s
Password: %(password)s
In order to complete the signin process, click on the following url: In order to complete the signin process, click on the following url:
%(url)s %(url)s
@ -51,10 +50,6 @@ OpenERP - Open Source Business Applications
http://www.openerp.com http://www.openerp.com
""") """)
def random_password():
# temporary random stuff; user password is reset by signup process
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
return ''.join(random.choice(chars) for i in xrange(12))
def extract_email(email): def extract_email(email):
""" extract the email address from a user-friendly email address """ """ extract the email address from a user-friendly email address """
@ -181,7 +176,6 @@ class wizard_user(osv.osv_memory):
create_context = dict(context or {}, noshortcut=True) # to prevent shortcut creation create_context = dict(context or {}, noshortcut=True) # to prevent shortcut creation
values = { values = {
'login': extract_email(wizard_user.email), 'login': extract_email(wizard_user.email),
'password': random_password(),
'partner_id': wizard_user.partner_id.id, 'partner_id': wizard_user.partner_id.id,
'groups_id': [(6, 0, [])], 'groups_id': [(6, 0, [])],
'share': True, 'share': True,

View File

@ -22,9 +22,9 @@
from openerp.osv import osv, fields from openerp.osv import osv, fields
from openerp import SUPERUSER_ID from openerp import SUPERUSER_ID
class contact(osv.TransientModel): class crm_contact_us(osv.TransientModel):
""" Create new leads through the "contact us" form """ """ Create new leads through the "contact us" form """
_name = 'contact' _name = 'portal_crm.crm_contact_us'
_description = 'Contact form for the portal' _description = 'Contact form for the portal'
_inherit = 'crm.lead' _inherit = 'crm.lead'
_columns = { _columns = {
@ -104,7 +104,7 @@ class contact(osv.TransientModel):
Since the 'name' field is mandatory, give an empty string to avoid an integrity error. Since the 'name' field is mandatory, give an empty string to avoid an integrity error.
""" """
empty_values = dict((k, False) if k != 'name' else (k, '') for k, v in values.iteritems()) empty_values = dict((k, False) if k != 'name' else (k, '') for k, v in values.iteritems())
return super(contact, self).create(cr, uid, empty_values) return super(crm_contact_us, self).create(cr, uid, empty_values)
def submit(self, cr, uid, ids, context=None): def submit(self, cr, uid, ids, context=None):
""" When the form is submitted, redirect the user to a "Thanks" message """ """ When the form is submitted, redirect the user to a "Thanks" message """

View File

@ -4,7 +4,7 @@
<record id="contact_form_view" model="ir.ui.view"> <record id="contact_form_view" model="ir.ui.view">
<field name="name">Contact form</field> <field name="name">Contact form</field>
<field name="model">contact</field> <field name="model">portal_crm.crm_contact_us</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Contact form" version="7.0"> <form string="Contact form" version="7.0">
<sheet> <sheet>
@ -12,12 +12,11 @@
<group class="oe_portal_crm_contact"> <group class="oe_portal_crm_contact">
<group col="6"> <group col="6">
<group class="oe_portal_crm_contact_form" colspan="4"> <group class="oe_portal_crm_contact_form" colspan="4">
<field name="partner_name" invisible="1"/> <field name="partner_name"/>
<field name="email_from" invisible="1"/> <field name="email_from" placeholder="Your email..."/>
<field name="phone" nolabel="1" placeholder="Your phone number..."/> <field name="phone" placeholder="Your phone number..."/>
<field name="name" nolabel="1" placeholder="Subject..." colspan="6"/> <field name="name" nolabel="1" placeholder="Subject..." colspan="6"/>
<field name="description" nolabel="1" placeholder="Content..." colspan="6"/> <field name="description" nolabel="1" placeholder="Content..." colspan="6"/>
<!-- <field name="description" nolabel="1" placeholder="Content..." colspan="6" attrs="{'required': [(context.get('user_id'), 'in', 'portal.group_portal.users')]}"/> -->
<button string="Submit" name="submit" type="object"/> <button string="Submit" name="submit" type="object"/>
</group> </group>
<group class="oe_portal_crm_office"> <group class="oe_portal_crm_office">
@ -65,7 +64,7 @@
<!-- wizard thanks message (shows after submitting the form) --> <!-- wizard thanks message (shows after submitting the form) -->
<record id="wizard_contact_form_view_thanks" model="ir.ui.view"> <record id="wizard_contact_form_view_thanks" model="ir.ui.view">
<field name="name">Wizard thanks message</field> <field name="name">Wizard thanks message</field>
<field name="model">contact</field> <field name="model">portal_crm.crm_contact_us</field>
<!-- give it a low priority to ensure this won't be the default view --> <!-- give it a low priority to ensure this won't be the default view -->
<field name="priority">99</field> <field name="priority">99</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -83,8 +82,9 @@
<record id="action_contact_us" model="ir.actions.act_window"> <record id="action_contact_us" model="ir.actions.act_window">
<field name="name">Contact Us</field> <field name="name">Contact Us</field>
<field name="res_model">contact</field> <field name="res_model">portal_crm.crm_contact_us</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="view_id" ref="contact_form_view"/>
<field name="target">inline</field> <field name="target">inline</field>
</record> </record>

View File

@ -6,7 +6,7 @@
- -
As a portal user, I fill in the contact form and submit it. As a portal user, I fill in the contact form and submit it.
- -
!record {model: contact, id: contact_us_01}: !record {model: portal_crm.crm_contact_us, id: contact_us_01}:
name: 'Need information about your contact form module' name: 'Need information about your contact form module'
partner_name: 'Mr. John Doe' partner_name: 'Mr. John Doe'
email_from: 'mister@john.doe' email_from: 'mister@john.doe'
@ -15,7 +15,7 @@
- -
For security reasons, the wizard values is empty. For security reasons, the wizard values is empty.
- -
!python {model: contact}: | !python {model: portal_crm.crm_contact_us}: |
obj = self.browse(cr, uid, ref("contact_us_01")) obj = self.browse(cr, uid, ref("contact_us_01"))
assert not(obj.name or obj.partner_name or obj.email_from or obj.phone or obj.description), 'All the wizard\'s values are not empty' assert not(obj.name or obj.partner_name or obj.email_from or obj.phone or obj.description), 'All the wizard\'s values are not empty'
- -