diff --git a/automatic_payroll/README.rst b/automatic_payroll/README.rst new file mode 100644 index 000000000..e162f8d8a --- /dev/null +++ b/automatic_payroll/README.rst @@ -0,0 +1,30 @@ +Automatic Payroll +================= +* Generate payslip batches automatically. +* The feature works with the help of scheduler. + +Tech +==== +* [Python] - Models +* [XML] - Odoo views + +Installation +============ +- www.odoo.com/documentation/12.0/setup/install.html +- Install our custom addon + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Developer: Varsha Vivek, odoo@cybrosys.com + +Maintainer +---------- +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. + +Contacts +======== +* Cybrosys Technologies diff --git a/automatic_payroll/__init__.py b/automatic_payroll/__init__.py new file mode 100644 index 000000000..9a7e03ede --- /dev/null +++ b/automatic_payroll/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/automatic_payroll/__manifest__.py b/automatic_payroll/__manifest__.py new file mode 100644 index 000000000..5fc5632b5 --- /dev/null +++ b/automatic_payroll/__manifest__.py @@ -0,0 +1,18 @@ +{ + 'name': 'Automatic Payroll', + 'version': '12.0.1.0.0', + 'category': 'Generic Modules/Human Resources', + 'description': """Generate payslips automatically""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'maintainer': 'Cybrosys Techno Solutions', + 'depends': ['base', 'hr_payroll'], + 'data': ['views/schedule_cron.xml', + 'views/res_config_settings_view.xml'], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/automatic_payroll/doc/RELEASE_NOTES.md b/automatic_payroll/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..434cc4815 --- /dev/null +++ b/automatic_payroll/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 27.06.2019 +#### Version 12.0.1.0.0 +##### ADD +- Initial Commit diff --git a/automatic_payroll/models/__init__.py b/automatic_payroll/models/__init__.py new file mode 100644 index 000000000..e6aceae90 --- /dev/null +++ b/automatic_payroll/models/__init__.py @@ -0,0 +1,2 @@ +from . import auto_generate_payslips +from . import res_config_settings diff --git a/automatic_payroll/models/auto_generate_payslips.py b/automatic_payroll/models/auto_generate_payslips.py new file mode 100644 index 000000000..03356dbb2 --- /dev/null +++ b/automatic_payroll/models/auto_generate_payslips.py @@ -0,0 +1,126 @@ +# -*- coding: utf-8 -*- +from datetime import date, datetime +from dateutil.relativedelta import relativedelta + +from odoo import api, fields, models, _ +from odoo.exceptions import UserError + + +class HrPayslipRunCron(models.Model): + """ + Automate payslip generation + 1.Month First + 2.Specific Date + 3.Month End + """ + _inherit = 'hr.payslip.run' + + @api.onchange('generate_payslip') + def check(self): + """Check the options and call the corresponding methods""" + if self.env['ir.config_parameter'].sudo().get_param('generate_payslip'): + if self.env['ir.config_parameter'].sudo().get_param( + 'option', 'first') == 'first': + self.month_first() + elif self.env['ir.config_parameter'].sudo().get_param( + 'option', 'specific') == 'specific': + self.specific_date() + elif self.env['ir.config_parameter'].sudo().get_param( + 'option', 'end') == 'end': + self.month_end() + else: + raise UserError(_("Enable configuration settings")) + + @api.multi + def month_first(self): + """Method for automate month first option""" + today = fields.Date.today() + day = today.day + if day == 1: + self.generate_payslips() + else: + raise UserError(_("Today is not month first")) + pass + + @api.multi + def month_end(self): + """Method for automate month end option""" + today = fields.Date.today() + day_today = today.day + last_date = today + relativedelta(day=1, months=+1, days=-1) + last_day = last_date.day + if day_today == last_day: + self.generate_payslips() + else: + raise UserError(_("Today is not month end")) + pass + + @api.multi + def specific_date(self): + """Method for automate specific day option""" + val = int(self.env['ir.config_parameter'].sudo().get_param('generate_day')) + today = fields.Date.today() + day = today.day + if day == val: + self.generate_payslips() + else: + raise UserError(_("Can't generate payslips today")) + pass + + @api.multi + def generate_payslips(self): + """Method for generate payslip batches and payslips, + before that you must assign ongoing contracts for employees""" + batch_id = self.create([{ + 'name': 'Payslip Batch For ' + date.today().strftime('%B') + + ' ' + str(date.today().year), + 'date_start': fields.Date.to_string(date.today().replace(day=1)), + 'date_end': fields.Date.to_string( + (datetime.now() + relativedelta(months=+1, day=1, days=-1)).date()) + }]) + + generate_payslip = self.env['hr.payslip.employees'] + contract_ids = self.env['hr.contract'].search([('state', 'in', ['open', 'pending'])]) + lst = [] + employee_ids = [] + for line in contract_ids: + employee_ids.append(line.employee_id) + lst.append({ + 'name': line.employee_id.id, + 'work_phone': line.employee_id.work_phone or None, + 'work_email': line.employee_id.work_email or None, + 'department_id': line.employee_id.department_id or None, + 'job_id': line.employee_id.job_id or None, + 'parent_id': line.employee_id.parent_id or None, + }) + generate_payslip.create([{ + 'employee_ids': lst + }]) + + payslips = self.env['hr.payslip'] + [run_data] = batch_id.read( + ['date_start', 'date_end', 'credit_note']) + from_date = run_data.get('date_start') + to_date = run_data.get('date_end') + if not employee_ids: + raise UserError(_("You must select employee(s) to generate payslip(s).")) + for employee in employee_ids: + slip_data = self.env['hr.payslip'].onchange_employee_id(from_date, to_date, employee.id, + contract_id=False) + res = { + 'employee_id': employee.id, + 'name': slip_data['value'].get('name'), + 'struct_id': slip_data['value'].get('struct_id'), + 'contract_id': slip_data['value'].get('contract_id'), + 'payslip_run_id': batch_id.id, + 'input_line_ids': [(0, 0, x) for x in slip_data['value'].get('input_line_ids')], + 'worked_days_line_ids': [ + (0, 0, x) for x in slip_data['value'].get('worked_days_line_ids')], + 'date_from': from_date, + 'date_to': to_date, + 'credit_note': run_data.get('credit_note'), + 'company_id': employee.company_id.id, + } + payslips += self.env['hr.payslip'].create(res) + payslips.compute_sheet() + return {'type': 'ir.actions.act_window_close'} diff --git a/automatic_payroll/models/res_config_settings.py b/automatic_payroll/models/res_config_settings.py new file mode 100644 index 000000000..1995c714b --- /dev/null +++ b/automatic_payroll/models/res_config_settings.py @@ -0,0 +1,36 @@ +from odoo import api, fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + generate_payslip = fields.Boolean(help="Automatic generation of payslip batches" + " and payslips using cron job (Monthly)") + + option = fields.Selection([ + ('first', 'Month First'), + ('specific', 'Specific date'), + ('end', 'Month End'), + ], string='Option', default='first', help='Option to select the date to generate payslips') + + generate_day = fields.Integer(string="Day", default=1, + help="payslip generated day in a month") + + @api.model + def get_values(self): + """get values from the fields""" + res = super(ResConfigSettings, self).get_values() + res.update( + generate_payslip=self.env['ir.config_parameter'].sudo().get_param('generate_payslip'), + generate_day=int(self.env['ir.config_parameter'].sudo().get_param('generate_day') or 1), + option=self.env['ir.config_parameter'].sudo().get_param('option') or 'first' + ) + return res + + @api.multi + def set_values(self): + """Set values in the fields""" + super(ResConfigSettings, self).set_values() + self.env['ir.config_parameter'].sudo().set_param('generate_payslip', self.generate_payslip) + self.env['ir.config_parameter'].sudo().set_param('generate_day', int(self.generate_day)) + self.env['ir.config_parameter'].sudo().set_param("option", self.option) diff --git a/automatic_payroll/static/description/automatic-payroll.gif b/automatic_payroll/static/description/automatic-payroll.gif new file mode 100644 index 000000000..8f986f6aa Binary files /dev/null and b/automatic_payroll/static/description/automatic-payroll.gif differ diff --git a/automatic_payroll/static/description/automatic_payroll-1.png b/automatic_payroll/static/description/automatic_payroll-1.png new file mode 100644 index 000000000..a02fa17fb Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-1.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-2.png b/automatic_payroll/static/description/automatic_payroll-2.png new file mode 100644 index 000000000..900af4fb3 Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-2.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-3.png b/automatic_payroll/static/description/automatic_payroll-3.png new file mode 100644 index 000000000..47aa273a4 Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-3.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-4.png b/automatic_payroll/static/description/automatic_payroll-4.png new file mode 100644 index 000000000..ff676a3ce Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-4.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-5.png b/automatic_payroll/static/description/automatic_payroll-5.png new file mode 100644 index 000000000..2243fcb66 Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-5.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-6.png b/automatic_payroll/static/description/automatic_payroll-6.png new file mode 100644 index 000000000..62f19de98 Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-6.png differ diff --git a/automatic_payroll/static/description/banner.png b/automatic_payroll/static/description/banner.png new file mode 100644 index 000000000..af3b6d97e Binary files /dev/null and b/automatic_payroll/static/description/banner.png differ diff --git a/automatic_payroll/static/description/checked.png b/automatic_payroll/static/description/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/automatic_payroll/static/description/checked.png differ diff --git a/automatic_payroll/static/description/employee_orientation.jpeg b/automatic_payroll/static/description/employee_orientation.jpeg new file mode 100644 index 000000000..067ede9fb Binary files /dev/null and b/automatic_payroll/static/description/employee_orientation.jpeg differ diff --git a/automatic_payroll/static/description/hr_employee_transfer.jpeg b/automatic_payroll/static/description/hr_employee_transfer.jpeg new file mode 100644 index 000000000..1859d8b14 Binary files /dev/null and b/automatic_payroll/static/description/hr_employee_transfer.jpeg differ diff --git a/automatic_payroll/static/description/hr_payslip_monthly_report.jpeg b/automatic_payroll/static/description/hr_payslip_monthly_report.jpeg new file mode 100644 index 000000000..aa8ba62e1 Binary files /dev/null and b/automatic_payroll/static/description/hr_payslip_monthly_report.jpeg differ diff --git a/automatic_payroll/static/description/icon.png b/automatic_payroll/static/description/icon.png new file mode 100644 index 000000000..7595d92e3 Binary files /dev/null and b/automatic_payroll/static/description/icon.png differ diff --git a/automatic_payroll/static/description/index.html b/automatic_payroll/static/description/index.html new file mode 100644 index 000000000..185e07241 --- /dev/null +++ b/automatic_payroll/static/description/index.html @@ -0,0 +1,452 @@ + + + + + + + Bootstrap 101 Template + + + + + + +
+
+
+

Automatic Payroll

+

Generate payslip batches automatically.

+
+

Key Highlights

+
    +
  • check Automatic payroll generation for Odoo12 community edition.
  • +
  • check Generate payslip batches via adding all active employees.
  • + +
  • check The feature works with the help of scheduler.
  • + +
  • check Schedule the activity for month first,month end or specific day.
  • + + +
+
+ +
+
+
+
+

Overview

+
+

+ The module brings you an automatic payroll generation function further improvising the standard Odoo HR Payroll application. The module provisions to generate payslip batches automatically once in a month. +

The feature works with the help of scheduler.

+
+

+
+ +
+
+ +
+
+
+
+

Automatic Payroll

+
    +
  • + Available in Odoo 12.0 community edition. +
  • +
  • + The feature works with the help of scheduler. +
  • +
  • + Scheduler would check the options in the configuration settings and automatically generate payslip batches via adding all active employees possessing active contracts. +
  • +
  • + The module helps to generate payslips for month first,month end or specific day in a month. +
  • +
  • + The end user can confirm the generated payslip batch as well as the payslips in draft state. +
  • +
+
+
+
+
+

+ To enable/disable Automatic payroll, go to Payroll > Configuration > Settings > Enable/Disable Automatic Payroll. +

+
+ +
+
+
+

+ Three options are available. +

+
+ +
+
+
+

+ Upon selecting the second option (Specific date), there appears a field to enter specific date of the month. Based on date the scheduler shall generate payslip batches for the month. +

+
+ +
+
+
+

+ The feature works with the help of scheduler. +

+
+ +
+
+
+

+ During execution of scheduler, it would check contract table for active contracts and later create a new payslip batch via adding all active employees. +

+
+ +
+
+ +
+
+
Default 3
+ +
+
+
+ +
+
+
+

Video Demo

+
+

Odoo12 Automatic Payroll Demo

+ + +
+
+
+ +

Suggested Products

+
+ + +
+ + +
+

Our Service

+
+ +
+
+
+

Our Industries

+
+ +
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+ +
+ +
+ + + + + + + diff --git a/automatic_payroll/static/description/oh_appraisal.jpeg b/automatic_payroll/static/description/oh_appraisal.jpeg new file mode 100644 index 000000000..0823d44d3 Binary files /dev/null and b/automatic_payroll/static/description/oh_appraisal.jpeg differ diff --git a/automatic_payroll/static/description/send_email_payslip.jpeg b/automatic_payroll/static/description/send_email_payslip.jpeg new file mode 100644 index 000000000..f585caa20 Binary files /dev/null and b/automatic_payroll/static/description/send_email_payslip.jpeg differ diff --git a/automatic_payroll/static/description/timesheet_payroll.jpeg b/automatic_payroll/static/description/timesheet_payroll.jpeg new file mode 100644 index 000000000..54dadb311 Binary files /dev/null and b/automatic_payroll/static/description/timesheet_payroll.jpeg differ diff --git a/automatic_payroll/views/res_config_settings_view.xml b/automatic_payroll/views/res_config_settings_view.xml new file mode 100644 index 000000000..f64847f54 --- /dev/null +++ b/automatic_payroll/views/res_config_settings_view.xml @@ -0,0 +1,39 @@ + + + + res_config_settings_view + res.config.settings + + + +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/automatic_payroll/views/schedule_cron.xml b/automatic_payroll/views/schedule_cron.xml new file mode 100644 index 000000000..42232137c --- /dev/null +++ b/automatic_payroll/views/schedule_cron.xml @@ -0,0 +1,13 @@ + + + + Generate payslip batches and payslips + + code + model.check() + 1 + days + -1 + + + \ No newline at end of file