From 3db3086131f377cbb77acdf3b3eadfe178ca0560 Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Fri, 29 Nov 2019 14:05:55 +0100 Subject: [PATCH 01/16] [11.0][ADD] cb_number_of_holidays_report --- cb_number_of_holidays_report/README.rst | 1 + cb_number_of_holidays_report/__init__.py | 2 + cb_number_of_holidays_report/__manifest__.py | 20 ++++ .../report/__init__.py | 1 + .../report/holidays_count_report.py | 69 ++++++++++++ .../report/holidays_count_report.xml | 47 ++++++++ .../tests/__init__.py | 1 + .../tests/test_number_of_holidays_report.py | 102 ++++++++++++++++++ .../wizards/__init__.py | 1 + .../wizards/wizard_holidays_count.py | 73 +++++++++++++ .../wizards/wizard_holidays_count.xml | 64 +++++++++++ 11 files changed, 381 insertions(+) create mode 100644 cb_number_of_holidays_report/README.rst create mode 100644 cb_number_of_holidays_report/__init__.py create mode 100644 cb_number_of_holidays_report/__manifest__.py create mode 100644 cb_number_of_holidays_report/report/__init__.py create mode 100644 cb_number_of_holidays_report/report/holidays_count_report.py create mode 100644 cb_number_of_holidays_report/report/holidays_count_report.xml create mode 100644 cb_number_of_holidays_report/tests/__init__.py create mode 100644 cb_number_of_holidays_report/tests/test_number_of_holidays_report.py create mode 100644 cb_number_of_holidays_report/wizards/__init__.py create mode 100644 cb_number_of_holidays_report/wizards/wizard_holidays_count.py create mode 100644 cb_number_of_holidays_report/wizards/wizard_holidays_count.xml diff --git a/cb_number_of_holidays_report/README.rst b/cb_number_of_holidays_report/README.rst new file mode 100644 index 00000000..ee57c7dc --- /dev/null +++ b/cb_number_of_holidays_report/README.rst @@ -0,0 +1 @@ +Report para saber quien tiene vacaciones en un intervalo de tiempo. \ No newline at end of file diff --git a/cb_number_of_holidays_report/__init__.py b/cb_number_of_holidays_report/__init__.py new file mode 100644 index 00000000..5f9d1863 --- /dev/null +++ b/cb_number_of_holidays_report/__init__.py @@ -0,0 +1,2 @@ +from . import report +from . import wizards diff --git a/cb_number_of_holidays_report/__manifest__.py b/cb_number_of_holidays_report/__manifest__.py new file mode 100644 index 00000000..b2ce3c7c --- /dev/null +++ b/cb_number_of_holidays_report/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Cb Number Of Holidays Report', + 'summary': """ + Report para saber quien tiene vacaciones en un intervalo de tiempo""", + 'version': '11.0.1.0.0', + 'license': 'AGPL-3', + 'author': 'Creu Blanca', + 'website': 'www.creublanca.es', + 'depends': [ + 'cb_holidays_compute_mix', + 'cb_hr_views', + ], + 'data': [ + 'report/holidays_count_report.xml', + 'wizards/wizard_holidays_count.xml', + ], +} diff --git a/cb_number_of_holidays_report/report/__init__.py b/cb_number_of_holidays_report/report/__init__.py new file mode 100644 index 00000000..4af567aa --- /dev/null +++ b/cb_number_of_holidays_report/report/__init__.py @@ -0,0 +1 @@ +from . import holidays_count_report diff --git a/cb_number_of_holidays_report/report/holidays_count_report.py b/cb_number_of_holidays_report/report/holidays_count_report.py new file mode 100644 index 00000000..41f75d8d --- /dev/null +++ b/cb_number_of_holidays_report/report/holidays_count_report.py @@ -0,0 +1,69 @@ +from odoo import api, fields, models, _ +from odoo.exceptions import UserError +from datetime import timedelta + + +class HolidaysCountReport(models.AbstractModel): + _name = "report.cb_number_of_holidays_report.report_holidays_count" + + @api.model + def get_report_values(self, docids, data=None): + if not data.get("form"): + raise UserError( + _("Form content is missing, this report cannot be printed.") + ) + + date_from = data["form"]["date_from"] + date_to = data["form"]["date_to"] + + docs = [] + + for employee in self.env["hr.employee"].browse( + data["form"]["employee_ids"] + ): + holidays = self.env["hr.holidays"].search( + [ + ("employee_id", "=", employee.id), + ("type", "=", "remove"), + ("date_from", "<=", date_to), + ("date_to", ">=", date_from), + ("state", "=", "validate"), + ("count_in_hours", "=", False), + ] + ) + + days_count = 0.0 + date_from_day = fields.Datetime.from_string(date_from) + date_to_day = fields.Datetime.from_string(date_to) + date_to_day += timedelta(days=1) + for holiday in holidays: + if date_from >= holiday.date_from and ( + date_to <= holiday.date_to + ): + days = (date_to_day - date_from_day).days + elif date_from < holiday.date_from and ( + date_to > holiday.date_to + ): + days = abs(holiday.number_of_days) + elif date_from >= holiday.date_from and ( + date_to >= holiday.date_to + ): + days = self.env["hr.holidays"]._get_number_of_days( + date_from, holiday.date_to, False + ) + else: + days = self.env["hr.holidays"]._get_number_of_days( + holiday.date_from, + fields.Datetime.to_string(date_to_day), + False, + ) + days_count += days + docs.append({"employee": employee.name, "num_of_days": days_count}) + + return { + "doc_ids": data["ids"], + "doc_model": data["model"], + "date_from": date_from, + "date_to": date_to, + "docs": docs, + } diff --git a/cb_number_of_holidays_report/report/holidays_count_report.xml b/cb_number_of_holidays_report/report/holidays_count_report.xml new file mode 100644 index 00000000..3c7a600d --- /dev/null +++ b/cb_number_of_holidays_report/report/holidays_count_report.xml @@ -0,0 +1,47 @@ + + + + + + + diff --git a/cb_number_of_holidays_report/tests/__init__.py b/cb_number_of_holidays_report/tests/__init__.py new file mode 100644 index 00000000..d5a0c97b --- /dev/null +++ b/cb_number_of_holidays_report/tests/__init__.py @@ -0,0 +1 @@ +from . import test_number_of_holidays_report diff --git a/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py b/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py new file mode 100644 index 00000000..af1b66f5 --- /dev/null +++ b/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py @@ -0,0 +1,102 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase +from odoo.exceptions import UserError + + +class TestNumberOfHolidaysReport(TransactionCase): + def setUp(self): + super().setUp() + self.holiday_type = self.env["hr.holidays.status"].create( + {"name": "Holiday Type", "limit": True} + ) + self.partner_id = self.env["res.partner"].create( + {"name": "Pieter", "is_practitioner": True} + ) + self.department = self.env["hr.department"].create( + {"name": "Department"} + ) + self.category = self.env["hr.employee.category"].create( + {"name": "Tag 1"} + ) + self.employee = self.env["hr.employee"].create( + { + "name": "Pieter", + "partner_id": self.partner_id.id, + "is_practitioner": True, + "department_id": self.department.id, + "category_ids": [(4, self.category.id)], + } + ) + self.holiday = self.env["hr.holidays"].create( + { + "name": "Test", + "type": "remove", + "employee_id": self.employee.id, + "holiday_status_id": self.holiday_type.id, + "date_from": "2019-08-05 00:00:00", + "date_to": "2019-08-09 23:59:59", + "number_of_days_temp": 5, + } + ) + self.holiday.action_validate() + self.wizard = self.env["wizard.holidays.count"].create( + { + "date_from": "2019-08-04", + "date_to": "2019-08-10", + "department_id": self.department.id, + "category_ids": [(4, self.category.id)], + } + ) + + def test_number_of_holidays_report(self): + self.wizard.populate() + self.assertIn(self.employee.id, self.wizard.employee_ids.ids) + with self.assertRaises(UserError): + self.env[ + "report.cb_number_of_holidays_report.report_holidays_count" + ].get_report_values(False, {}) + + data = dict({"form": {}}) + data["ids"] = self.wizard.ids + data["model"] = self.wizard._name + data["form"]["employee_ids"] = [self.employee.id] + + data["form"]["date_from"] = "2019-08-04" + data["form"]["date_to"] = "2019-08-10" + result = self.env[ + "report.cb_number_of_holidays_report.report_holidays_count" + ].get_report_values(False, data) + self.assertEqual(result["docs"][0]["num_of_days"], 5.0) + self.assertEqual(result["docs"][0]["employee"], "Pieter") + + data["form"]["date_from"] = "2019-08-07" + result = self.env[ + "report.cb_number_of_holidays_report.report_holidays_count" + ].get_report_values(False, data) + + self.assertEqual(result["docs"][0]["num_of_days"], 3.0) + + data["form"]["date_to"] = "2019-08-08" + result = self.env[ + "report.cb_number_of_holidays_report.report_holidays_count" + ].get_report_values(False, data) + + self.assertEqual(result["docs"][0]["num_of_days"], 2.0) + + data["form"]["date_from"] = "2019-08-04" + result = self.env[ + "report.cb_number_of_holidays_report.report_holidays_count" + ].get_report_values(False, data) + + self.assertEqual(result["docs"][0]["num_of_days"], 4.0) + + printing = self.wizard.print_report() + self.assertEqual( + printing["report_name"], + "cb_number_of_holidays_report.report_holidays_count", + ) + self.assertEqual( + printing["data"]["form"]["employee_ids"], [self.employee.id] + ) diff --git a/cb_number_of_holidays_report/wizards/__init__.py b/cb_number_of_holidays_report/wizards/__init__.py new file mode 100644 index 00000000..8f60d9f6 --- /dev/null +++ b/cb_number_of_holidays_report/wizards/__init__.py @@ -0,0 +1 @@ +from . import wizard_holidays_count diff --git a/cb_number_of_holidays_report/wizards/wizard_holidays_count.py b/cb_number_of_holidays_report/wizards/wizard_holidays_count.py new file mode 100644 index 00000000..5c2e6a03 --- /dev/null +++ b/cb_number_of_holidays_report/wizards/wizard_holidays_count.py @@ -0,0 +1,73 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models, _ +from odoo.exceptions import UserError, ValidationError + + +class WizardHolidaysCount(models.TransientModel): + + _name = 'wizard.holidays.count' + + name = fields.Char() + + date_from = fields.Date(required=True) + date_to = fields.Date(required=True) + + employee_ids = fields.Many2many('hr.employee') + + department_id = fields.Many2one( + 'hr.department', string='Department' + ) + category_ids = fields.Many2many( + 'hr.employee.category', string='Tag' + ) + + @api.model + def default_get(self, fields): + res = super().default_get(fields) + if self.env.user.employee_ids: + res[ + 'department_id' + ] = self.env.user.employee_ids[0].department_id.id + return res + + def _prepare_employee_domain(self): + res = [] + if self.category_ids: + res.append(('category_ids', 'in', self.category_ids.ids)) + if self.department_id: + res.append(('department_id', 'child_of', self.department_id.id)) + return res + + @api.multi + def populate(self): + domain = self._prepare_employee_domain() + self.employee_ids = self.env['hr.employee'].search(domain) + return { + "type": "ir.actions.do_nothing", + } + + @api.multi + def print_report(self): + self.ensure_one() + [data] = self.read() + if not data.get('employee_ids'): + raise UserError(_( + 'You have to select at least one Employee. And try again.')) + datas = { + 'ids': self.ids, + 'model': self._name, + 'form': data + } + return self.env.ref( + 'cb_number_of_holidays_report.action_report_holidays_count' + ).report_action(self, data=datas) + + @api.constrains('date_from', 'date_to') + def check_date(self): + for record in self: + if (record.date_from and record.date_to and + record.date_from > record.date_to): + raise ValidationError( + _('The start date must be anterior to the end date.')) diff --git a/cb_number_of_holidays_report/wizards/wizard_holidays_count.xml b/cb_number_of_holidays_report/wizards/wizard_holidays_count.xml new file mode 100644 index 00000000..34b1adfe --- /dev/null +++ b/cb_number_of_holidays_report/wizards/wizard_holidays_count.xml @@ -0,0 +1,64 @@ + + + + + + + wizard.holidays.count.form (in cb_number_of_holidays_report) + wizard.holidays.count + +
+ + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+
+
+
+ + + Number Holidays Count + wizard.holidays.count + form + {} + new + + + + + Number of Holidays Count + + + + +
From 7db45841c260eac3907d6e0a8f3dcb8c776c81ce Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Wed, 26 Feb 2020 17:22:24 +0100 Subject: [PATCH 02/16] [12.0][MIG] cb_number_of_holidays_report --- .../report/holidays_count_report.py | 22 +++---- .../tests/test_number_of_holidays_report.py | 20 ++++--- .../wizards/wizard_holidays_count.py | 57 +++++++++---------- 3 files changed, 49 insertions(+), 50 deletions(-) diff --git a/cb_number_of_holidays_report/report/holidays_count_report.py b/cb_number_of_holidays_report/report/holidays_count_report.py index 41f75d8d..26cd5010 100644 --- a/cb_number_of_holidays_report/report/holidays_count_report.py +++ b/cb_number_of_holidays_report/report/holidays_count_report.py @@ -5,6 +5,7 @@ class HolidaysCountReport(models.AbstractModel): _name = "report.cb_number_of_holidays_report.report_holidays_count" + _description = "Report of number of holidays" @api.model def get_report_values(self, docids, data=None): @@ -21,14 +22,13 @@ def get_report_values(self, docids, data=None): for employee in self.env["hr.employee"].browse( data["form"]["employee_ids"] ): - holidays = self.env["hr.holidays"].search( + holidays = self.env["hr.leave"].search( [ ("employee_id", "=", employee.id), - ("type", "=", "remove"), ("date_from", "<=", date_to), ("date_to", ">=", date_from), ("state", "=", "validate"), - ("count_in_hours", "=", False), + ("request_unit_hours", "=", False), ] ) @@ -37,22 +37,22 @@ def get_report_values(self, docids, data=None): date_to_day = fields.Datetime.from_string(date_to) date_to_day += timedelta(days=1) for holiday in holidays: - if date_from >= holiday.date_from and ( - date_to <= holiday.date_to + if date_from_day >= holiday.date_from and ( + date_to_day <= holiday.date_to ): days = (date_to_day - date_from_day).days - elif date_from < holiday.date_from and ( - date_to > holiday.date_to + elif date_from_day < holiday.date_from and ( + date_to_day > holiday.date_to ): days = abs(holiday.number_of_days) - elif date_from >= holiday.date_from and ( - date_to >= holiday.date_to + elif date_from_day >= holiday.date_from and ( + date_to_day >= holiday.date_to ): - days = self.env["hr.holidays"]._get_number_of_days( + days = self.env["hr.leave"]._get_number_of_days( date_from, holiday.date_to, False ) else: - days = self.env["hr.holidays"]._get_number_of_days( + days = self.env["hr.leave"]._get_number_of_days( holiday.date_from, fields.Datetime.to_string(date_to_day), False, diff --git a/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py b/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py index af1b66f5..b5e9f2dd 100644 --- a/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py +++ b/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py @@ -8,8 +8,13 @@ class TestNumberOfHolidaysReport(TransactionCase): def setUp(self): super().setUp() - self.holiday_type = self.env["hr.holidays.status"].create( - {"name": "Holiday Type", "limit": True} + self.holiday_type = self.env["hr.leave.type"].create( + { + "name": "Holiday Type", + "request_unit": "day", + "allocation_type": "no", + "validity_start": False, + } ) self.partner_id = self.env["res.partner"].create( {"name": "Pieter", "is_practitioner": True} @@ -24,22 +29,21 @@ def setUp(self): { "name": "Pieter", "partner_id": self.partner_id.id, - "is_practitioner": True, "department_id": self.department.id, "category_ids": [(4, self.category.id)], } ) - self.holiday = self.env["hr.holidays"].create( + self.holiday = self.env["hr.leave"].create( { "name": "Test", - "type": "remove", "employee_id": self.employee.id, "holiday_status_id": self.holiday_type.id, - "date_from": "2019-08-05 00:00:00", - "date_to": "2019-08-09 23:59:59", - "number_of_days_temp": 5, + "request_date_from": "2019-08-05", + "request_date_to": "2019-08-09", + "request_unit_hours": False, } ) + self.holiday._onchange_request_parameters() self.holiday.action_validate() self.wizard = self.env["wizard.holidays.count"].create( { diff --git a/cb_number_of_holidays_report/wizards/wizard_holidays_count.py b/cb_number_of_holidays_report/wizards/wizard_holidays_count.py index 5c2e6a03..1f992095 100644 --- a/cb_number_of_holidays_report/wizards/wizard_holidays_count.py +++ b/cb_number_of_holidays_report/wizards/wizard_holidays_count.py @@ -6,68 +6,63 @@ class WizardHolidaysCount(models.TransientModel): - - _name = 'wizard.holidays.count' + _name = "wizard.holidays.count" + _description = "Wizard Report of number of holidays" name = fields.Char() date_from = fields.Date(required=True) date_to = fields.Date(required=True) - employee_ids = fields.Many2many('hr.employee') + employee_ids = fields.Many2many("hr.employee") - department_id = fields.Many2one( - 'hr.department', string='Department' - ) - category_ids = fields.Many2many( - 'hr.employee.category', string='Tag' - ) + department_id = fields.Many2one("hr.department", string="Department") + category_ids = fields.Many2many("hr.employee.category", string="Tag") @api.model def default_get(self, fields): res = super().default_get(fields) if self.env.user.employee_ids: - res[ - 'department_id' - ] = self.env.user.employee_ids[0].department_id.id + res["department_id"] = self.env.user.employee_ids[ + 0 + ].department_id.id return res def _prepare_employee_domain(self): res = [] if self.category_ids: - res.append(('category_ids', 'in', self.category_ids.ids)) + res.append(("category_ids", "in", self.category_ids.ids)) if self.department_id: - res.append(('department_id', 'child_of', self.department_id.id)) + res.append(("department_id", "child_of", self.department_id.id)) return res @api.multi def populate(self): domain = self._prepare_employee_domain() - self.employee_ids = self.env['hr.employee'].search(domain) - return { - "type": "ir.actions.do_nothing", - } + self.employee_ids = self.env["hr.employee"].search(domain) + return {"type": "ir.actions.do_nothing"} @api.multi def print_report(self): self.ensure_one() [data] = self.read() - if not data.get('employee_ids'): - raise UserError(_( - 'You have to select at least one Employee. And try again.')) - datas = { - 'ids': self.ids, - 'model': self._name, - 'form': data - } + if not data.get("employee_ids"): + raise UserError( + _("You have to select at least one Employee. And try again.") + ) + datas = {"ids": self.ids, "model": self._name, "form": data} return self.env.ref( - 'cb_number_of_holidays_report.action_report_holidays_count' + "cb_number_of_holidays_report.action_report_holidays_count" ).report_action(self, data=datas) - @api.constrains('date_from', 'date_to') + @api.constrains("date_from", "date_to") def check_date(self): for record in self: - if (record.date_from and record.date_to and - record.date_from > record.date_to): + if ( + record.date_from + and record.date_to + and record.date_from > record.date_to + ): raise ValidationError( - _('The start date must be anterior to the end date.')) + _("The start date must be anterior to the end date.") + ) From 32a216649538a743d260fc195f8d789d49147908 Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Tue, 31 Mar 2020 08:26:34 +0200 Subject: [PATCH 03/16] [12.0][FIX] fix number of holidays repo --- cb_number_of_holidays_report/report/holidays_count_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cb_number_of_holidays_report/report/holidays_count_report.py b/cb_number_of_holidays_report/report/holidays_count_report.py index 26cd5010..faffd015 100644 --- a/cb_number_of_holidays_report/report/holidays_count_report.py +++ b/cb_number_of_holidays_report/report/holidays_count_report.py @@ -8,7 +8,7 @@ class HolidaysCountReport(models.AbstractModel): _description = "Report of number of holidays" @api.model - def get_report_values(self, docids, data=None): + def _get_report_values(self, docids, data=None): if not data.get("form"): raise UserError( _("Form content is missing, this report cannot be printed.") From 0a8ccaf533c5f1ac2639049eb4bec1a72291cd4f Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Wed, 1 Apr 2020 13:38:44 +0200 Subject: [PATCH 04/16] [12.0][FIX] reprot values --- cb_number_of_holidays_report/__manifest__.py | 2 +- .../tests/test_number_of_holidays_report.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cb_number_of_holidays_report/__manifest__.py b/cb_number_of_holidays_report/__manifest__.py index b2ce3c7c..383eb856 100644 --- a/cb_number_of_holidays_report/__manifest__.py +++ b/cb_number_of_holidays_report/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Cb Number Of Holidays Report', 'summary': """ Report para saber quien tiene vacaciones en un intervalo de tiempo""", - 'version': '11.0.1.0.0', + 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'author': 'Creu Blanca', 'website': 'www.creublanca.es', diff --git a/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py b/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py index b5e9f2dd..9002ffb3 100644 --- a/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py +++ b/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py @@ -60,7 +60,7 @@ def test_number_of_holidays_report(self): with self.assertRaises(UserError): self.env[ "report.cb_number_of_holidays_report.report_holidays_count" - ].get_report_values(False, {}) + ]._get_report_values(False, {}) data = dict({"form": {}}) data["ids"] = self.wizard.ids @@ -71,28 +71,28 @@ def test_number_of_holidays_report(self): data["form"]["date_to"] = "2019-08-10" result = self.env[ "report.cb_number_of_holidays_report.report_holidays_count" - ].get_report_values(False, data) + ]._get_report_values(False, data) self.assertEqual(result["docs"][0]["num_of_days"], 5.0) self.assertEqual(result["docs"][0]["employee"], "Pieter") data["form"]["date_from"] = "2019-08-07" result = self.env[ "report.cb_number_of_holidays_report.report_holidays_count" - ].get_report_values(False, data) + ]._get_report_values(False, data) self.assertEqual(result["docs"][0]["num_of_days"], 3.0) data["form"]["date_to"] = "2019-08-08" result = self.env[ "report.cb_number_of_holidays_report.report_holidays_count" - ].get_report_values(False, data) + ]._get_report_values(False, data) self.assertEqual(result["docs"][0]["num_of_days"], 2.0) data["form"]["date_from"] = "2019-08-04" result = self.env[ "report.cb_number_of_holidays_report.report_holidays_count" - ].get_report_values(False, data) + ]._get_report_values(False, data) self.assertEqual(result["docs"][0]["num_of_days"], 4.0) From b3b7c3c64132285f59bc25a76ca8db90e3ae319b Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Tue, 5 May 2020 12:55:43 +0200 Subject: [PATCH 05/16] [12.0][IMP] Update cb-hr translations --- .../i18n/cb_number_of_holidays_report.pot | 175 +++++++++++++++++ cb_number_of_holidays_report/i18n/es.po | 176 ++++++++++++++++++ 2 files changed, 351 insertions(+) create mode 100644 cb_number_of_holidays_report/i18n/cb_number_of_holidays_report.pot create mode 100644 cb_number_of_holidays_report/i18n/es.po diff --git a/cb_number_of_holidays_report/i18n/cb_number_of_holidays_report.pot b/cb_number_of_holidays_report/i18n/cb_number_of_holidays_report.pot new file mode 100644 index 00000000..dbf2a01c --- /dev/null +++ b/cb_number_of_holidays_report/i18n/cb_number_of_holidays_report.pot @@ -0,0 +1,175 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * cb_number_of_holidays_report +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-05 10:35+0000\n" +"PO-Revision-Date: 2020-05-05 10:35+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "From:" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "To:" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Cancel" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__create_uid +msgid "Created by" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__create_date +msgid "Created on" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__date_from +msgid "Date From" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__date_to +msgid "Date To" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__department_id +msgid "Department" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_report_cb_number_of_holidays_report_report_holidays_count__display_name +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__display_name +msgid "Display Name" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__employee_ids +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "Employee" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Employees" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Filters" +msgstr "" + +#. module: cb_number_of_holidays_report +#: code:addons/cb_number_of_holidays_report/report/holidays_count_report.py:14 +#, python-format +msgid "Form content is missing, this report cannot be printed." +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.actions.report,name:cb_number_of_holidays_report.action_report_holidays_count +msgid "Holidays Count" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_report_cb_number_of_holidays_report_report_holidays_count__id +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__id +msgid "ID" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_report_cb_number_of_holidays_report_report_holidays_count____last_update +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count____last_update +msgid "Last Modified on" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__write_date +msgid "Last Updated on" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "Leaves Count" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__name +msgid "Name" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.actions.act_window,name:cb_number_of_holidays_report.wizard_holidays_count_act_window +msgid "Number Holidays Count" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "Number of Days" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.ui.menu,name:cb_number_of_holidays_report.wizard_holidays_count_menu +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Number of Holidays Count" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Print" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model,name:cb_number_of_holidays_report.model_report_cb_number_of_holidays_report_report_holidays_count +msgid "Report of number of holidays" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Search" +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__category_ids +msgid "Tag" +msgstr "" + +#. module: cb_number_of_holidays_report +#: code:addons/cb_number_of_holidays_report/wizards/wizard_holidays_count.py:67 +#, python-format +msgid "The start date must be anterior to the end date." +msgstr "" + +#. module: cb_number_of_holidays_report +#: model:ir.model,name:cb_number_of_holidays_report.model_wizard_holidays_count +msgid "Wizard Report of number of holidays" +msgstr "" + +#. module: cb_number_of_holidays_report +#: code:addons/cb_number_of_holidays_report/wizards/wizard_holidays_count.py:51 +#, python-format +msgid "You have to select at least one Employee. And try again." +msgstr "" + diff --git a/cb_number_of_holidays_report/i18n/es.po b/cb_number_of_holidays_report/i18n/es.po new file mode 100644 index 00000000..11390925 --- /dev/null +++ b/cb_number_of_holidays_report/i18n/es.po @@ -0,0 +1,176 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * cb_number_of_holidays_report +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-05 10:35+0000\n" +"PO-Revision-Date: 2020-05-05 12:37+0200\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"Language: es\n" +"X-Generator: Poedit 2.0.6\n" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "From:" +msgstr "From:" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "To:" +msgstr "Hasta:" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Cancel" +msgstr "Cancelar" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__date_from +msgid "Date From" +msgstr "Desde" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__date_to +msgid "Date To" +msgstr "Hasta" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__department_id +msgid "Department" +msgstr "Departamento" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_report_cb_number_of_holidays_report_report_holidays_count__display_name +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__employee_ids +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "Employee" +msgstr "Empleado" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Employees" +msgstr "Empleados" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Filters" +msgstr "Filtros" + +#. module: cb_number_of_holidays_report +#: code:addons/cb_number_of_holidays_report/report/holidays_count_report.py:14 +#, python-format +msgid "Form content is missing, this report cannot be printed." +msgstr "Form content is missing, this report cannot be printed." + +#. module: cb_number_of_holidays_report +#: model:ir.actions.report,name:cb_number_of_holidays_report.action_report_holidays_count +msgid "Holidays Count" +msgstr "Número de Ausencias" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_report_cb_number_of_holidays_report_report_holidays_count__id +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__id +msgid "ID" +msgstr "ID" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_report_cb_number_of_holidays_report_report_holidays_count____last_update +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "Leaves Count" +msgstr "Número de Ausencias" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__name +msgid "Name" +msgstr "Nombre" + +#. module: cb_number_of_holidays_report +#: model:ir.actions.act_window,name:cb_number_of_holidays_report.wizard_holidays_count_act_window +msgid "Number Holidays Count" +msgstr "Número de Ausencias" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.report_holidays_count +msgid "Number of Days" +msgstr "Número de días" + +#. module: cb_number_of_holidays_report +#: model:ir.ui.menu,name:cb_number_of_holidays_report.wizard_holidays_count_menu +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Number of Holidays Count" +msgstr "Número de Ausencias" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Print" +msgstr "Imprimir" + +#. module: cb_number_of_holidays_report +#: model:ir.model,name:cb_number_of_holidays_report.model_report_cb_number_of_holidays_report_report_holidays_count +msgid "Report of number of holidays" +msgstr "Informe de número de ausencias" + +#. module: cb_number_of_holidays_report +#: model_terms:ir.ui.view,arch_db:cb_number_of_holidays_report.wizard_holidays_count_form_view +msgid "Search" +msgstr "Búsqueda" + +#. module: cb_number_of_holidays_report +#: model:ir.model.fields,field_description:cb_number_of_holidays_report.field_wizard_holidays_count__category_ids +msgid "Tag" +msgstr "Etiqueta" + +#. module: cb_number_of_holidays_report +#: code:addons/cb_number_of_holidays_report/wizards/wizard_holidays_count.py:67 +#, python-format +msgid "The start date must be anterior to the end date." +msgstr "La fecha inicial debe ser anterior a la final." + +#. module: cb_number_of_holidays_report +#: model:ir.model,name:cb_number_of_holidays_report.model_wizard_holidays_count +msgid "Wizard Report of number of holidays" +msgstr "Wizard Report of number of holidays" + +#. module: cb_number_of_holidays_report +#: code:addons/cb_number_of_holidays_report/wizards/wizard_holidays_count.py:51 +#, python-format +msgid "You have to select at least one Employee. And try again." +msgstr "Se debe seleccionar al menos un empleado" From 8ea77325059b7dc86014f12f35b3aa45eede11a3 Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Wed, 23 Sep 2020 12:56:32 +0200 Subject: [PATCH 06/16] [12.0][IMP] cb_number_of_holidays_report: specify types included in report --- cb_number_of_holidays_report/__init__.py | 2 ++ cb_number_of_holidays_report/__manifest__.py | 25 +++++++++---------- cb_number_of_holidays_report/hooks.py | 15 +++++++++++ .../models/__init__.py | 2 ++ .../models/hr_leave.py | 13 ++++++++++ .../models/hr_leave_type.py | 13 ++++++++++ .../report/holidays_count_report.py | 22 ++++++++++++---- .../tests/test_number_of_holidays_report.py | 15 +++++++++++ .../views/hr_leave_type.xml | 20 +++++++++++++++ .../wizards/wizard_holidays_count.xml | 15 +++++------ 10 files changed, 117 insertions(+), 25 deletions(-) create mode 100644 cb_number_of_holidays_report/hooks.py create mode 100644 cb_number_of_holidays_report/models/__init__.py create mode 100644 cb_number_of_holidays_report/models/hr_leave.py create mode 100644 cb_number_of_holidays_report/models/hr_leave_type.py create mode 100644 cb_number_of_holidays_report/views/hr_leave_type.xml diff --git a/cb_number_of_holidays_report/__init__.py b/cb_number_of_holidays_report/__init__.py index 5f9d1863..4d3bc374 100644 --- a/cb_number_of_holidays_report/__init__.py +++ b/cb_number_of_holidays_report/__init__.py @@ -1,2 +1,4 @@ from . import report from . import wizards +from . import models +from .hooks import pre_init_hook diff --git a/cb_number_of_holidays_report/__manifest__.py b/cb_number_of_holidays_report/__manifest__.py index 383eb856..574bae5e 100644 --- a/cb_number_of_holidays_report/__manifest__.py +++ b/cb_number_of_holidays_report/__manifest__.py @@ -2,19 +2,18 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Cb Number Of Holidays Report', - 'summary': """ + "name": "Cb Number Of Holidays Report", + "summary": """ Report para saber quien tiene vacaciones en un intervalo de tiempo""", - 'version': '12.0.1.0.0', - 'license': 'AGPL-3', - 'author': 'Creu Blanca', - 'website': 'www.creublanca.es', - 'depends': [ - 'cb_holidays_compute_mix', - 'cb_hr_views', - ], - 'data': [ - 'report/holidays_count_report.xml', - 'wizards/wizard_holidays_count.xml', + "version": "12.0.1.0.0", + "license": "AGPL-3", + "author": "Creu Blanca", + "website": "www.creublanca.es", + "depends": ["cb_holidays_compute_mix", "cb_hr_views"], + "data": [ + "views/hr_leave_type.xml", + "report/holidays_count_report.xml", + "wizards/wizard_holidays_count.xml", ], + "pre_init_hook": "pre_init_hook", } diff --git a/cb_number_of_holidays_report/hooks.py b/cb_number_of_holidays_report/hooks.py new file mode 100644 index 00000000..ebed9810 --- /dev/null +++ b/cb_number_of_holidays_report/hooks.py @@ -0,0 +1,15 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging + +logger = logging.getLogger(__name__) + + +def pre_init_hook(cr): + cr.execute( + """ + ALTER TABLE hr_leave + ADD COLUMN IF NOT EXISTS count_in_holidays_report BOOLEAN DEFAULT TRUE + """ + ) diff --git a/cb_number_of_holidays_report/models/__init__.py b/cb_number_of_holidays_report/models/__init__.py new file mode 100644 index 00000000..7c444ff5 --- /dev/null +++ b/cb_number_of_holidays_report/models/__init__.py @@ -0,0 +1,2 @@ +from . import hr_leave_type +from . import hr_leave diff --git a/cb_number_of_holidays_report/models/hr_leave.py b/cb_number_of_holidays_report/models/hr_leave.py new file mode 100644 index 00000000..259b71e8 --- /dev/null +++ b/cb_number_of_holidays_report/models/hr_leave.py @@ -0,0 +1,13 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class HrLeave(models.Model): + + _inherit = "hr.leave" + + count_in_holidays_report = fields.Boolean( + related="holiday_status_id.count_in_holidays_report", store=True + ) diff --git a/cb_number_of_holidays_report/models/hr_leave_type.py b/cb_number_of_holidays_report/models/hr_leave_type.py new file mode 100644 index 00000000..1189e368 --- /dev/null +++ b/cb_number_of_holidays_report/models/hr_leave_type.py @@ -0,0 +1,13 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class HrLeaveType(models.Model): + + _inherit = "hr.leave.type" + + count_in_holidays_report = fields.Boolean( + string="Count in holidays report", default=True + ) diff --git a/cb_number_of_holidays_report/report/holidays_count_report.py b/cb_number_of_holidays_report/report/holidays_count_report.py index faffd015..07918a28 100644 --- a/cb_number_of_holidays_report/report/holidays_count_report.py +++ b/cb_number_of_holidays_report/report/holidays_count_report.py @@ -1,6 +1,7 @@ from odoo import api, fields, models, _ from odoo.exceptions import UserError from datetime import timedelta +from pytz import timezone, utc class HolidaysCountReport(models.AbstractModel): @@ -9,6 +10,8 @@ class HolidaysCountReport(models.AbstractModel): @api.model def _get_report_values(self, docids, data=None): + utz = timezone(self.env.user.tz) + if not data.get("form"): raise UserError( _("Form content is missing, this report cannot be printed.") @@ -25,16 +28,25 @@ def _get_report_values(self, docids, data=None): holidays = self.env["hr.leave"].search( [ ("employee_id", "=", employee.id), - ("date_from", "<=", date_to), - ("date_to", ">=", date_from), + ("request_date_from", "<=", date_to), + ("request_date_to", ">=", date_from), ("state", "=", "validate"), - ("request_unit_hours", "=", False), + ("count_in_holidays_report", "=", True), ] ) days_count = 0.0 - date_from_day = fields.Datetime.from_string(date_from) - date_to_day = fields.Datetime.from_string(date_to) + date_from_day = ( + utz.localize(fields.Datetime.from_string(date_from)) + .astimezone(utc) + .replace(tzinfo=None) + ) + + date_to_day = ( + utz.localize(fields.Datetime.from_string(date_to)) + .astimezone(utc) + .replace(tzinfo=None) + ) date_to_day += timedelta(days=1) for holiday in holidays: if date_from_day >= holiday.date_from and ( diff --git a/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py b/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py index 9002ffb3..7d427edc 100644 --- a/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py +++ b/cb_number_of_holidays_report/tests/test_number_of_holidays_report.py @@ -25,11 +25,26 @@ def setUp(self): self.category = self.env["hr.employee.category"].create( {"name": "Tag 1"} ) + self.calendar = self.env["resource.calendar"].create( + {"name": "Calendar 1", "attendance_ids": []} + ) + for i in range(0, 7): + self.env["resource.calendar.attendance"].create( + { + "name": "Day " + str(i), + "dayofweek": str(i), + "hour_from": 8.0, + "hour_to": 17.0, + "calendar_id": self.calendar.id, + } + ) + self.employee = self.env["hr.employee"].create( { "name": "Pieter", "partner_id": self.partner_id.id, "department_id": self.department.id, + "resource_calendar_id": self.calendar.id, "category_ids": [(4, self.category.id)], } ) diff --git a/cb_number_of_holidays_report/views/hr_leave_type.xml b/cb_number_of_holidays_report/views/hr_leave_type.xml new file mode 100644 index 00000000..480e6e49 --- /dev/null +++ b/cb_number_of_holidays_report/views/hr_leave_type.xml @@ -0,0 +1,20 @@ + + + + + + + hr.leave.type.form (in cb_number_of_holidays_report) + hr.leave.type + + + + + + + + + + + diff --git a/cb_number_of_holidays_report/wizards/wizard_holidays_count.xml b/cb_number_of_holidays_report/wizards/wizard_holidays_count.xml index 34b1adfe..8f31e110 100644 --- a/cb_number_of_holidays_report/wizards/wizard_holidays_count.xml +++ b/cb_number_of_holidays_report/wizards/wizard_holidays_count.xml @@ -47,18 +47,19 @@ - Number Holidays Count + Number Holidays Count wizard.holidays.count form {} new + - - Number of Holidays Count - - - - From b71e45d6b2033db9a8939a98b1d38a916281e520 Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Thu, 5 Nov 2020 08:28:09 +0100 Subject: [PATCH 07/16] [FIX] Pre-commit --- cb_number_of_holidays_report/README.rst | 2 +- .../report/holidays_count_report.py | 5 +- .../report/holidays_count_report.xml | 25 ++++---- .../tests/test_number_of_holidays_report.py | 2 +- .../views/hr_leave_type.xml | 11 +--- .../wizards/wizard_holidays_count.py | 2 +- .../wizards/wizard_holidays_count.xml | 62 +++++++++++-------- 7 files changed, 57 insertions(+), 52 deletions(-) diff --git a/cb_number_of_holidays_report/README.rst b/cb_number_of_holidays_report/README.rst index ee57c7dc..0cf745d4 100644 --- a/cb_number_of_holidays_report/README.rst +++ b/cb_number_of_holidays_report/README.rst @@ -1 +1 @@ -Report para saber quien tiene vacaciones en un intervalo de tiempo. \ No newline at end of file +Report para saber quien tiene vacaciones en un intervalo de tiempo. diff --git a/cb_number_of_holidays_report/report/holidays_count_report.py b/cb_number_of_holidays_report/report/holidays_count_report.py index 07918a28..8eb20926 100644 --- a/cb_number_of_holidays_report/report/holidays_count_report.py +++ b/cb_number_of_holidays_report/report/holidays_count_report.py @@ -1,6 +1,7 @@ -from odoo import api, fields, models, _ -from odoo.exceptions import UserError from datetime import timedelta + +from odoo import _, api, fields, models +from odoo.exceptions import UserError from pytz import timezone, utc diff --git a/cb_number_of_holidays_report/report/holidays_count_report.xml b/cb_number_of_holidays_report/report/holidays_count_report.xml index 3c7a600d..94b2cddf 100644 --- a/cb_number_of_holidays_report/report/holidays_count_report.xml +++ b/cb_number_of_holidays_report/report/holidays_count_report.xml @@ -1,14 +1,13 @@ - + - - + id="action_report_holidays_count" + string="Holidays Count" + model="wizard.holidays.count" + report_type="qweb-pdf" + name="cb_number_of_holidays_report.report_holidays_count" + menu="False" + />