I am just a newbie in Odoo. I am creating a custom module for Odoo 11. I want to add a new link as email payslip in hr payroll module . So when admin will navigate to an individual's Payslip, in the action I want to add a new option called email payslip. So when it will be clicked then it will send an email to the employee.
So to achieve this I have made my custom module named as email payslip.
The code is like this
init.py
from . import models
manifest.py
{
'name': 'Email Payslip',
'summary': """This module will send email with payslip""",
'version': '10.0.1.0.0',
'description': """This module will send email with payslip""",
'author': 'Test',
'company': 'test',
'website': 'https://test.com',
'category': 'Tools',
'depends': ['base'],
'license': 'AGPL-3',
'data': [
'views/email_payslip.xml',
],
'demo': [],
'installable': True,
'auto_install': False,
}
Models init.py
from . import email_payslip
Models email_payslip.py
import babel
from datetime import date, datetime, time
from dateutil.relativedelta import relativedelta
from pytz import timezone
from odoo import api, fields, models, tools, _
from odoo.addons import decimal_precision as dp
from odoo.exceptions import UserError, ValidationError
class EmailPayslip(models.Model):
#print 'sdabhd'
_name = 'email.payslip'
name = fields.Char(string="Title", required=True)
description = 'Email Payslip'
EmailPayslip()
Views email_payslip.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<act_window id="email_payslip" src_model="hr.payslip" res_model="hr.payslip.line" name="Email Payslip"/>
</odoo>
The above code shows the email payslip menu in the action but I don't think its right way. Also when I am doing click on the link its showing the employee payslip record.
So can someone help me here? What will be the right approach to achieve this? Any help and suggestions will be really appreciable.
This is what I have got so far.
from Odoo custom module add new action to hr module
No comments:
Post a Comment