From 30073a2e8ff9fdda3e2f4d68bbbe2bd78b427170 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 19 Mar 2013 11:20:08 +0100 Subject: [PATCH 01/26] [FIX] race condition in session directory creation try to create the directory and handle the possible exception instead of doing an unsafe 2 step check and creation. The issues related to the naming of the directory mentionned in the bug report are not handled. lp bug: https://launchpad.net/bugs/1157102 fixed bzr revid: alexandre.fayolle@camptocamp.com-20130319102008-omtaka8dtq9v7m1l --- addons/web/http.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/web/http.py b/addons/web/http.py index e05d74e0873..d12cdfb13a1 100644 --- a/addons/web/http.py +++ b/addons/web/http.py @@ -20,6 +20,7 @@ import traceback import urlparse import uuid import xmlrpclib +import errno import babel.core import simplejson @@ -477,8 +478,15 @@ def session_path(): except Exception: username = "unknown" path = os.path.join(tempfile.gettempdir(), "oe-sessions-" + username) - if not os.path.exists(path): + try: os.mkdir(path, 0700) + except OSError as exc: + if exc.errno == errno.EEXIST: + # directory exists: ensure it has the correct permissions + # this will fail if the directory is not owned by the current user + os.chmod(path, 0700) + else: + raise return path class Root(object): From 8548a69f73c03fdbfeb7fdb722b95ae38363b5b5 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 27 Mar 2013 11:38:33 +0100 Subject: [PATCH 02/26] [FIX] Timesheets invoiced as expenses are and correction removed in invoiced calculation bzr revid: jco@openerp.com-20130327103833-ekjzi3e0alkpod35 --- .../account_analytic_analysis.py | 23 +++++++++++++++---- .../account_analytic_analysis_view.xml | 4 ++-- .../analytic_contract_hr_expense.py | 2 -- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index a187f9452f5..17988294861 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -211,12 +211,10 @@ class account_analytic_account(osv.osv): JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ - AND account_analytic_journal.type = 'sale' \ - GROUP BY account_analytic_line.account_id", (child_ids,)) + AND account_analytic_journal.type = 'sale' \ + GROUP BY account_analytic_line.account_id", (child_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) - for acc in self.browse(cr, uid, res.keys(), context=context): - res[acc.id] = res[acc.id] - (acc.timesheet_ca_invoiced or 0.0) res_final = res return res_final @@ -543,6 +541,23 @@ class account_analytic_account(osv.osv): pass return result + + 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)] + names = [record.name for record in self.browse(cr, uid, ids, context=context)] + name = _('Timesheets to Invoice of %s') % ','.join(names) + return { + 'type': 'ir.actions.act_window', + 'name': name, + 'view_type': 'form', + 'view_mode': 'tree,form', + 'domain' : domain, + 'res_model': 'account.analytic.line', + 'nodestroy': True, + } + + + class account_analytic_account_summary_user(osv.osv): _name = "account_analytic_analysis.summary.user" _description = "Hours Summary by User" diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml index a9437267611..d82a1789b2b 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml @@ -98,8 +98,8 @@ -