I am getting this error
ValueError: <class 'AttributeError'>: "'hr.payslip' object has no attribute 'action_email_payslip_send'" while evaluating 'action = records.action_email_payslip_send()'
model(emailpayslip.py):
from odoo import fields, models, api, _from odoo.exceptions import Warningclass Emailpayslip(models.Model): _name = 'email.payslip' _inherit = 'hr.payslip' @api.multi def action_email_payslip_send(self): template = self.env.ref( 'nettantra_odoo_email_payslip.email_template_payslip', False, ) compose_form = self.env.ref( 'mail.email_compose_message_wizard_form', False, ) ctx = dict( default_model='hr.payslip', default_use_template=bool(template), default_template_id=template and template.id or False, ) if len(self) == 1: ctx.update({ 'default_composition_mode': 'comment', 'default_res_id': self.ensure_one().id, }) return { 'name': _('Compose Email'), 'type': 'ir.actions.act_window', 'view_type': 'form', 'view_mode': 'form', 'res_model': 'mail.compose.message', 'views': [(compose_form.id, 'form')], 'view_id': compose_form.id, 'target': 'new', 'context': ctx, } else : printf('Hello Here')
__manifest__.py
{
'name': 'Emailpayslip',
'summary': """This module will send the payslip to the employee as pdf document""",
'version': '10.0.1.0.0',
'description': """This module will send the payslip to the employee as pdf document""",
'author': 'Pramod Kumar',
'company': 'abcd',
'website': 'http://www.abcd.com',
'category': 'Human Resource',
'depends': ['hr','base','hr_payroll','mail'],
'license': 'AGPL-3',
'data': [
'views/emailpayslip.xml',
'data/email_template_data.xml'
],
'demo': [],
'installable': True,
'auto_install': False,
}