hi,
i am using odoo v9 in ubuntu 12.04,i created one custom module and from controller i write code for form submission after submit form i want to send mail to res.partner from odoo
my controller.py is
from openerp import http
from openerp.http import Controller, route, request
from openerp.addons.website.models.website import slug
from werkzeug.utils import redirect
from wtforms import Form, StringField, TextAreaField, validators, SelectField, DateField
class CreateMarraige(http.Controller):
@http.route('/marraige/new/', website=True)
def new(self, cr, uid, ids, context=None, **form_data):
form = MarraigeForm(request.httprequest.form)
if request.httprequest.method == 'POST' and form.validate():
marraige = http.request.env['consulate.marraige']
customer = http.request.env['res.partner']
cust = customer.create({
'name' : form_data.get('nm_of_husband', ''),
'birthdate': form_data.get('birth_dt_hus', ''),
})
marraige.create({
'father_nm_of_husband': form_data.get('father_nm_of_husband', ''),
'mother_nm_of_husband': form_data.get('mother_nm_of_husband', ''),
'occupation_of_hus': form_data.get('occupation_of_hus', ''),
'age_of_hus': form_data.get('age_of_hus', ''),
'birth_place_hus': form_data.get('birth_place_hus', ''),
'nm_of_wife': form_data.get('nm_of_wife', ''),
'father_nm_of_wife': form_data.get('father_nm_of_wife', ''),
'mother_nm_of_wife': form_data.get('mother_nm_of_wife', ''),
'occupation_of_wife': form_data.get('occupation_of_wife', ''),
'age_of_wife': form_data.get('age_of_wife', ''),
'birth_dt_wife': form_data.get('birth_dt_wife', ''),
'birth_place_wife': form_data.get('birth_place_wife', ''),
'rep_of_husband': form_data.get('rep_of_husband', ''),
'rep_of_wife': form_data.get('rep_of_wife', ''),
'witness_of_hus': form_data.get('witness_of_hus', ''),
'witness_of_wife': form_data.get('witness_of_wife', ''),
'registrar': form_data.get('registrar', ''),
'cert_issued_by': form_data.get('cert_issued_by', ''),
'partner_id': cust.id,
})
message = ("Hello %s \n Below Prurchase Order is Delay Today: \n Supplier Name : %s \n Purchase Order Refereance : %s \n Order Date : %s \n Delivery Date : %s \n Product Names : %s \n\n")
vals = {'state': 'outgoing',
'subject': 'CVs',
'body_html': '<pre>%s</pre>' % message,
'email_to': rec.job_id.partner_id.email,
'email_from': 'vrstest123@gmail.com',
}
email_ids.append(self.pool.get('mail.mail').create(cr, uid, vals, context=context))
if email_ids:
self.pool.get('mail.mail').send(cr, uid, email_ids, context=context)
return redirect("/marraige_success/")
return request.render('marraige_certificate.marraige_create', {'form': form})
after submit form it return error like
"
'CreateMarraige' object has no attribute 'pool'
"
please help how can i solve this error and send mail from controller