From e45f9ebc55311458be6c664173fdac6e1ca81754 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Sun, 10 Jul 2011 02:53:57 +0200 Subject: [PATCH] [FIX] account_asset: change duration wizard bzr revid: qdp-launchpad@openerp.com-20110710005357-6rfi7xwvngcepwaw --- .../wizard/account_asset_change_duration.py | 15 ++++++++------- .../wizard/account_asset_change_duration_view.xml | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/account_asset/wizard/account_asset_change_duration.py b/addons/account_asset/wizard/account_asset_change_duration.py index 699f94a69f5..227f4e53229 100755 --- a/addons/account_asset/wizard/account_asset_change_duration.py +++ b/addons/account_asset/wizard/account_asset_change_duration.py @@ -29,7 +29,7 @@ class asset_modify(osv.osv_memory): _columns = { 'name': fields.char('Reason', size=64, required=True), - 'method_delay': fields.integer('Number of Depreciations'), + 'method_number': fields.integer('Number of Depreciations', required=True), 'method_period': fields.integer('Period Length'), 'method_end': fields.date('Ending date'), 'note': fields.text('Notes'), @@ -55,11 +55,11 @@ class asset_modify(osv.osv_memory): if active_model == 'account.asset.asset' and asset_id: asset = asset_obj.browse(cr, uid, asset_id, context=context) doc = etree.XML(result['arch']) - if asset.method_time == 'delay': + if asset.method_time == 'number': node = doc.xpath("//field[@name='method_end']")[0] node.set('invisible', '1') elif asset.method_time == 'end': - node = doc.xpath("//field[@name='method_delay']")[0] + node = doc.xpath("//field[@name='method_number']")[0] node.set('invisible', '1') result['arch'] = etree.tostring(doc) return result @@ -81,8 +81,8 @@ class asset_modify(osv.osv_memory): asset = asset_obj.browse(cr, uid, asset_id, context=context) if 'name' in fields: res.update({'name': asset.name}) - if 'method_delay' in fields and asset.method_time == 'delay': - res.update({'method_delay': asset.method_delay}) + if 'method_number' in fields and asset.method_time == 'number': + res.update({'method_number': asset.method_number}) if 'method_period' in fields: res.update({'method_period': asset.method_period}) if 'method_end' in fields and asset.method_time == 'end': @@ -110,7 +110,7 @@ class asset_modify(osv.osv_memory): 'asset_id': asset_id, 'name': data.name, 'method_time': asset.method_time, - 'method_delay': asset.method_delay, + 'method_number': asset.method_number, 'method_period': asset.method_period, 'method_end': asset.method_end, 'user_id': uid, @@ -119,11 +119,12 @@ class asset_modify(osv.osv_memory): } history_obj.create(cr, uid, history_vals, context=context) asset_vals = { - 'method_delay': data.method_delay, + 'method_number': data.method_number, 'method_period': data.method_period, 'method_end': data.method_end, } asset_obj.write(cr, uid, [asset_id], asset_vals, context=context) + asset_obj.compute_depreciation_board(cr, uid, [asset_id], context=context) return {'type': 'ir.actions.act_window_close'} asset_modify() diff --git a/addons/account_asset/wizard/account_asset_change_duration_view.xml b/addons/account_asset/wizard/account_asset_change_duration_view.xml index 34d0c419105..c8a9a02dc5b 100644 --- a/addons/account_asset/wizard/account_asset_change_duration_view.xml +++ b/addons/account_asset/wizard/account_asset_change_duration_view.xml @@ -12,7 +12,7 @@ - +