diff --git a/addons/hr_timesheet/__manifest__.py b/addons/hr_timesheet/__manifest__.py index efedc7384f0..8ada09a25b7 100644 --- a/addons/hr_timesheet/__manifest__.py +++ b/addons/hr_timesheet/__manifest__.py @@ -30,7 +30,7 @@ up a management by affair. 'report/hr_timesheet_report_view.xml', 'report/report_timesheet_templates.xml', 'hr_timesheet_installer.xml', - 'hr_dashboard.xml', + 'views/hr_views.xml', ], 'demo': [ 'demo/hr_timesheet_demo.xml', diff --git a/addons/hr_timesheet/hr_dashboard.xml b/addons/hr_timesheet/hr_dashboard.xml deleted file mode 100644 index 9ddacf2524d..00000000000 --- a/addons/hr_timesheet/hr_dashboard.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - hr.department.kanban.inherit - hr.department - - - - - - - - - - - - - diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index c8b7241e5c5..3c3cdecff9e 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -7,24 +7,38 @@ from odoo import api, fields, models class AccountAnalyticLine(models.Model): _inherit = 'account.analytic.line' + def _default_employee_id(self): + return self.env.user.employee_ids[0] + task_id = fields.Many2one('project.task', 'Task') project_id = fields.Many2one('project.project', 'Project', domain=[('allow_timesheets', '=', True)]) - department_id = fields.Many2one('hr.department', "Department", related='user_id.employee_ids.department_id', store=True, readonly=True) + + employee_id = fields.Many2one('hr.employee', "Employee", default=_default_employee_id) + department_id = fields.Many2one('hr.department', "Department", related='employee_id.department_id', store=True, readonly=True) @api.onchange('project_id') def onchange_project_id(self): self.task_id = False + @api.onchange('employee_id') + def _onchange_employee_id(self): + self.user_id = self.employee_id.user_id + @api.model def create(self, vals): - if vals.get('project_id'): - project = self.env['project.project'].browse(vals.get('project_id')) - vals['account_id'] = project.analytic_account_id.id + vals = self._update_timesheet_values(vals) return super(AccountAnalyticLine, self).create(vals) @api.multi def write(self, vals): + vals = self._update_timesheet_values(vals) + return super(AccountAnalyticLine, self).write(vals) + + def _update_timesheet_values(self, vals): if vals.get('project_id'): project = self.env['project.project'].browse(vals.get('project_id')) vals['account_id'] = project.analytic_account_id.id - return super(AccountAnalyticLine, self).write(vals) + if vals.get('employee_id'): + employee = self.env['hr.employee'].browse(vals['employee_id']) + vals['user_id'] = employee.user_id.id + return vals diff --git a/addons/hr_timesheet/hr_timesheet_config_settings_views.xml b/addons/hr_timesheet/hr_timesheet_config_settings_views.xml index 5024f6f0aef..00601ba946c 100644 --- a/addons/hr_timesheet/hr_timesheet_config_settings_views.xml +++ b/addons/hr_timesheet/hr_timesheet_config_settings_views.xml @@ -1,7 +1,7 @@ + groups="group_timesheet_manager" sequence="100"/> hr.timesheet.config.settings.view.form @@ -47,7 +47,7 @@

Billing

-
+
@@ -57,6 +57,11 @@
Sell services and invoice time spent
+
+
+ Save this page and come back here to set up the feature. +
+
diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index ba1b9c54e4e..d2bac3c2ac0 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -1,73 +1,155 @@ - - + + + + account.analytic.line.tree.hr_timesheet account.analytic.line - + - - + + + + account.analytic.line.view.tree.with.user + account.analytic.line + + primary + 10 + + + + + + + + account.analytic.line.pivot account.analytic.line - + + - account.analytic.line.form.inherit.hr_timesheet + account.analytic.line.form account.analytic.line - - primary + 1 + - - - - +
+ + + + + + + + + + + + + + + + +
+ + + account.analytic.line.tree.with.user + account.analytic.line + + primary + 10 + + + + + + + + + + account.analytic.line.calendar + account.analytic.line + + + + + + + + account.analytic.line.search account.analytic.line - + - + + + + - - - - - + + + + + - Activities + My Timesheets account.analytic.line - [('project_id', '!=', False)] - {"search_default_today":1} + tree,form + [('project_id', '!=', False), ('user_id', '=', uid)] + {"search_default_week":1}

@@ -80,22 +162,65 @@ - + tree - 1 - + + - + form - 2 - + + - + + + calendar + + + + + + + + All Timesheets + account.analytic.line + + [('project_id', '!=', False)] + {'search_default_week':1, 'search_default_groupby_employee':1} + + + + + tree + + + + + + + form + + + + + + + calendar + + + + + diff --git a/addons/hr_timesheet/project_timesheet_view.xml b/addons/hr_timesheet/project_timesheet_view.xml index b0f6c3ecdc0..f799cc5b76e 100644 --- a/addons/hr_timesheet/project_timesheet_view.xml +++ b/addons/hr_timesheet/project_timesheet_view.xml @@ -102,7 +102,8 @@ - + + @@ -153,7 +154,7 @@ Timesheets

- +
Timesheets diff --git a/addons/hr_timesheet/report/hr_timesheet_report_view.xml b/addons/hr_timesheet/report/hr_timesheet_report_view.xml index 1764a44cc8c..66e20b6bfcd 100644 --- a/addons/hr_timesheet/report/hr_timesheet_report_view.xml +++ b/addons/hr_timesheet/report/hr_timesheet_report_view.xml @@ -38,10 +38,15 @@ + - - diff --git a/addons/hr_timesheet/security/hr_timesheet_security.xml b/addons/hr_timesheet/security/hr_timesheet_security.xml index 1a95247cf0b..23d20ea4fd4 100644 --- a/addons/hr_timesheet/security/hr_timesheet_security.xml +++ b/addons/hr_timesheet/security/hr_timesheet_security.xml @@ -1,13 +1,56 @@ - - Officer - - - - - - - + + + + User + + + + + + + Manager + + + + + + + + + + + + + + + account.analytic.line.timesheet.user + + [('user_id', '=', user.id), ('project_id', '!=', False)] + + + + + + + + + + + + + account.analytic.line.timesheet.manager + + [('project_id', '!=', False)] + + + + + + + + + \ No newline at end of file diff --git a/addons/hr_timesheet/security/ir.model.access.csv b/addons/hr_timesheet/security/ir.model.access.csv index 61f85fb401e..e9f8ce09b30 100644 --- a/addons/hr_timesheet/security/ir.model.access.csv +++ b/addons/hr_timesheet/security/ir.model.access.csv @@ -1,6 +1,8 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_hr_account_analytic_line,analytic.account.analytic.line,analytic.model_account_analytic_line,hr_timesheet.group_hr_timesheet_user,1,1,1,1 -access_hr_account_analytic_line_employee,analytic.account.analytic.line employee,analytic.model_account_analytic_line,base.group_user,1,1,1,1 -access_product_product_user,product.product user,product.model_product_product,hr_timesheet.group_hr_timesheet_user,1,1,1,1 -access_product_template_hr_timesheet,product.template.hr.timesheet,product.model_product_template,hr_timesheet.group_hr_timesheet_user,1,1,1,1 -access_product_uom_hr_timesheet,product.uom.hr.timesheet,product.model_product_uom,hr_timesheet.group_hr_timesheet_user,1,1,1,1 +access_account_analytic_line_user,analytic.account.analytic.line.timesheet.user,analytic.model_account_analytic_line,hr_timesheet.group_hr_timesheet_user,1,1,1,1 +access_account_analytic_user,analytic.account.analytic.timesheet.user,analytic.model_account_analytic_account,hr_timesheet.group_hr_timesheet_user,1,1,0,0 +access_product_product_user,product.product.timesheet.user,product.model_product_product,hr_timesheet.group_hr_timesheet_user,1,1,1,0 +access_product_template_timesheet_user,product.template.timesheet.user,product.model_product_template,hr_timesheet.group_hr_timesheet_user,1,1,1,0 +access_product_uom_hr_timesheet,product.uom.timesheet.user,product.model_product_uom,hr_timesheet.group_hr_timesheet_user,1,0,0,0 +access_project_project,project.project.timesheet.user,model_project_project,hr_timesheet.group_hr_timesheet_user,1,0,0,0 +access_project_task,project.task.timesheet.user,model_project_task,hr_timesheet.group_hr_timesheet_user,1,1,0,0 \ No newline at end of file diff --git a/addons/hr_timesheet/views/hr_views.xml b/addons/hr_timesheet/views/hr_views.xml new file mode 100644 index 00000000000..82403ffd01e --- /dev/null +++ b/addons/hr_timesheet/views/hr_views.xml @@ -0,0 +1,58 @@ + + + + + Timesheets + account.analytic.line + + [('project_id', '!=', False)] + { + 'search_default_month':1, + 'search_default_employee_id': [active_id], + 'default_employee_id': active_id + } + + + + hr.employee.form.timesheet + hr.employee + + + + + + + + + + + + + + + hr.department.kanban.inherit + hr.department + + + + + + + + + + + + + diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 360643cdd04..5c8447344f8 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -86,8 +86,10 @@ class Project(models.Model): ]) def _compute_task_count(self): + task_data = self.env['project.task'].read_group([('project_id', 'in', self.ids), '|', ('stage_id.fold', '=', False), ('stage_id', '=', False)], ['project_id'], ['project_id']) + result = dict((data['project_id'][0], data['project_id_count']) for data in task_data) for project in self: - project.task_count = len(project.task_ids) + project.task_count = result.get(project.id, 0) def _compute_task_needaction_count(self): projects_data = self.env['project.task'].read_group([ diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index 8c7ee25578b..faff2856ec6 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -246,7 +246,6 @@ - @@ -291,12 +290,6 @@
- diff --git a/addons/project_issue/views/project_project_views.xml b/addons/project_issue/views/project_project_views.xml index b5169400bb3..4ea10a378c4 100644 --- a/addons/project_issue/views/project_project_views.xml +++ b/addons/project_issue/views/project_project_views.xml @@ -32,7 +32,7 @@ Issues
- +
diff --git a/addons/resource/data/resource_data.xml b/addons/resource/data/resource_data.xml index 08281205c56..81ccf1c1496 100644 --- a/addons/resource/data/resource_data.xml +++ b/addons/resource/data/resource_data.xml @@ -13,4 +13,44 @@ model="res.company" name="_init_data_resource_calendar" eval="[]"/> + + + + Standard 35 Hours/Week + + + + + + Standard 38 Hours/Week + + + + diff --git a/addons/sale/models/sale_config_settings.py b/addons/sale/models/sale_config_settings.py index 797bc4fc6af..13f997764ec 100644 --- a/addons/sale/models/sale_config_settings.py +++ b/addons/sale/models/sale_config_settings.py @@ -23,7 +23,7 @@ class SaleConfiguration(models.TransientModel): implied_group='product.group_uom') group_discount_per_so_line = fields.Boolean("Discounts", implied_group='sale.group_discount_per_so_line') group_stock_packaging = fields.Boolean("Packaging", implied_group='product.group_stock_packaging', - help="""Ability to select a package type in sales orders and + help="""Ability to select a package type in sales orders and to force a quantity that is a multiple of the number of units per package.""") module_sale_margin = fields.Boolean("Margins") group_sale_layout = fields.Boolean("Sections on Sales Orders", implied_group='sale.group_sale_layout') @@ -78,7 +78,7 @@ class SaleConfiguration(models.TransientModel): module_delivery_ups = fields.Boolean("UPS") module_delivery_usps = fields.Boolean("USPS") - module_timesheet_grid_sale = fields.Boolean("Timesheets") + module_sale_timesheet = fields.Boolean("Timesheets") module_sale_ebay = fields.Boolean("eBay") module_print_docsaway = fields.Boolean("Docsaway") module_web_clearbit = fields.Boolean("Customer Autocomplete") diff --git a/addons/sale/views/sale_config_settings_views.xml b/addons/sale/views/sale_config_settings_views.xml index 923a8928c40..4b4316df662 100644 --- a/addons/sale/views/sale_config_settings_views.xml +++ b/addons/sale/views/sale_config_settings_views.xml @@ -285,17 +285,17 @@

Timesheets

-
+
- +
-