Hi Jonathan,

You shoud be able to do this by overriding the create function of the
voucher model.

And adding the call to the send_mail function something like the following
:

def notification(self, cr, uid, ids, vals, context= None):
        name = MAIL_NOTIFICATION[vals['state']]
        if(name):
            mail_template =
self.pool.get('email.template').search(cr,uid,[('name','=',name)])
            if(mail_template):

self.pool.get('email.template').send_mail(cr,uid,mail_template[0],ids[0],False,context)
            else:
                logger.error("Email Template not found : ")
        else:
            logger.error("No Email Template found for that state: ")
        return True

Where MAIL_NOTIFICATION is a dic that make match the states with the mail
templates

this is a notification function that you can right and call from the
overrrided create function. Don't fortget to call the parent create
function from the overrided one.

Hope this help you.

Kind regards,
Houssine


2012/12/7 Jonathan Vargas <[email protected]>

> Hi,
>
> Currently I enabled & configured sending notifications emails to our
> clients when new invoices are generated.
>
> Now I would like to send email notifications of voucher lines (payments),
> but I am unable to find out how to do it.
>
> I tried to replicate an Email template like the one for Invoices, and I
> did, but the question is:
>
> How do I tell OpenERP to send that email notification when a new voucher
> line is created automatically? Like it does with invoices.
>
> I am using OpenERP 6.1.
>
> Thanks.
>
> --
> *Jonathan Vargas Rodríguez*
> Technical Sales Engineer
> Alkaid · Open Source Business Software
> Office: 2553 5467, Mobile: 8568 3307
> Web: alkaid.cr | E-mail: [email protected]
>
> *Your business needs + Our technical skills = Benefits.
> That's my job. Don't be afraid to contact me*  :-)
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-expert-accounting
> Post to     : [email protected]
> Unsubscribe : https://launchpad.net/~openerp-expert-accounting
> More help   : https://help.launchpad.net/ListHelp
>
>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-expert-accounting
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-expert-accounting
More help   : https://help.launchpad.net/ListHelp

Reply via email to