From f9d25973d08c2bf27049d606efaee955cf7386ed Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 7 May 2015 13:52:21 +0200 Subject: [PATCH 1/2] [FIX] account: create statement from invoice line uses statement date instead of today's date Using statement date is necessary in order to select the appropriate currency rate. opw-634297 --- addons/account_voucher/wizard/account_statement_from_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py index 362cb516e7c..ba5243e420e 100644 --- a/addons/account_voucher/wizard/account_statement_from_invoice.py +++ b/addons/account_voucher/wizard/account_statement_from_invoice.py @@ -51,8 +51,8 @@ class account_statement_from_invoice_lines(osv.osv_memory): currency_obj = self.pool.get('res.currency') voucher_obj = self.pool.get('account.voucher') voucher_line_obj = self.pool.get('account.voucher.line') - line_date = time.strftime('%Y-%m-%d') statement = statement_obj.browse(cr, uid, statement_id, context=context) + line_date = statement.date # for each selected move lines for line in line_obj.browse(cr, uid, line_ids, context=context): From 6e23b2a8073b5ac1b7c74bf6bb98893d3983cea7 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 8 May 2015 10:17:44 +0200 Subject: [PATCH 2/2] [FIX] ir.model.data._update: create/modify XML IDs as super-user When importing a CSV file with an "id" column containing external IDs (XML IDs), the system automatically creates or updates the corresponding ir.model.data entries. This would fail for regular users who do not have create/write access on this internal model. --- openerp/addons/base/ir/ir_model.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index fb8e1db2fd5..69fd4db6380 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -954,13 +954,13 @@ class ir_model_data(osv.osv): if action_id and res_id: model_obj.write(cr, uid, [res_id], values, context=context) - self.write(cr, uid, [action_id], { + self.write(cr, SUPERUSER_ID, [action_id], { 'date_update': time.strftime('%Y-%m-%d %H:%M:%S'), },context=context) elif res_id: model_obj.write(cr, uid, [res_id], values, context=context) if xml_id: - self.create(cr, uid, { + self.create(cr, SUPERUSER_ID, { 'name': xml_id, 'model': model, 'module':module, @@ -971,7 +971,7 @@ class ir_model_data(osv.osv): for table in model_obj._inherits: inherit_id = model_obj.browse(cr, uid, res_id,context=context)[model_obj._inherits[table]] - self.create(cr, uid, { + self.create(cr, SUPERUSER_ID, { 'name': xml_id + '_' + table.replace('.', '_'), 'model': table, 'module': module, @@ -982,7 +982,7 @@ class ir_model_data(osv.osv): if mode=='init' or (mode=='update' and xml_id): res_id = model_obj.create(cr, uid, values, context=context) if xml_id: - self.create(cr, uid, { + self.create(cr, SUPERUSER_ID, { 'name': xml_id, 'model': model, 'module': module, @@ -993,7 +993,7 @@ class ir_model_data(osv.osv): for table in model_obj._inherits: inherit_id = model_obj.browse(cr, uid, res_id,context=context)[model_obj._inherits[table]] - self.create(cr, uid, { + self.create(cr, SUPERUSER_ID, { 'name': xml_id + '_' + table.replace('.', '_'), 'model': table, 'module': module,