diff --git a/addons/account_asset/__openerp__.py b/addons/account_asset/__openerp__.py
index be631a91e45..c922c6c6715 100755
--- a/addons/account_asset/__openerp__.py
+++ b/addons/account_asset/__openerp__.py
@@ -39,9 +39,10 @@
"update_xml" : [
"security/ir.model.access.csv",
"account_asset_wizard.xml",
+ "wizard/account_asset_change_duration_view.xml",
"account_asset_view.xml",
"account_asset_invoice_view.xml",
- "account_asset_report_view.xml",
+ "account_asset_report_view.xml",
"report/account_asset_report_view.xml",
#modif
],
diff --git a/addons/account_asset/account_asset_view.xml b/addons/account_asset/account_asset_view.xml
index 229cff87c26..faebfbddf78 100644
--- a/addons/account_asset/account_asset_view.xml
+++ b/addons/account_asset/account_asset_view.xml
@@ -78,17 +78,18 @@
-
-
-
+
+
+
diff --git a/addons/account_asset/wizard/__init__.py b/addons/account_asset/wizard/__init__.py
index ab4a7159322..0d2ce9879ad 100755
--- a/addons/account_asset/wizard/__init__.py
+++ b/addons/account_asset/wizard/__init__.py
@@ -18,9 +18,9 @@
# along with this program. If not, see .
#
##############################################################################
-
+import account_asset_change_duration
import wizard_asset_compute
import wizard_asset_close
-import wizard_asset_modify
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_asset/wizard/account_asset_change_duration.py b/addons/account_asset/wizard/account_asset_change_duration.py
new file mode 100755
index 00000000000..fcca6181e55
--- /dev/null
+++ b/addons/account_asset/wizard/account_asset_change_duration.py
@@ -0,0 +1,77 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import time
+from osv import osv,fields
+
+class asset_modify(osv.osv_memory):
+ _name = 'asset.modify'
+ _description = 'Modify Asset'
+
+ _columns = {
+ 'name': fields.char('Reason', size=64, required=True),
+ 'method_delay': fields.float('Number of interval'),
+ 'method_period': fields.float('Period per interval'),
+ 'method_end': fields.date('Ending date'),
+ 'note': fields.text('Notes'),
+ }
+
+ def default_get(self, cr, uid, fields, context=None):
+ asset_obj = self.pool.get('account.asset.asset')
+ res = super(asset_modify, self).default_get(cr, uid, fields, context=context)
+ asset_id = context.get('active_id', False)
+ 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_period' in fields:
+ res.update({'method_period': asset.method_period})
+ if 'method_end' in fields and asset.method_time == 'end':
+ res.update({'method_end': asset.method_end})
+ return res
+
+ def modify(self, cr, uid, ids, context=None):
+ asset_obj = self.pool.get('account.asset.asset')
+ history_obj = self.pool.get('account.asset.history')
+ asset_id = context.get('active_id', False)
+ asset = asset_obj.browse(cr, uid, asset_id, context=context)
+ data = self.browse(cr, uid, ids[0], context=context)
+ history_obj.create(cr, uid, {
+ 'asset_id': asset_id,
+ 'name': asset.name,
+ 'method_delay': asset.method_delay,
+ 'method_period': asset.method_period,
+ 'method_end': asset.method_end,
+ 'user_id': uid,
+ 'date': time.strftime('%Y-%m-%d'),
+ 'note': data.note,
+ }, context=context)
+ asset_obj.write(cr, uid, [asset_id], {
+ 'name': data.name,
+ 'method_delay': data.method_delay,
+ 'method_period': data.method_period,
+ 'method_end': data.method_end,
+ }, context=context)
+ return {'type': 'ir.actions.act_window_close'}
+
+asset_modify()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_asset/wizard/account_asset_change_duration_view.xml b/addons/account_asset/wizard/account_asset_change_duration_view.xml
new file mode 100644
index 00000000000..be536b8242f
--- /dev/null
+++ b/addons/account_asset/wizard/account_asset_change_duration_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ wizard.asset.modify.form
+ asset.modify
+ form
+
+
+
+
+
+
+ Modify Asset
+ asset.modify
+ ir.actions.act_window
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/account_asset/wizard/wizard_asset_modify.py b/addons/account_asset/wizard/wizard_asset_modify.py
deleted file mode 100755
index 586a278b21a..00000000000
--- a/addons/account_asset/wizard/wizard_asset_modify.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import wizard
-import pooler
-
-asset_end_arch = '''
-'''
-
-asset_end_fields = {
- 'name': {'string':'Reason', 'type':'char', 'size':64, 'required':True},
- 'method_delay': {'string':'Number of interval', 'type':'float'},
- 'method_period': {'string':'Period per interval', 'type':'float'},
- 'note': {'string':'Notes', 'type':'text'},
-}
-
-def _asset_default(self, cr, uid, data, context={}):
- pool = pooler.get_pool(cr.dbname)
- prop = pool.get('account.asset.property').browse(cr, uid, data['id'], context)
- return {
- 'name': prop.name,
- 'method_delay': prop.method_delay,
- 'method_period': prop.method_period
- }
-
-def _asset_modif(self, cr, uid, data, context={}):
- pool = pooler.get_pool(cr.dbname)
- prop = pool.get('account.asset.property').browse(cr, uid, data['id'], context)
- pool.get('account.asset.property.history').create(cr, uid, {
- 'asset_property_id': data['id'],
- 'name': prop.name,
- 'method_delay': prop.method_delay,
- 'method_period': prop.method_period,
- 'note': data['form']['note'],
- }, context)
- pool.get('account.asset.property').write(cr, uid, [data['id']], {
- 'name': data['form']['name'],
- 'method_delay': data['form']['method_delay'],
- 'method_period': data['form']['method_period'],
- }, context)
- return {}
-
-
-class wizard_asset_modify(wizard.interface):
- states = {
- 'init': {
- 'actions': [_asset_default],
- 'result': {'type':'form', 'arch':asset_end_arch, 'fields':asset_end_fields, 'state':[
- ('end','Cancel'),
- ('asset_modify','Modify asset')
- ]}
- },
- 'asset_modify': {
- 'actions': [_asset_modif],
- 'result': {'type' : 'state', 'state': 'end'}
- }
- }
-wizard_asset_modify('account.asset.modify')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-