From 14183ba2be54a10247419f110f512cc6844a41b4 Mon Sep 17 00:00:00 2001 From: odoo-tac Date: Tue, 24 Feb 2015 16:52:20 +0100 Subject: [PATCH] [REF] Refactored hr_timesheet: Refactored the "timesheet" model in several modules. hr.analytic.timesheet is removed, and account.analytic.line is used directly to represent timesheets. Also removed worklogs on tasks and replaced them by generic timesheets, i.e. account.analytic.line(s) --- .../account_analytic_analysis.py | 2 +- .../account_analytic_analysis_view.xml | 10 +- .../analytic_account_demo.xml | 2 +- addons/analytic/models/analytic.py | 3 +- .../analytic_user_function.py | 163 ++++---- .../analytic_user_function_view.xml | 42 +- addons/hr_timesheet/__openerp__.py | 2 - addons/hr_timesheet/hr_timesheet.py | 299 ++++++------- addons/hr_timesheet/hr_timesheet_demo.xml | 15 +- addons/hr_timesheet/hr_timesheet_view.xml | 48 ++- .../report/hr_timesheet_report.py | 45 +- .../security/hr_timesheet_security.xml | 20 - .../hr_timesheet/security/ir.model.access.csv | 6 +- .../hr_timesheet/test/hr_timesheet_demo.yml | 11 - addons/hr_timesheet_invoice/__openerp__.py | 3 +- .../hr_timesheet_invoice.py | 94 ++--- .../hr_timesheet_invoice_view.xml | 177 +++----- .../test/test_hr_timesheet_invoice.yml | 2 +- .../test_hr_timesheet_invoice_no_prod_tax.yml | 2 +- .../hr_timesheet_sheet/hr_timesheet_sheet.py | 104 ++--- .../hr_timesheet_sheet_view.xml | 73 ++-- .../report/hr_timesheet_report.py | 8 +- .../security/ir.model.access.csv | 1 - .../static/src/js/timesheet.js | 12 +- .../security/ir.model.access.csv | 2 - addons/project/project.py | 220 ++-------- addons/project/project_view.xml | 80 +--- addons/project/report/project_report.py | 46 +- addons/project/res_config_view.xml | 2 +- addons/project/security/ir.model.access.csv | 1 - addons/project_issue/project_issue.py | 31 -- addons/project_issue/project_issue_view.xml | 2 - addons/project_issue_sheet/__openerp__.py | 1 + .../project_issue_sheet.py | 26 +- .../project_issue_sheet_view.xml | 42 +- .../security/ir.model.access.csv | 6 +- addons/project_timesheet/__init__.py | 1 + addons/project_timesheet/__openerp__.py | 7 +- addons/project_timesheet/project_timesheet.py | 393 +++++++----------- .../project_timesheet_view.xml | 95 ++++- addons/project_timesheet/report/__init__.py | 2 + .../report/project_report.py | 25 ++ .../report/project_report_view.xml | 19 + .../security/ir.model.access.csv | 1 - .../project_timesheet/test/work_timesheet.yml | 22 - .../worktask_entry_to_timesheetline_entry.yml | 20 +- 46 files changed, 915 insertions(+), 1273 deletions(-) delete mode 100644 addons/hr_timesheet/security/hr_timesheet_security.xml delete mode 100644 addons/hr_timesheet/test/hr_timesheet_demo.yml create mode 100644 addons/project_timesheet/report/__init__.py create mode 100644 addons/project_timesheet/report/project_report.py create mode 100644 addons/project_timesheet/report/project_report_view.xml delete mode 100644 addons/project_timesheet/test/work_timesheet.yml diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 49e1245c408..04b234d6df8 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -642,7 +642,7 @@ class account_analytic_account(osv.osv): return True def hr_to_invoice_timesheets(self, cr, uid, ids, context=None): - domain = [('invoice_id','=',False),('to_invoice','!=',False), ('journal_id.type', '=', 'general'), ('account_id', 'in', ids)] + domain = [('invoice_id','=',False),('to_invoice','!=',False), ('journal_id.type', '=', 'general'), ('account_id', 'in', ids), ('unit_amount', '>', 0)] names = [record.name for record in self.browse(cr, uid, ids, context=context)] name = _('Timesheets to Invoice of %s') % ','.join(names) return { diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml index c35dce559df..16bf45c1570 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml @@ -83,18 +83,18 @@ context="{'default_partner_id': [partner_id], 'search_default_project_id': [active_id],'default_project_id': [active_id], 'default_pricelist_id': pricelist_id}" /> - +