From 8a029bed93da0000a3f85c41067737d5a73e26b2 Mon Sep 17 00:00:00 2001 From: Mayank Patel Date: Wed, 11 Sep 2024 05:47:31 +0000 Subject: [PATCH] [REM] hr_payroll_gamification: available in professional H14528 --- hr_payroll_gamification/__init__.py | 1 - hr_payroll_gamification/__manifest__.py | 20 ----- hr_payroll_gamification/data/payroll_data.xml | 10 --- hr_payroll_gamification/data/payroll_demo.xml | 20 ----- hr_payroll_gamification/models/__init__.py | 2 - .../models/gamification.py | 12 --- hr_payroll_gamification/models/payroll.py | 55 ------------ hr_payroll_gamification/tests/__init__.py | 1 - .../tests/test_payroll_badge.py | 86 ------------------- .../views/gamification_views.xml | 19 ---- 10 files changed, 226 deletions(-) delete mode 100644 hr_payroll_gamification/__init__.py delete mode 100755 hr_payroll_gamification/__manifest__.py delete mode 100644 hr_payroll_gamification/data/payroll_data.xml delete mode 100644 hr_payroll_gamification/data/payroll_demo.xml delete mode 100644 hr_payroll_gamification/models/__init__.py delete mode 100644 hr_payroll_gamification/models/gamification.py delete mode 100644 hr_payroll_gamification/models/payroll.py delete mode 100755 hr_payroll_gamification/tests/__init__.py delete mode 100644 hr_payroll_gamification/tests/test_payroll_badge.py delete mode 100644 hr_payroll_gamification/views/gamification_views.xml diff --git a/hr_payroll_gamification/__init__.py b/hr_payroll_gamification/__init__.py deleted file mode 100644 index 0650744f..00000000 --- a/hr_payroll_gamification/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import models diff --git a/hr_payroll_gamification/__manifest__.py b/hr_payroll_gamification/__manifest__.py deleted file mode 100755 index 4de55d3d..00000000 --- a/hr_payroll_gamification/__manifest__.py +++ /dev/null @@ -1,20 +0,0 @@ -{ - 'name': 'Payroll Gamification', - 'description': 'Payroll Gamification', - 'version': '15.0.1.0.0', - 'website': 'https://hibou.io/', - 'author': 'Hibou Corp. ', - 'license': 'AGPL-3', - 'category': 'Human Resources', - 'data': [ - 'data/payroll_data.xml', - 'views/gamification_views.xml', - ], - 'demo': [ - 'data/payroll_demo.xml', - ], - 'depends': [ - 'hr_gamification', - 'hr_payroll_hibou', - ], -} diff --git a/hr_payroll_gamification/data/payroll_data.xml b/hr_payroll_gamification/data/payroll_data.xml deleted file mode 100644 index f4ac1ed8..00000000 --- a/hr_payroll_gamification/data/payroll_data.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - Badges - BADGES - - - \ No newline at end of file diff --git a/hr_payroll_gamification/data/payroll_demo.xml b/hr_payroll_gamification/data/payroll_demo.xml deleted file mode 100644 index b79992de..00000000 --- a/hr_payroll_gamification/data/payroll_demo.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - python - -result = inputs.BADGES.amount > 0.0 if inputs.BADGES else False - - code - -result = inputs.BADGES.amount if inputs.BADGES else 0 - - BADGES - - Badges - - - - - diff --git a/hr_payroll_gamification/models/__init__.py b/hr_payroll_gamification/models/__init__.py deleted file mode 100644 index 4ce66a41..00000000 --- a/hr_payroll_gamification/models/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from . import gamification -from . import payroll diff --git a/hr_payroll_gamification/models/gamification.py b/hr_payroll_gamification/models/gamification.py deleted file mode 100644 index ac1538b7..00000000 --- a/hr_payroll_gamification/models/gamification.py +++ /dev/null @@ -1,12 +0,0 @@ -from odoo import api, fields, models - - -class GamificationBadge(models.Model): - _inherit = 'gamification.badge' - - payroll_type = fields.Selection([ - ('', 'None'), - ('fixed', 'Fixed'), - ('period', 'Granted in Pay Period'), - ], string='Payroll Type') - payroll_amount = fields.Float(string='Payroll Amount', digits=(10, 4)) diff --git a/hr_payroll_gamification/models/payroll.py b/hr_payroll_gamification/models/payroll.py deleted file mode 100644 index eee89a13..00000000 --- a/hr_payroll_gamification/models/payroll.py +++ /dev/null @@ -1,55 +0,0 @@ -from odoo import api, Command, fields, models - - -class Payslip(models.Model): - _inherit = 'hr.payslip' - - @api.model_create_multi - def create(self, vals_list): - payslips = super().create(vals_list) - draft_slips = payslips.filtered(lambda p: p.employee_id and p.state == 'draft') - if not draft_slips: - return payslips - - draft_slips._update_badges() - return payslips - - def write(self, vals): - res = super().write(vals) - if 'date_to' in vals or 'date_from' in vals: - self._update_badges() - return res - - def _update_badges(self): - badge_type = self.env.ref('hr_payroll_gamification.badge_other_input', raise_if_not_found=False) - if not badge_type: - return - for payslip in self: - amount = payslip._get_input_badge_amount() - line = payslip.input_line_ids.filtered(lambda l: l.input_type_id == badge_type) - command = [] - if line and not amount: - command.append((2, line.id, False)) - elif line and amount: - command.append((1, line.id, { - 'amount': amount, - })) - elif amount: - command.append((0, 0, { - 'name': badge_type.name, - 'amount': amount, - 'input_type_id': badge_type.id, - })) - if command: - payslip.update({'input_line_ids': command}) - - def _get_input_badge_amount(self): - amount = 0.0 - for bu in self.employee_id.badge_ids.filtered(lambda bu: bu.badge_id.payroll_type == 'fixed'): - amount += bu.badge_id.payroll_amount - for bu in self.employee_id.badge_ids.filtered(lambda bu: ( - bu.badge_id.payroll_type == 'period' - and self.date_from <= bu.create_date.date() <= self.date_to - )): - amount += bu.badge_id.payroll_amount - return amount diff --git a/hr_payroll_gamification/tests/__init__.py b/hr_payroll_gamification/tests/__init__.py deleted file mode 100755 index ce4bbfce..00000000 --- a/hr_payroll_gamification/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import test_payroll_badge diff --git a/hr_payroll_gamification/tests/test_payroll_badge.py b/hr_payroll_gamification/tests/test_payroll_badge.py deleted file mode 100644 index c2a1dd6e..00000000 --- a/hr_payroll_gamification/tests/test_payroll_badge.py +++ /dev/null @@ -1,86 +0,0 @@ -from odoo.addons.hr_payroll_hibou.tests import common -from odoo import fields -from datetime import date - - -class TestPayslip(common.TestPayslip): - - def setUp(self): - super(TestPayslip, self).setUp() - self.wage = 2000.00 - self.structure = self.env.ref('hr_payroll.structure_002') - self.structure_type = self.structure.type_id - self.structure_type.wage_type = 'monthly' - self.employee = self._createEmployee() - self.employee.user_id = self.env.user - self.contract = self._createContract(self.employee, wage=self.wage) - - def test_badge_amounts(self): - badge = self.env['gamification.badge'].create({ - 'name': 'test', - }) - badge.payroll_amount = 5.0 - - def test_badge_payroll(self): - additional_wage = 5.0 - additional_wage_period = 15.0 - payslip = self._createPayslip(self.employee, - '2018-01-01', - '2018-01-31', - ) - payslip.compute_sheet() - cats = self._getCategories(payslip) - self.assertEqual(cats['BASIC'], self.wage) - - badge = self.env['gamification.badge'].create({ - 'name': 'test', - 'payroll_type': 'fixed', - 'payroll_amount': additional_wage, - }) - - badge_user = self.env['gamification.badge.user'].create({ - 'badge_id': badge.id, - 'employee_id': self.employee.id, - 'user_id': self.env.user.id, - }) - - badge_period = self.env['gamification.badge'].create({ - 'name': 'test period', - 'payroll_type': 'period', - 'payroll_amount': additional_wage_period, - }) - - # Need a specific 'create_date' to test. - badge_user_period = self.env['gamification.badge.user'].create({ - 'badge_id': badge_period.id, - 'employee_id': self.employee.id, - 'user_id': self.env.user.id, - }) - self.env.cr.execute('update gamification_badge_user set create_date = \'2018-02-10\' where id = %d;' % (badge_user_period.id, )) - badge_user_period = self.env['gamification.badge.user'].browse(badge_user_period.id) - - self.assertEqual(self.employee.badge_ids, badge_user + badge_user_period) - - # Includes only one badge - payslip = self._createPayslip(self.employee, - '2018-01-01', - '2018-01-31',) - self.assertTrue(payslip.input_line_ids) - input_line = payslip.input_line_ids.filtered(lambda l: l.name == 'Badges') - self.assertTrue(input_line) - self.assertEqual(input_line.amount, additional_wage) - payslip.compute_sheet() - cats = self._getCategories(payslip) - self.assertEqual(cats['BASIC'], self.wage + additional_wage) - - - # Include both Badges - payslip = self._createPayslip(self.employee, - '2018-02-01', - '2018-02-25',) - input_line = payslip.input_line_ids.filtered(lambda l: l.name == 'Badges') - self.assertTrue(input_line) - self.assertEqual(input_line.amount, additional_wage + additional_wage_period) - payslip.compute_sheet() - cats = self._getCategories(payslip) - self.assertEqual(cats['BASIC'], self.wage + additional_wage + additional_wage_period) diff --git a/hr_payroll_gamification/views/gamification_views.xml b/hr_payroll_gamification/views/gamification_views.xml deleted file mode 100644 index 17fe63a8..00000000 --- a/hr_payroll_gamification/views/gamification_views.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - gamification.badge.form.inherit - gamification.badge - 20 - - - - - - - - - - - - - \ No newline at end of file