[FIX] hr_timesheet_sheet: link account line and sheet

When an expense is recorded and linked to an analytic account, the
associated line will appear in the timesheet.

This fix links prevents linking an account analytic line to a timesheet
sheet if the line is not a timesheet.

Somehow related to a4b6e3a8

opw-657917
This commit is contained in:
Nicolas Martinelli
2015-12-22 14:57:47 +01:00
parent 3e2369fbb6
commit fd8e9da7e3
2 changed files with 4 additions and 0 deletions
@@ -297,6 +297,8 @@ class account_analytic_line(osv.osv):
sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
res = {}.fromkeys(ids, False)
for ts_line in self.browse(cursor, user, ids, context=context):
if not ts_line.is_timesheet:
continue
sheet_ids = sheet_obj.search(cursor, user,
[('date_to', '>=', ts_line.date), ('date_from', '<=', ts_line.date),
('employee_id.user_id', '=', ts_line.user_id.id),
@@ -47,6 +47,7 @@
amount: -90.00
product_id: product.product_product_1
general_account_id: a_expense
is_timesheet: !eval True
-
I confirm my Timesheet at end of period by click on "Confirm" button,
if the difference between Timesheet hour and attendance hour is more than 1 hour it will give message.
@@ -75,6 +76,7 @@
amount: -90.00
product_id: product.product_product_1
general_account_id: a_expense
is_timesheet: !eval True
-
I set an allowed difference of 1 hour
-