Skip to Content
Menu
This question has been flagged
1 Reply
5122 Views

 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,
}




Avatar
Discard
Best Answer

Hi,

The error message says that there is no function named action_email_payslip_send defined the model hr.payslip . Make sure that the function is defined in the correct model.


Thanks

Avatar
Discard
Related Posts Replies Views Activity
2
Jul 24
13934
2
Sep 23
6682
1
Apr 20
8701
1
Apr 20
3599
5
Sep 19
4158