From f00e26b9ca52c3261c270a22d3fda6a38e786c30 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Thu, 4 Oct 2012 18:36:06 +0530 Subject: [PATCH 01/20] [FIX] weekly,monthly report problem in hr module bzr revid: shp@tinyerp.com-20121004130606-ju9ahpnk20qxeeyr --- addons/hr_attendance/report/attendance_by_month.py | 4 +++- addons/hr_attendance/report/timesheet.py | 2 +- addons/hr_attendance/wizard/hr_attendance_byweek.py | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/hr_attendance/report/attendance_by_month.py b/addons/hr_attendance/report/attendance_by_month.py index 17cf548345e..ab6ba3ce609 100644 --- a/addons/hr_attendance/report/attendance_by_month.py +++ b/addons/hr_attendance/report/attendance_by_month.py @@ -84,8 +84,10 @@ class report_custom(report_rml): # sum up the attendances' durations ldt = None for att in attendences: - dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') + dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') if ldt and att['action'] == 'sign_out': + if dt.date() > ldt.date(): + dt = ldt wh += (float((dt - ldt).seconds)/60/60) else: ldt = dt diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index 900f982dc74..fdb2569b4a2 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -38,7 +38,7 @@ class report_custom(report_rml): def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') - + ids = datas['active_ids'] start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d') end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d') first_monday = start_date - relativedelta(days=start_date.date().weekday()) diff --git a/addons/hr_attendance/wizard/hr_attendance_byweek.py b/addons/hr_attendance/wizard/hr_attendance_byweek.py index 9ee69a937d1..454ba7764da 100644 --- a/addons/hr_attendance/wizard/hr_attendance_byweek.py +++ b/addons/hr_attendance/wizard/hr_attendance_byweek.py @@ -37,6 +37,7 @@ class hr_attendance_byweek(osv.osv_memory): def print_report(self, cr, uid, ids, context=None): datas = { 'ids': [], + 'active_ids': context['active_ids'], 'model': 'hr.employee', 'form': self.read(cr, uid, ids)[0] } From 529b8c9e64c8bce4f628cbc89ef4b3cb5e5c6b9f Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Fri, 5 Oct 2012 12:25:08 +0530 Subject: [PATCH 02/20] [FIX] widget is undefined when press cost and revenus bzr revid: shp@tinyerp.com-20121005065508-4axokyk4llathg21 --- addons/account/project/project_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 70db95425b1..342663e700f 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -160,7 +160,7 @@ account.analytic.line.tree account.analytic.line - + From 12c0f14d3916dc79aa1d1a13521b2589f311bdb6 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Fri, 5 Oct 2012 14:12:13 +0530 Subject: [PATCH 03/20] [FIX] remove duplicate name when click sign in/out project bzr revid: shp@tinyerp.com-20121005084213-d4qkc25iyy5maq0m --- addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py index e92e88bdcbd..031a17baee0 100644 --- a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py +++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py @@ -147,7 +147,7 @@ class hr_si_project(osv.osv_memory): 'view_type': 'form', 'view_mode': 'tree,form', 'res_model': 'hr.sign.%s.project' % in_out, - 'views': [(False,'tree'), (resource_id,'form')], + 'views': [(resource_id,'form')], 'type': 'ir.actions.act_window', 'target': 'new' } From 6761871c4ea8427da90703d942f553b7334d6043 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Mon, 8 Oct 2012 10:40:14 +0530 Subject: [PATCH 04/20] [IMP] indentation of active ids of timesheet.py bzr revid: shp@tinyerp.com-20121008051014-fvftsi2mt44abyyn --- addons/hr_attendance/report/timesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index fdb2569b4a2..326ffce63e0 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -38,7 +38,7 @@ class report_custom(report_rml): def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') - ids = datas['active_ids'] + ids = datas['active_ids'] start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d') end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d') first_monday = start_date - relativedelta(days=start_date.date().weekday()) From 82138688a2d27337fc30d0143d00bd7275754e00 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Mon, 8 Oct 2012 21:16:47 +0530 Subject: [PATCH 05/20] [FIX]: Fix analytic line shown. bzr revid: atp@tinyerp.com-20121008154647-bdxw4ajq5hgb7jsk --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index cd58f52f959..76c6ac7ca35 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -468,7 +468,7 @@ class hr_timesheet_line(osv.osv): for ts_line in self.browse(cursor, user, ids, context=context): 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)], + ('employee_id.user_id', '=', ts_line.sheet_id and ts_line.sheet_id.employee_id.user_id.id)], context=context) if sheet_ids: # [0] because only one sheet possible for an employee between 2 dates From fbe1e7f913571f8dbbaddeceb5d877d09bc5f6df Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Tue, 9 Oct 2012 16:18:42 +0530 Subject: [PATCH 06/20] [FIX]: analytic account onchange problem. bzr revid: atp@tinyerp.com-20121009104842-njdr868dtc4ly1w9 --- addons/analytic_user_function/analytic_user_function.py | 2 +- addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 9233845f7eb..7ac947981fc 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -65,7 +65,7 @@ class hr_analytic_timesheet(osv.osv): return False - def on_change_account_id(self, cr, uid, ids, account_id, user_id=False, unit_amount=0): + def on_change_account_id(self, cr, uid, ids, account_id, user_id, unit_amount=0): res = {} if not (account_id): #avoid a useless call to super diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml index b752ade8da0..95fa39a6eda 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml @@ -50,7 +50,7 @@ - + @@ -72,7 +72,7 @@ - + From 28bc19896dbed07842923a43bc52ccc267014195 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Wed, 10 Oct 2012 10:54:49 +0530 Subject: [PATCH 07/20] [MERGE] merged with lp:openobject-addons bzr revid: shp@tinyerp.com-20121010052449-hvnp0e53d1sp6xs2 --- addons/analytic_user_function/analytic_user_function.py | 2 ++ addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 7ac947981fc..fdf8b7eb94a 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -65,6 +65,7 @@ class hr_analytic_timesheet(osv.osv): return False + def on_change_account_id(self, cr, uid, ids, account_id, user_id, unit_amount=0): res = {} if not (account_id): @@ -106,6 +107,7 @@ class hr_analytic_timesheet(osv.osv): return res def on_change_user_id(self, cr, uid, ids, user_id, account_id, unit_amount=0): + print "---------------onchageuser id",user_id res = {} if not (user_id): #avoid a useless call to super diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 097568a391d..383f837ac32 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -155,6 +155,7 @@ class hr_timesheet_sheet(osv.osv): return super(hr_timesheet_sheet, self).create(cr, uid, vals, *args, **argv) def write(self, cr, uid, ids, vals, *args, **argv): + print "------------vvvvvvvvvals",vals if 'employee_id' in vals: new_user_id = self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).user_id.id or False if not new_user_id: @@ -308,6 +309,7 @@ hr_timesheet_sheet() class hr_timesheet_line(osv.osv): _inherit = "hr.analytic.timesheet" + def _get_default_date(self, cr, uid, context=None): if context is None: context = {} @@ -404,6 +406,7 @@ class hr_attendance(osv.osv): return time.strftime('%Y-%m-%d %H:%M:%S') def _get_hr_timesheet_sheet(self, cr, uid, ids, context=None): + print "-----------get_hr_time sheet" attendance_ids = [] for ts in self.browse(cr, uid, ids, context=context): cr.execute(""" @@ -470,6 +473,7 @@ class hr_attendance(osv.osv): return super(hr_attendance,self).unlink(cr, uid, ids,*args, **kwargs) def write(self, cr, uid, ids, vals, context=None): + print "------------write " if context is None: context = {} if isinstance(ids, (int, long)): From e65a9208b8bf04b39b2a0499b5e1a3da3bccf50c Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Wed, 10 Oct 2012 14:39:13 +0530 Subject: [PATCH 08/20] [Fix] when click time sheet timesheet sheet analysis in reporting bzr revid: shp@tinyerp.com-20121010090913-lugvm9jwb43hdmmq --- addons/hr_timesheet_sheet/report/hr_timesheet_report.py | 4 ++-- addons/hr_timesheet_sheet/report/timesheet_report.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_sheet/report/hr_timesheet_report.py b/addons/hr_timesheet_sheet/report/hr_timesheet_report.py index 1fdcac9f7c6..bdb0ddbb116 100644 --- a/addons/hr_timesheet_sheet/report/hr_timesheet_report.py +++ b/addons/hr_timesheet_sheet/report/hr_timesheet_report.py @@ -54,8 +54,8 @@ class hr_timesheet_report(osv.osv): min(t.id) as id, l.date as date, to_char(l.date, 'YYYY-MM-DD') as day, - to_char(l.date,'YYYY') as year, - to_char(l.date,'MM') as month, + to_char(l.date, 'YYYY') as year, + to_char(l.date, 'MM') as month, sum(l.amount) as cost, sum(l.unit_amount) as quantity, l.account_id as account_id, diff --git a/addons/hr_timesheet_sheet/report/timesheet_report.py b/addons/hr_timesheet_sheet/report/timesheet_report.py index 497fe8da117..0b541f18b3f 100644 --- a/addons/hr_timesheet_sheet/report/timesheet_report.py +++ b/addons/hr_timesheet_sheet/report/timesheet_report.py @@ -46,6 +46,7 @@ class timesheet_report(osv.osv): 'department_id':fields.many2one('hr.department','Department',readonly=True), 'date_from': fields.date('Date from',readonly=True,), 'date_to': fields.date('Date to',readonly=True), + 'date_current': fields.date('Current date', required=True), 'state' : fields.selection([ ('new', 'New'), ('draft','Draft'), @@ -64,6 +65,9 @@ class timesheet_report(osv.osv): htss.name, htss.date_from, htss.date_to, + to_char(htss.date_from, 'YYYY-MM-DD') as day, + to_char(htss.date_from, 'YYYY') as year, + to_char(htss.date_from, 'MM') as month, count(*) as nbr, aal.unit_amount as quantity, aal.amount as cost, @@ -105,6 +109,7 @@ class timesheet_report(osv.osv): htss.id, htss.department_id, htss.user_id + ) """) timesheet_report() From 98eaf2c2bc96055d32f5f6d2fa54c2698d61efe6 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 16:04:50 +0530 Subject: [PATCH 09/20] [FIX]: Fix on_change_account_id() argument problem bzr revid: atp@tinyerp.com-20121010103450-n4gt4ikp05t6b8yu --- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 2 +- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 3 +-- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index b9574b553d1..d4950708294 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -174,7 +174,7 @@ account_analytic_line() class hr_analytic_timesheet(osv.osv): _inherit = "hr.analytic.timesheet" - def on_change_account_id(self, cr, uid, ids, account_id): + def on_change_account_id(self, cr, uid, ids, account_id, user_id): res = {} if not account_id: return res diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 383f837ac32..65ad4ce5905 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -155,7 +155,6 @@ class hr_timesheet_sheet(osv.osv): return super(hr_timesheet_sheet, self).create(cr, uid, vals, *args, **argv) def write(self, cr, uid, ids, vals, *args, **argv): - print "------------vvvvvvvvvals",vals if 'employee_id' in vals: new_user_id = self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).user_id.id or False if not new_user_id: @@ -390,7 +389,7 @@ class hr_timesheet_line(osv.osv): return True def multi_on_change_account_id(self, cr, uid, ids, account_ids, context=None): - return dict([(el, self.on_change_account_id(cr, uid, ids, el)) for el in account_ids]) + return dict([(el, self.on_change_account_id(cr, uid, ids, el, context.get('user_id', uid))) for el in account_ids]) hr_timesheet_line() diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 7dd2b9a1b88..28e886b779f 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -97,7 +97,7 @@ - + @@ -110,7 +110,7 @@
- + From eb20086d59b5dc06df721b774e50de326a646e4f Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 16:41:51 +0530 Subject: [PATCH 10/20] [REM]: Remove print statement bzr revid: atp@tinyerp.com-20121010111151-cgylp0roe61vhzs9 --- addons/analytic_user_function/analytic_user_function.py | 1 - addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index fdf8b7eb94a..7e4d00ef095 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -107,7 +107,6 @@ class hr_analytic_timesheet(osv.osv): return res def on_change_user_id(self, cr, uid, ids, user_id, account_id, unit_amount=0): - print "---------------onchageuser id",user_id res = {} if not (user_id): #avoid a useless call to super diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 65ad4ce5905..0fb98e142ec 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -405,7 +405,6 @@ class hr_attendance(osv.osv): return time.strftime('%Y-%m-%d %H:%M:%S') def _get_hr_timesheet_sheet(self, cr, uid, ids, context=None): - print "-----------get_hr_time sheet" attendance_ids = [] for ts in self.browse(cr, uid, ids, context=context): cr.execute(""" @@ -472,7 +471,6 @@ class hr_attendance(osv.osv): return super(hr_attendance,self).unlink(cr, uid, ids,*args, **kwargs) def write(self, cr, uid, ids, vals, context=None): - print "------------write " if context is None: context = {} if isinstance(ids, (int, long)): From f935c9e4823ddf126369359b4eb720bac5505df7 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 18:17:16 +0530 Subject: [PATCH 11/20] [FIX]: get sheet id using timesheet line user id bzr revid: atp@tinyerp.com-20121010124716-hdaebwpsowpowhl7 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 0fb98e142ec..32fbf978175 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -322,7 +322,7 @@ class hr_timesheet_line(osv.osv): for ts_line in self.browse(cursor, user, ids, context=context): sheet_ids = sheet_obj.search(cursor, user, [('date_to', '>=', ts_line.date), ('date_from', '<=', ts_line.date), - ('employee_id.user_id', '=', ts_line.sheet_id and ts_line.sheet_id.employee_id.user_id.id)], + ('employee_id.user_id', '=', ts_line.user_id.id)], context=context) if sheet_ids: # [0] because only one sheet possible for an employee between 2 dates From e2a28b011ad70ad3cfb1c8d4ba6c65ac5df89201 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 20:38:49 +0530 Subject: [PATCH 12/20] [FIX]: Fix on_change_analytic_id problem bzr revid: atp@tinyerp.com-20121010150849-u4cldadvfjzmw8mj --- addons/analytic_user_function/analytic_user_function.py | 2 +- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 2 +- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 7e4d00ef095..9c84b75b293 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -66,7 +66,7 @@ class hr_analytic_timesheet(osv.osv): - def on_change_account_id(self, cr, uid, ids, account_id, user_id, unit_amount=0): + def on_change_account_id(self, cr, uid, ids, account_id, user_id=False, unit_amount=0): res = {} if not (account_id): #avoid a useless call to super diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index d4950708294..b9574b553d1 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -174,7 +174,7 @@ account_analytic_line() class hr_analytic_timesheet(osv.osv): _inherit = "hr.analytic.timesheet" - def on_change_account_id(self, cr, uid, ids, account_id, user_id): + def on_change_account_id(self, cr, uid, ids, account_id): res = {} if not account_id: return res diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 32fbf978175..bec3c641776 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -389,7 +389,7 @@ class hr_timesheet_line(osv.osv): return True def multi_on_change_account_id(self, cr, uid, ids, account_ids, context=None): - return dict([(el, self.on_change_account_id(cr, uid, ids, el, context.get('user_id', uid))) for el in account_ids]) + return dict([(el, self.on_change_account_id(cr, uid, ids, el)) for el in account_ids]) hr_timesheet_line() diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 28e886b779f..7dd2b9a1b88 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -97,7 +97,7 @@ - + @@ -110,7 +110,7 @@ - + From 23a0926efd757cd7850d619a63b02d8c0c4c874a Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 20:52:58 +0530 Subject: [PATCH 13/20] [FIX]: Fix for analytic account in hr timesheet sheet line. bzr revid: atp@tinyerp.com-20121010152258-997mxrukpjeawcpb --- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 7dd2b9a1b88..28e886b779f 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -97,7 +97,7 @@ - + @@ -110,7 +110,7 @@ - + From b27b12db1ba97ee029ced20436fd31547501aa51 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 11 Oct 2012 17:42:01 +0530 Subject: [PATCH 14/20] [FIX]: Fix onchange account id problem bzr revid: atp@tinyerp.com-20121011121201-h6030emuz00t55nv --- addons/hr_timesheet/hr_timesheet.py | 2 +- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 2 +- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index a28508be4db..cd0f873ccfd 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -154,7 +154,7 @@ class hr_analytic_timesheet(osv.osv): 'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(self,cr,uid,context=ctx)), 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', uid), } - def on_change_account_id(self, cr, uid, ids, account_id): + def on_change_account_id(self, cr, uid, ids, account_id, user_id): return {'value':{}} def on_change_date(self, cr, uid, ids, date): diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index b9574b553d1..d4950708294 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -174,7 +174,7 @@ account_analytic_line() class hr_analytic_timesheet(osv.osv): _inherit = "hr.analytic.timesheet" - def on_change_account_id(self, cr, uid, ids, account_id): + def on_change_account_id(self, cr, uid, ids, account_id, user_id): res = {} if not account_id: return res diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index bec3c641776..887ce15a741 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -389,7 +389,7 @@ class hr_timesheet_line(osv.osv): return True def multi_on_change_account_id(self, cr, uid, ids, account_ids, context=None): - return dict([(el, self.on_change_account_id(cr, uid, ids, el)) for el in account_ids]) + return dict([(el, self.on_change_account_id(cr, uid, ids, el, context.get('user_id', False) or uid)) for el in account_ids]) hr_timesheet_line() From de0023a14f723f21edbd8a2d41d4a4b7e458392e Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 11 Oct 2012 18:04:41 +0530 Subject: [PATCH 15/20] [FIX]: Fix default user timesheetline problem bzr revid: atp@tinyerp.com-20121011123441-5zg1nm394d0b45ky --- addons/hr_timesheet/hr_timesheet.py | 4 ++-- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index cd0f873ccfd..7934b8e5be1 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -136,7 +136,7 @@ class hr_analytic_timesheet(osv.osv): emp_obj = self.pool.get('hr.employee') if context is None: context = {} - emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context) + emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', False) or uid)], context=context) if not emp_id : raise osv.except_osv(_('Warning!'), _('Please create an employee for this user, using the menu: Human Resources > Employees.')) emp = emp_obj.browse(cr, uid, emp_id[0], context=context) @@ -152,7 +152,7 @@ class hr_analytic_timesheet(osv.osv): 'general_account_id': _getGeneralAccount, 'journal_id': _getAnalyticJournal, 'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(self,cr,uid,context=ctx)), - 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', uid), + 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', False) or uid, } def on_change_account_id(self, cr, uid, ids, account_id, user_id): return {'value':{}} diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 28e886b779f..c96d256b7e2 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -106,7 +106,7 @@ - + From 87e89592056f5290f64c28fdfe72dc9b1aa93fb6 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 11 Oct 2012 23:11:26 +0530 Subject: [PATCH 16/20] [FIX] bzr revid: atp@tinyerp.com-20121011174126-lii90i9fnfhfsy9v --- addons/hr_timesheet/hr_timesheet.py | 2 +- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 7934b8e5be1..0345ca6c06b 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -154,7 +154,7 @@ class hr_analytic_timesheet(osv.osv): 'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(self,cr,uid,context=ctx)), 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', False) or uid, } - def on_change_account_id(self, cr, uid, ids, account_id, user_id): + def on_change_account_id(self, cr, uid, ids, account_id): return {'value':{}} def on_change_date(self, cr, uid, ids, date): diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index f7a490c4604..30e4ff40885 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -176,7 +176,7 @@ account_analytic_line() class hr_analytic_timesheet(osv.osv): _inherit = "hr.analytic.timesheet" - def on_change_account_id(self, cr, uid, ids, account_id, user_id): + def on_change_account_id(self, cr, uid, ids, account_id, user_id=False): res = {} if not account_id: return res From e0424795b65af18577c0e6e6434dbcda0424cc98 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Thu, 18 Oct 2012 17:09:49 +0530 Subject: [PATCH 17/20] [IMP] warning message and fix tracback bzr revid: shp@tinyerp.com-20121018113949-wcgkj455rwd81z3h --- addons/hr_attendance/hr_attendance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 1bfe04b3e82..baebf28f1ad 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -149,7 +149,7 @@ class hr_employee(osv.osv): if context is None: context = {} action_date = context.get('action_date', False) - action = context.get('action') + action = context.get('action',False) hr_attendance = self.pool.get('hr.attendance') warning_sign = {'sign_in': _('Sign In'), 'sign_out': _('Sign Out')} for employee in self.browse(cr, uid, ids, context=context): @@ -158,7 +158,7 @@ class hr_employee(osv.osv): if employee.state == 'absent': action = 'sign_in' if not self._action_check(cr, uid, employee.id, action_date, context): - raise osv.except_osv(_('Warning'), _('You are trying to %s for a date that is posterior to the starting date of the project. Please contact the HR Manager to correct attendances.')%(context.get('action'),)) + raise osv.except_osv(_('Warning'), _('You are trying to %s for a date that is posterior to the starting date of the project. Please contact the HR Manager to correct attendances.')%(action),) vals = {'action': action, 'employee_id': employee.id} if action_date: From 5cf77ecb5af36662b13bbf1d55304b0a711ee10e Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Thu, 18 Oct 2012 18:34:44 +0530 Subject: [PATCH 18/20] [IMP] improve action message as per suggection bzr revid: shp@tinyerp.com-20121018130444-bu8iv6kez1xt1js1 --- addons/hr_attendance/hr_attendance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index baebf28f1ad..38364f478e7 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -158,7 +158,10 @@ class hr_employee(osv.osv): if employee.state == 'absent': action = 'sign_in' if not self._action_check(cr, uid, employee.id, action_date, context): - raise osv.except_osv(_('Warning'), _('You are trying to %s for a date that is posterior to the starting date of the project. Please contact the HR Manager to correct attendances.')%(action),) + if action == 'sign_out': + raise osv.except_osv(_('Warning'), _('You are trying to sign out for a date that is posterior to the starting date of the project. Please contact the HR Manager to correct attendances.')) + elif action == 'action': + raise osv.except_osv(_('Warning'), _('You are trying to sign out and switch project for a date that is posterior to the starting date of the current project. Please contact the HR Manager to correct attendances.')) vals = {'action': action, 'employee_id': employee.id} if action_date: From 1bb1b98a31dbbf6a67c2f3f15704fc7e18bad2bf Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Fri, 19 Oct 2012 10:27:23 +0530 Subject: [PATCH 19/20] [IMP] warning message replace is posterior to by comes before bzr revid: shp@tinyerp.com-20121019045723-rt8fqmuk11vsgiak --- addons/hr_attendance/hr_attendance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 38364f478e7..49fd35c255b 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -159,9 +159,9 @@ class hr_employee(osv.osv): if not self._action_check(cr, uid, employee.id, action_date, context): if action == 'sign_out': - raise osv.except_osv(_('Warning'), _('You are trying to sign out for a date that is posterior to the starting date of the project. Please contact the HR Manager to correct attendances.')) + raise osv.except_osv(_('Warning'), _('You are trying to sign out for a date that comes before the starting date of the project. Please contact the HR Manager to correct attendances.')) elif action == 'action': - raise osv.except_osv(_('Warning'), _('You are trying to sign out and switch project for a date that is posterior to the starting date of the current project. Please contact the HR Manager to correct attendances.')) + raise osv.except_osv(_('Warning'), _('You are trying to sign out and switch project for a date that comes before the starting date of the current project. Please contact the HR Manager to correct attendances.')) vals = {'action': action, 'employee_id': employee.id} if action_date: From a098bdc7f163ab8dc7a3c8810c30a33820edca0e Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Fri, 19 Oct 2012 10:36:21 +0530 Subject: [PATCH 20/20] [IMP] improve condition bzr revid: shp@tinyerp.com-20121019050621-kz81td0dsdt4681o --- addons/hr_attendance/hr_attendance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 49fd35c255b..79b4ad64662 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -160,7 +160,7 @@ class hr_employee(osv.osv): if not self._action_check(cr, uid, employee.id, action_date, context): if action == 'sign_out': raise osv.except_osv(_('Warning'), _('You are trying to sign out for a date that comes before the starting date of the project. Please contact the HR Manager to correct attendances.')) - elif action == 'action': + if action == 'action': raise osv.except_osv(_('Warning'), _('You are trying to sign out and switch project for a date that comes before the starting date of the current project. Please contact the HR Manager to correct attendances.')) vals = {'action': action, 'employee_id': employee.id}