I'm working on an odoo
project and I need to send emails automatically every day at 10 am. I have created the scheduled action but I've got a problem. This is the method I use to perform sending action
@api.model
def send_mails(self):
domain = [['name', 'like', 'Production Report']]
template = self.env['email.template'].search(domain)[0]
template.send_mail(self.id, True)
After the execution of the method it gives this traceback
2016-11-03 17:35:15,158 4912 ERROR sintramdb openerp.addons.base.ir.ir_cron: Call of self.pool.get('production.ouvrages').send_mails(cr, uid, *()) failed in Job 9 Traceback (most recent call last): File "C:\Program Files (x86)\Odoo 8.0-20160929\server\openerp\addons\base\ir\ir_cron.py", line 138, in _callback File "C:\Program Files (x86)\Odoo 8.0-20160929\server\.\openerp\api.py", line 268, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160929\server\.\openerp\api.py", line 372, in old_api File "C:\Users\3D SKILLS\AppData\Local\OpenERP S.A.\Odoo\addons\8.0\production\models.py", line 347, in send_mails File "C:\Program Files (x86)\Odoo 8.0-20160929\server\.\openerp\api.py", line 266, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160929\server\.\openerp\api.py", line 549, in new_api File "C:\Program Files (x86)\Odoo 8.0-20160929\server\openerp\addons\email_template\email_template.py", line 558, in send_mail File "C:\Program Files (x86)\Odoo 8.0-20160929\server\.\openerp\api.py", line 268, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160929\server\openerp\addons\email_template\email_template.py", line 595, in generate_email File "C:\Program Files (x86)\Odoo 8.0-20160929\server\.\openerp\api.py", line 268, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160929\server\openerp\addons\email_template\email_template.py", line 484, in generate_email_batch AttributeError: 'bool' object has no attribute 'lang'
If i replace the @api.model by @api.one or @api.multi i get the following error
TypeError: old_api() takes at least 4 arguments (3 given)
Note: With @api.one or @api.multi annotation it wokrs perfectly if i use a button click to call the method.