Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to send mail in next level in workflow in OpenERP(Odoo-8)?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.15k
    Comment on it

    In OpenERP, first, create custom module and then configure your incoming and outgoing mail in your server an then relate it to the function.

    Follow these step given below:

    Step1- First, create module like as a test module and then create file file in your module and pass this file in the file.
    Using this code show in below

    class emailll_systems(osv.osv):    
        _name =
        _columns = {
                    'cust_profile' : fields.many2one('customer.profile','Customer Profile'),  
    def male_send_doc_verification(self,cr,uid,ids,data,partner,subject,url,user,context=None):
            res_obj = self.pool.get('res.users').browse(cr, uid, uid)
            group = self.pool.get('res.groups').search(cr,uid,[('name', '=', 'Account Manager')])
            users = self.pool.get('res.groups').browse(cr,uid,group)
            if users:
                if'Account Manager':
                    for user in users.users:
                        mail_mail = self.pool.get('mail.mail')
                        this_context = context
                        body = '''
                                Dear ''' " %s," % ( + '''
                                <p> A Account Type ''' "%s" % + '''  for customer ''' "%s" % +''' require for verification.</p> 
                                <p>Please action it accordingly</p> 
                                <p> </p>
                                <p>You can access account details from  below url </p>
                                <p>''' "%s" % url +''' </p>                             
                                <p>Regards, </p> 
                        print "Email to", 
                        mail_values = {
                            'subject': subject,
                            'body_html': body,
                            'state': 'outgoing',
                            'type': 'email',
                        mail_id = mail_mail.create(cr, uid, mail_values, context=this_context)
                        mail_mail.send(cr, uid, [mail_id],  auto_commit=True, context=this_context)   
            return True    


    Step2- After the above step, create another file like as test_workflow.xml file in your own module and pass this file in your This file follows the workflow as par your requirement.

    Using this code given belowto

    <!--       workflow -->
            <record id="" model="workflow">
                <field name="name"></field>
                <field name="osv"></field>
                <field name="on_create">True</field>
    <!--         Activity -->
            <record id="act_draft" model="workflow.activity">
                <field name="wkf_id" ref="wkf_loan_application"/>
                <field name="name">draft</field>
                <field name="flow_start">True</field>
            <record id="act_approval_a" model="workflow.activity">
                <field name="wkf_id" ref="wkf_loan_application"/>
                <field name="name">approval_a</field>
                <field name="kind">function</field>
                <field name="action">action_approval_a()</field>
            <record id="act_approval_b" model="workflow.activity">
                <field name="wkf_id" ref="wkf_loan_application"/>
                <field name="name">approval_b</field>
                <field name="kind">function</field>
                <field name="action">action_approval_b()</field>
    <!--         Trainsition -->        
            <record id="trans_draft_approval_a" model="workflow.transition">
                <field name="act_from" ref="act_draft"/>
                <field name="act_to" ref="act_approval_a"/>
                <field name="signal">approval_a</field>
            <record id="trans_appr_a_revisn" model="workflow.transition">
                <field name="act_from" ref="act_approval_a"/>
                <field name="act_to" ref="act_revision"/>
                <field name="signal">revision</field>
            <record id="trans_revisn_appr_a" model="workflow.transition">
                <field name="act_from" ref="act_revision"/>
                <field name="act_to" ref="act_approval_a"/>
                <field name="signal">approval_a</field>

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: