diff --git a/automatic_payroll/README.rst b/automatic_payroll/README.rst new file mode 100644 index 000000000..c0b694184 --- /dev/null +++ b/automatic_payroll/README.rst @@ -0,0 +1,35 @@ +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/14.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 + +Credits +======= +Varsha Vivek v14 @ cybrosys, Contact: odoo@cybrosys.com +Mohammed Musthafa v15 @ cybrosys, Contact: odoo@cybrosys.com 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..d4131bd70 --- /dev/null +++ b/automatic_payroll/__manifest__.py @@ -0,0 +1,18 @@ +{ + 'name': 'Automatic Payroll', + 'version': '15.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_community'], + '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..be2b8f821 --- /dev/null +++ b/automatic_payroll/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 02.12.2021 +#### Version 15.0.1.0.0 +##### ADD +- Initial Commit \ No newline at end of file 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..235e1ecc6 --- /dev/null +++ b/automatic_payroll/models/auto_generate_payslips.py @@ -0,0 +1,123 @@ +# -*- 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")) + + 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 + + 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 + + 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 + + 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'] + # print(generate_payslip) + contract_ids = self.env['hr.contract'].search([('state', '=', 'open')]) + employee_ids = [] + for line in contract_ids: + print(line.employee_id.name) + employee_ids.append(line.employee_id) + generate_payslip.create({ + 'employee_ids': [(4, line.employee_id.id)] + }) + # generate_payslip.create([{ + # 'name': line.employee_id.name, + # '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.name or None, + # }]) + print(generate_payslip) + 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..67f202e57 --- /dev/null +++ b/automatic_payroll/models/res_config_settings.py @@ -0,0 +1,35 @@ +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 + + 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/assets/icons/check.png b/automatic_payroll/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/check.png differ diff --git a/automatic_payroll/static/description/assets/icons/chevron.png b/automatic_payroll/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/chevron.png differ diff --git a/automatic_payroll/static/description/assets/icons/cogs.png b/automatic_payroll/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/cogs.png differ diff --git a/automatic_payroll/static/description/assets/icons/consultation.png b/automatic_payroll/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/consultation.png differ diff --git a/automatic_payroll/static/description/assets/icons/ecom-black.png b/automatic_payroll/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/ecom-black.png differ diff --git a/automatic_payroll/static/description/assets/icons/education-black.png b/automatic_payroll/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/education-black.png differ diff --git a/automatic_payroll/static/description/assets/icons/hotel-black.png b/automatic_payroll/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/hotel-black.png differ diff --git a/automatic_payroll/static/description/assets/icons/license.png b/automatic_payroll/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/license.png differ diff --git a/automatic_payroll/static/description/assets/icons/lifebuoy.png b/automatic_payroll/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/lifebuoy.png differ diff --git a/automatic_payroll/static/description/assets/icons/logo.png b/automatic_payroll/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/logo.png differ diff --git a/automatic_payroll/static/description/assets/icons/manufacturing-black.png b/automatic_payroll/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/manufacturing-black.png differ diff --git a/automatic_payroll/static/description/assets/icons/pos-black.png b/automatic_payroll/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/pos-black.png differ diff --git a/automatic_payroll/static/description/assets/icons/puzzle.png b/automatic_payroll/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/puzzle.png differ diff --git a/automatic_payroll/static/description/assets/icons/restaurant-black.png b/automatic_payroll/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/restaurant-black.png differ diff --git a/automatic_payroll/static/description/assets/icons/service-black.png b/automatic_payroll/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/service-black.png differ diff --git a/automatic_payroll/static/description/assets/icons/trading-black.png b/automatic_payroll/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/trading-black.png differ diff --git a/automatic_payroll/static/description/assets/icons/training.png b/automatic_payroll/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/training.png differ diff --git a/automatic_payroll/static/description/assets/icons/update.png b/automatic_payroll/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/update.png differ diff --git a/automatic_payroll/static/description/assets/icons/user.png b/automatic_payroll/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/user.png differ diff --git a/automatic_payroll/static/description/assets/icons/wrench.png b/automatic_payroll/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/automatic_payroll/static/description/assets/icons/wrench.png differ diff --git a/automatic_payroll/static/description/assets/modules/approval_image.png b/automatic_payroll/static/description/assets/modules/approval_image.png new file mode 100644 index 000000000..84fe94e80 Binary files /dev/null and b/automatic_payroll/static/description/assets/modules/approval_image.png differ diff --git a/automatic_payroll/static/description/assets/modules/budget_image.png b/automatic_payroll/static/description/assets/modules/budget_image.png new file mode 100644 index 000000000..fe6aa6fe4 Binary files /dev/null and b/automatic_payroll/static/description/assets/modules/budget_image.png differ diff --git a/automatic_payroll/static/description/assets/modules/export_image.png b/automatic_payroll/static/description/assets/modules/export_image.png new file mode 100644 index 000000000..4e4ea0e51 Binary files /dev/null and b/automatic_payroll/static/description/assets/modules/export_image.png differ diff --git a/automatic_payroll/static/description/assets/modules/magento_image.png b/automatic_payroll/static/description/assets/modules/magento_image.png new file mode 100644 index 000000000..39de0820f Binary files /dev/null and b/automatic_payroll/static/description/assets/modules/magento_image.png differ diff --git a/automatic_payroll/static/description/assets/modules/pos_image.png b/automatic_payroll/static/description/assets/modules/pos_image.png new file mode 100644 index 000000000..c5932894b Binary files /dev/null and b/automatic_payroll/static/description/assets/modules/pos_image.png differ diff --git a/automatic_payroll/static/description/assets/modules/shopify_image.png b/automatic_payroll/static/description/assets/modules/shopify_image.png new file mode 100644 index 000000000..c6d92c16d Binary files /dev/null and b/automatic_payroll/static/description/assets/modules/shopify_image.png differ diff --git a/automatic_payroll/static/description/assets/screenshots/automatic-payroll.gif b/automatic_payroll/static/description/assets/screenshots/automatic-payroll.gif new file mode 100644 index 000000000..8f986f6aa Binary files /dev/null and b/automatic_payroll/static/description/assets/screenshots/automatic-payroll.gif differ diff --git a/automatic_payroll/static/description/assets/screenshots/automatic_payroll-1.png b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-1.png new file mode 100644 index 000000000..a02fa17fb Binary files /dev/null and b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-1.png differ diff --git a/automatic_payroll/static/description/assets/screenshots/automatic_payroll-2.png b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-2.png new file mode 100644 index 000000000..900af4fb3 Binary files /dev/null and b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-2.png differ diff --git a/automatic_payroll/static/description/assets/screenshots/automatic_payroll-3.png b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-3.png new file mode 100644 index 000000000..47aa273a4 Binary files /dev/null and b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-3.png differ diff --git a/automatic_payroll/static/description/assets/screenshots/automatic_payroll-4.png b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-4.png new file mode 100644 index 000000000..ff676a3ce Binary files /dev/null and b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-4.png differ diff --git a/automatic_payroll/static/description/assets/screenshots/automatic_payroll-5.png b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-5.png new file mode 100644 index 000000000..2243fcb66 Binary files /dev/null and b/automatic_payroll/static/description/assets/screenshots/automatic_payroll-5.png differ diff --git a/automatic_payroll/static/description/banner.png b/automatic_payroll/static/description/banner.png new file mode 100644 index 000000000..a49c2a820 Binary files /dev/null and b/automatic_payroll/static/description/banner.png differ diff --git a/automatic_payroll/static/description/icon.png b/automatic_payroll/static/description/icon.png new file mode 100644 index 000000000..c5666f4be 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..1f7a072b6 --- /dev/null +++ b/automatic_payroll/static/description/index.html @@ -0,0 +1,605 @@ + +
+
+
+
+ +
+
+
+ Community +
+
+
+
+
+ +
+
+
+

+ Automatic Payroll

+

+ Generate payslip batches automatically. +

+ +
+
+ +
+
+

+ Explore this module +

+
+ + + + + +
+
+

+ 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. +

+ +
+
+ + +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Community Support

+

+ Available in Odoo 15.0 Community.

+
+
+ +
+
+ +
+
+

+ 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.

+
+
+ +
+
+ +
+
+

+ Create payslip by month start, end or a specific date.

+

+ 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.

+
+
+ +
+ +
+
+

+ Screenshots +

+
+
+

+ 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.

+ +
+ +
+ + +
+
+

Suggested Products

+
+ + +
+
+ + + +
+
+
+

Our Services

+
+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+ +
+
+ + + + + +
+
+
+

Need Help?

+
+
+
+ + +
+ +
+ +
+ +
+ WhatsApp +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file 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..583a7a2d0 --- /dev/null +++ b/automatic_payroll/views/res_config_settings_view.xml @@ -0,0 +1,35 @@ + + + + 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..a82d9c039 --- /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