I am creating my first module in Odoo. The Odoo version is 11.00. So basically what I want is add a new option in Payslip Action called as email Salary Slip. So when clicking on that it will automatically send an email to the employee email.
So for that I have made my module folder structure like this
email_payslip [main folder]
- __init__.py
- __manifest__.py
|
| - __init__.py
- Models - |
| - email_payslip.py
|
|
- Views - email-payslip.xml
So for __init__.py
the code is like this
from . import models
For __manifest__.py
code is like this
{
'name': 'Email Payslip',
'summary': """This module will send email""",
'version': '10.0.1.0.0',
'description': """This module will send email""",
'author': 'Demo',
'company': 'Demo',
'website': 'https://github.com',
'category': 'Tools',
'depends': ['base'],
'license': 'AGPL-3',
'data': [
'views/email_payslip.xml',
],
'demo': [],
'installable': True,
'auto_install': False,
}
in Models __init__.py
the code is like this
from . import email_payslip
In email_payslip.py
the code is
from odoo import fields, models, tools, api
In the views folder email_payslip.xml
the code is this
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="from_view_form" model="ir.ui.view">
<field name="name">form.view.form</field>
<field name="model">my.form</field>
<field name="arch" type="xml">
<form string="Form">
<button name="send_email" string="Send Email"
type="object" class="oe_highlight" />
</form>
</field>
</record>
</data>
</odoo>