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
    • 643
    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 test.py file in your module and pass this file in the __init__.py file.
    Using this code show in below

    class emailll_systems(osv.osv):    
        _name = emailll.systems
        _columns = {
                    'cust_profile' : fields.many2one('customer.profile','Customer Profile'),  
                    's
    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 users.name=='Account Manager':
                    for user in users.users:
                        mail_mail = self.pool.get('mail.mail')
                        this_context = context
                        body = '''
                                Dear ''' " %s," % (data.partner_id.name) + '''
                                <p></p>
                                <p> A Account Type ''' "%s" % data.partner_id.name + '''  for customer ''' "%s" % data.partner_id.name +''' require for verification.</p> 
                                <p></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",user.id 
                        mail_values = {
                            'email_from':res_obj.email,
                            'email_to': user.email,
                            '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 __openerp__.py. This file follows the workflow as par your requirement.

    Using this code given belowto

    <openerp>
        <data>
    <!--       workflow -->
            <record id="wkf_emailll.systems" model="workflow">
                <field name="name">emailll.systems.wkf</field>
                <field name="osv">emailll.systems</field>
                <field name="on_create">True</field>
            </record>        
    <!--         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>        
            <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>       
            <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>
            </record>
    <!--         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>        
            <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>      
            <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>
            </record>
        </data>
    </openerp>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
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: