From 9250cc60e154355d165dcf7d0183325023a4228e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 7 Nov 2016 10:23:00 +0100 Subject: [PATCH] [IMP] resource: set default calendar as data Currently there is no default resource calendar. This leads to calendar being rarely used as it is not clear how to define them and how to use them. Moreover some code handle default-like calendar by trying to use 8-16 work hours; this should be replaced by having a real default calendar. This commit replaces the demo calendar by a real data calendar. It will soon be used as default everywhere a resource calendar can be defined. Future improvements will come to make resource easier to use and clean its API. This commit is only the beginning ! --- addons/hr/data/hr_demo.xml | 2 +- addons/hr_payroll/data/hr_payroll_demo.xml | 4 +- addons/hr_payroll/tests/common.py | 2 +- .../tests/test_hr_payroll_account.py | 2 +- .../data/l10n_be_hr_payroll_demo.xml | 2 +- addons/mrp/data/mrp_demo.xml | 10 +- addons/resource/__manifest__.py | 1 + addons/resource/data/resource_data.xml | 20 +++ addons/resource/data/resource_demo.xml | 156 +++++------------- 9 files changed, 71 insertions(+), 128 deletions(-) create mode 100644 addons/resource/data/resource_data.xml diff --git a/addons/hr/data/hr_demo.xml b/addons/hr/data/hr_demo.xml index f1853e5b6c1..7eaf504d9e9 100644 --- a/addons/hr/data/hr_demo.xml +++ b/addons/hr/data/hr_demo.xml @@ -137,7 +137,7 @@ If you have development competencies, we can propose you specific traineeships Pieter Parker - + Building 1, Second Floor +3281813700 pieter@openerp.com diff --git a/addons/hr_payroll/data/hr_payroll_demo.xml b/addons/hr_payroll/data/hr_payroll_demo.xml index 74c8e3ebaad..8abbf155d6e 100644 --- a/addons/hr_payroll/data/hr_payroll_demo.xml +++ b/addons/hr_payroll/data/hr_payroll_demo.xml @@ -148,7 +148,7 @@ Default contract for marketing executives - + @@ -160,7 +160,7 @@ This is Gilles Gravie's contract - + diff --git a/addons/hr_payroll/tests/common.py b/addons/hr_payroll/tests/common.py index c01128d11e4..89ed2ff22da 100644 --- a/addons/hr_payroll/tests/common.py +++ b/addons/hr_payroll/tests/common.py @@ -46,5 +46,5 @@ class TestPayslipBase(TransactionCase): 'type_id': self.ref('hr_contract.hr_contract_type_emp'), 'employee_id': self.richard_emp.id, 'struct_id': self.developer_pay_structure.id, - 'working_hours': self.ref('resource.timesheet_group1') + 'working_hours': self.ref('resource.resource_calendar_std') }) diff --git a/addons/hr_payroll_account/tests/test_hr_payroll_account.py b/addons/hr_payroll_account/tests/test_hr_payroll_account.py index 68c64b07409..5b1b9a32d19 100644 --- a/addons/hr_payroll_account/tests/test_hr_payroll_account.py +++ b/addons/hr_payroll_account/tests/test_hr_payroll_account.py @@ -70,7 +70,7 @@ class TestHrPayrollAccount(common.TransactionCase): 'type_id': self.ref('hr_contract.hr_contract_type_emp'), 'employee_id': self.hr_employee_john.id, 'struct_id': self.hr_structure_softwaredeveloper.id, - 'working_hours': self.ref('resource.timesheet_group1'), + 'working_hours': self.ref('resource.resource_calendar_std'), 'journal_id': self.ref('hr_payroll_account.expenses_journal'), }) diff --git a/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_demo.xml b/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_demo.xml index 54f338094e8..ca7fb2ffd56 100644 --- a/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_demo.xml +++ b/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_demo.xml @@ -10,7 +10,7 @@ - + diff --git a/addons/mrp/data/mrp_demo.xml b/addons/mrp/data/mrp_demo.xml index 9f32cdc417e..7f0ee2c7bf8 100644 --- a/addons/mrp/data/mrp_demo.xml +++ b/addons/mrp/data/mrp_demo.xml @@ -38,27 +38,27 @@ Assembly Station 1 - + 5 10 8 87 - + Cutting - + Drill Station 1 - + Assemble Station 2 - + diff --git a/addons/resource/__manifest__.py b/addons/resource/__manifest__.py index 1c79b94ace0..0993a088d80 100644 --- a/addons/resource/__manifest__.py +++ b/addons/resource/__manifest__.py @@ -15,6 +15,7 @@ associated to every resource. It also manages the leaves of every resource. """, 'depends': ['base'], 'data': [ + 'data/resource_data.xml', 'security/ir.model.access.csv', 'security/resource_security.xml', 'views/resource_views.xml', diff --git a/addons/resource/data/resource_data.xml b/addons/resource/data/resource_data.xml new file mode 100644 index 00000000000..f6721316fb1 --- /dev/null +++ b/addons/resource/data/resource_data.xml @@ -0,0 +1,20 @@ + + + + Standard 40 Hours/Week + + + + diff --git a/addons/resource/data/resource_demo.xml b/addons/resource/data/resource_demo.xml index 7869468483c..0670ae9c3ce 100644 --- a/addons/resource/data/resource_demo.xml +++ b/addons/resource/data/resource_demo.xml @@ -1,123 +1,45 @@ + + + + + Analyst + + + user + - + + + + Designer + + + user + - - 40 Hours/Week - - - - Monday morning - 0 - 08 - 12 - - - - Monday evening - 0 - 13 - 17 - - - - Tuesday morning - 1 - 08 - 12 - - - - Tuesday evening - 1 - 13 - 17 - - - - Wednesday morning - 2 - 08 - 12 - - - - Wednesday evening - 2 - 13 - 17 - - - - Thursday morning - 3 - 08 - 12 - - - - Thursday evening - 13 - 17 - 3 - - - - Friday morning - 4 - 08 - 12 - - - - Friday evening - 4 - 13 - 17 - - - - - - - Analyst - - - user - - - - - - Designer - - - user - - - - - - Developer - - - user - - - - 2 Hours On Leave - - - - - - - - Dummy Resource Leave - - - - + + + + Developer + + + user + + + 2 Hours On Leave + + + + + + + + Dummy Resource Leave + + + +