Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0][IMP] hr_timesheet_sheet: fix amount calculation issues + code simplification #211

Merged
merged 8 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions hr_timesheet_sheet/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ HR Timesheet Sheet
:target: https://runbot.odoo-community.org/runbot/117/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|

This module supplies a new screen enabling you to manage your work encoding (timesheet) by period.
Timesheet entries are made by employees each day. At the end of the defined period,
employees validate their sheet and the manager must then approve his team's entries.
Periods are defined in the company forms and you can set them to run monthly, weekly or daily.

Negative hours are not admitted.

**Table of contents**

.. contents::
Expand All @@ -57,9 +55,9 @@ If you want other default ranges different from weekly, you need to go:
Known issues / Roadmap
======================

* When you open the `Summary` or `Details` tab, a save should be performed
to ensure the data shown is correct. This perhaps could be achieved by including
a .js file that does that.
* When you change values on the `Summary` tab, a save should be performed
to ensure the data shown on the `Details` tab is correct. This limitation could be
perhaps avoided by including a .js file that aligns the `Details` tab.
* The timesheet grid is limited to display a max. of 1M cells, due to a
limitation of the tree view limit parameter not being able to dynamically
set a limit. Since default value of odoo, 40 records is too small, we decided
Expand Down
4 changes: 3 additions & 1 deletion hr_timesheet_sheet/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Copyright 2018 Eficent
# Copyright 2018-2019 Brainbean Apps
# Copyright 2018-2019 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'HR Timesheet Sheet',
'version': '12.0.1.0.7',
'version': '12.0.1.1.0',
'category': 'Human Resources',
'sequence': 80,
'summary': 'Timesheet Sheets, Activities',
'license': 'AGPL-3',
'author': (
'Eficent, '
'Onestein, '
'Odoo Community Association (OCA)'
),
'website': 'https://github.com/OCA/hr-timesheet',
Expand Down
4 changes: 2 additions & 2 deletions hr_timesheet_sheet/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _compute_sheet(self):
('date_start', '<=', timesheet.date),
('employee_id', '=', timesheet.employee_id.id),
('company_id', 'in', [timesheet.company_id.id, False]),
('state', '=', 'draft'),
('state', 'in', ['new', 'draft']),
], limit=1)
if timesheet.sheet_id != sheet:
timesheet.sheet_id = sheet
Expand Down Expand Up @@ -81,7 +81,7 @@ def _check_state(self):
if self.env.context.get('skip_check_state'):
return
for line in self:
if line.sheet_id and line.sheet_id.state != 'draft':
if line.sheet_id and line.sheet_id.state not in ['new', 'draft']:
raise UserError(
_('You cannot modify an entry in a confirmed '
'timesheet sheet.'))
Expand Down
5 changes: 3 additions & 2 deletions hr_timesheet_sheet/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ class HrEmployee(models.Model):

@api.multi
def _compute_timesheet_count(self):
Sheet = self.env['hr_timesheet.sheet']
for employee in self:
employee.timesheet_count = employee.env['hr_timesheet.sheet'].\
search_count([('employee_id', '=', employee.id)])
employee.timesheet_count = Sheet.search_count([
('employee_id', '=', employee.id)])

@api.constrains('company_id')
def _check_company_id(self):
Expand Down
Loading