diff options
| author | atp (Open ERP) <atp@tinyerp.co.in> | 2010-06-22 10:45:44 +0530 |
|---|---|---|
| committer | atp (Open ERP) <atp@tinyerp.co.in> | 2010-06-22 10:45:44 +0530 |
| commit | b0efd26edd9f4e2aa75424b787ea46d2be15cd04 (patch) | |
| tree | e78cdb693e62a5c9a17f77a395eec51fb34becbf /addons/project_timesheet | |
| parent | 46bb1ea51be702758d68a5f69db32c82dbccf9bd (diff) | |
| parent | 2319190c5a20cb8095f85cacca89a33164ba93d7 (diff) | |
[MERGE]: merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: atp@tinyerp.co.in-20100622051544-c7hig73zk2at66cy
Diffstat (limited to 'addons/project_timesheet')
6 files changed, 113 insertions, 7 deletions
diff --git a/addons/project_timesheet/__openerp__.py b/addons/project_timesheet/__openerp__.py index f98a796a935..d87bb7eb2fc 100644 --- a/addons/project_timesheet/__openerp__.py +++ b/addons/project_timesheet/__openerp__.py @@ -35,6 +35,9 @@ 'init_xml': [], 'update_xml': ["process/project_timesheet_process.xml", "report/task_report_view.xml"], 'demo_xml': [], + 'test': [ + 'test/worktask_entry_to_timesheetline_entry.yml', + ], 'installable': True, 'active': False, 'certificate': '0075123647453', diff --git a/addons/project_timesheet/process/project_timesheet_process.xml b/addons/project_timesheet/process/project_timesheet_process.xml index d6ca5cde8bc..bfabe6ba5ad 100644 --- a/addons/project_timesheet/process/project_timesheet_process.xml +++ b/addons/project_timesheet/process/project_timesheet_process.xml @@ -28,7 +28,7 @@ </record> <record id="process_node_triggerinvoice0" model="process.node"> - <field name="menu_id" ref="account.menu_finance_invoice"/> + <field name="menu_id" ref="account.menu_finance_receivables"/> <field name="model_id" ref="account.model_account_invoice"/> <field eval=""""subflow"""" name="kind"/> <field eval=""""Trigger Invoice"""" name="name"/> diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index f332067b88f..44e9048f253 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -88,7 +88,7 @@ class project_work(osv.osv): prod_id, amount, unit, context=kwargs['context']) vals_line['amount'] = (-1) * vals['hours']* (amount_unit['value']['amount'] or 0.0) - obj_timesheet.write(cr, uid,[timeline_id], vals_line, {}) + obj_timesheet.write(cr, uid, [timeline_id], vals_line, {}) vals['hr_analytic_timesheet_id'] = timeline_id return super(project_work,self).create(cr, uid, vals, *args, **kwargs) diff --git a/addons/project_timesheet/report/task_report.py b/addons/project_timesheet/report/task_report.py index c8ef453666f..1e1a165b169 100644 --- a/addons/project_timesheet/report/task_report.py +++ b/addons/project_timesheet/report/task_report.py @@ -95,8 +95,8 @@ class report_timesheet_task_user(osv.osv): for record in self.browse(cr, uid, ids,context): last_date = mx.DateTime.strptime(record.name, '%Y-%m-%d') + mx.DateTime.RelativeDateTime(months=1) - 1 task_obj=self.pool.get('project.task.work') - task_ids = task_obj.search(cr,uid,[('user_id','=',record.user_id.id),('date','>=',record.name),('date','<=',last_date.strftime('%Y-%m-%d'))]) - tsk_hrs = task_obj.read(cr,uid,task_ids,['hours','date','user_id']) + task_ids = task_obj.search(cr, uid, [('user_id','=',record.user_id.id),('date','>=',record.name),('date','<=',last_date.strftime('%Y-%m-%d'))]) + tsk_hrs = task_obj.read(cr, uid, task_ids, ['hours','date','user_id']) total = 0.0 for hrs in tsk_hrs: total += hrs['hours'] @@ -109,8 +109,8 @@ class report_timesheet_task_user(osv.osv): for record in self.browse(cr, uid, ids, context): last_date = mx.DateTime.strptime(record.name, '%Y-%m-%d') + mx.DateTime.RelativeDateTime(months=1) - 1 obj=self.pool.get('hr_timesheet_sheet.sheet.day') - sheet_ids = obj.search(cr,uid,[('sheet_id.user_id','=',record.user_id.id),('name','>=',record.name),('name','<=',last_date.strftime('%Y-%m-%d'))]) - data_days = obj.read(cr,uid,sheet_ids,['name','sheet_id.user_id','total_attendance']) + sheet_ids = obj.search(cr, uid, [('sheet_id.user_id','=',record.user_id.id),('name','>=',record.name),('name','<=',last_date.strftime('%Y-%m-%d'))]) + data_days = obj.read(cr, uid, sheet_ids, ['name','sheet_id.user_id','total_attendance']) total = 0.0 for day_attendance in data_days: total += day_attendance['total_attendance'] diff --git a/addons/project_timesheet/report/task_report_view.xml b/addons/project_timesheet/report/task_report_view.xml index 5a653985a20..5886d5351dd 100644 --- a/addons/project_timesheet/report/task_report_view.xml +++ b/addons/project_timesheet/report/task_report_view.xml @@ -170,7 +170,8 @@ <field name="context">{"search_default_user_id":uid}</field> <field name="search_view_id" ref="view_report_timesheet_task_user_search"/> </record> - <menuitem id="menu_timesheet_task_user" parent="hr.menu_hr_reporting" action="action_report_timesheet_task_user"/> + <menuitem id="menu_timesheet_task_user" parent="hr.menu_hr_reporting" + action="action_report_timesheet_task_user" sequence="4"/> </data> </openerp> diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml new file mode 100644 index 00000000000..7e275067673 --- /dev/null +++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml @@ -0,0 +1,102 @@ +- + Create an user 'HR Manager' +- + !record {model: res.users, id: res_users_hrmanager0}: + company_id: base.main_company + context_lang: en_US + login: hr + name: HR Manager + password: hr + +- + Create a product with type service used to specifies employees designation +- + !record {model: product.product, id: product_product_hrmanger0}: + categ_id: product.product_category_services + cost_method: standard + mes_type: fixed + name: HR Manger + procure_method: make_to_stock + standard_price: 1.0 + supply_method: buy + type: service + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit + volume: 0.0 + warranty: 0.0 + weight: 0.0 + weight_net: 0.0 + +- + Create an analytic journal for employees timesheet +- + !record {model: account.analytic.journal, id: account_analytic_journal_hrtimesheet0}: + company_id: base.main_company + name: HR Timesheet + type: general + +- + Create an employee 'HR Manager' for user 'HR Manager' +- + !record {model: hr.employee, id: hr_employee_hrmanager0}: + name: HR Manager + user_id: res_users_hrmanager0 + product_id: product_product_hrmanger0 + journal_id: account_analytic_journal_hrtimesheet0 + +- + Create a timesheet sheet for hr manager +- + !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0}: + date_current: '2010-06-03' + date_from: '2010-06-01' + date_to: '2010-06-30' + name: Sheet for hr manager + state: new + user_id: res_users_hrmanager0 + +- + Create a project 'Timesheet Management' +- + !record {model: project.project, id: project_project_timesheetmanagement0}: + company_id: base.main_company + name: Timesheet Management + + +- + Create a task 'Get all timesheet records' +- + !record {model: project.task, id: project_task_getalltimesheetrecords0}: + date_start: '2010-06-03 14:54:55' + name: Get all timesheet records + planned_hours: 20.0 + project_id: project_project_timesheetmanagement0 + remaining_hours: 20.0 + state: draft + user_id: res_users_hrmanager0 + +- + Open the task +- + !python {model: project.task}: | + self.do_open(cr, uid, [ref("project_task_getalltimesheetrecords0")], {"lang": + "en_US", "active_ids": [ref("project_project_timesheetmanagement0")], "tz": + False, "active_model": "project.project", "department_id": False, "project_id": + False, "active_id": ref("project_project_timesheetmanagement0"), }) + +- + Make a work task entry 'Get work calendar of all employees' of 10 hours done by hr manager +- + !record {model: project.task, id: project_task_getalltimesheetrecords0}: + work_ids: + - date: '2010-06-03 15:04:47' + hours: 10.0 + hr_analytic_timesheet_id: 3L + name: Get work calendar of all employees + user_id: res_users_hrmanager0 + +- + Check for timesheet_ids in hr manager's timesheet +- + !assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0, string: After hr manager's work task, length of timesheet line of current timesheet must be greater then 1}: + - len(timesheet_ids) > 0
\ No newline at end of file |
