[REF] account_asset: Converted simple wizard to osv_memory.

bzr revid: uco@tinyerp.com-20110829121522-o0ro0st0f1fgkmfy
This commit is contained in:
Ujjvala Collins (OpenERP)
2011-08-29 17:45:22 +05:30
parent 62ca286a40
commit 6da15e30bd
3 changed files with 54 additions and 31 deletions
+5 -4
View File
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# 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 <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -25,7 +25,7 @@
"depends" : ["account"],
"author" : "Tiny",
"description": """Financial and accounting asset management.
This Module manages the assets owned by a company or an individual. It will keep track of depreciation's occurred on
This Module manages the assets owned by a company or an individual. It will keep track of depreciation's occurred on
those assets. And it allows to create Move's of the depreciation lines.
""",
"website" : "http://www.openerp.com",
@@ -42,10 +42,11 @@
"account_asset_wizard.xml",
"wizard/account_asset_change_duration_view.xml",
"wizard/wizard_asset_compute_view.xml",
# "wizard/wizard_asset_close_view.xml",
"account_asset_view.xml",
"account_asset_invoice_view.xml",
"report/account_asset_report_view.xml",
],
"active": False,
"installable": True,
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
@@ -15,37 +15,25 @@
# 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 <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import pooler
from osv import osv, fields
asset_end_arch = '''<?xml version="1.0"?>
<form string="Close asset">
<separator string="General information" colspan="4"/>
</form>'''
class wizard_asset_close(osv.osv_memory):
_name = 'account.asset.close'
_description = 'Close Asset'
asset_end_fields = {
}
class wizard_asset_close(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':asset_end_arch, 'fields':asset_end_fields, 'state':[
('end','Cancel'),
('asset_close','End of asset')
]}
},
'asset_close': {
'actions': [],
'result': {'type' : 'state', 'state': 'end'}
}
}
wizard_asset_close('account.asset.close')
def asset_close(self, cr, uid, ids, context=None):
# TODO: Need to improve
# asset_obj = self.pool.get('account.asset.asset')
# asset_ids = context and context.get('active_ids') or []
# for asset in asset_obj.browse(cr, uid, asset_ids, context=context):
# if asset.state == 'open':
# asset_obj.set_to_close(cr, uid, asset.id, context=context)
return {'type': 'ir.actions.act_window_close'}
wizard_asset_close()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_asset_close" model="ir.ui.view">
<field name="name">account.asset.close.wizard</field>
<field name="model">account.asset.close</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Close Asset">
<separator string="Close Asset" colspan="4"/>
<label string="This wizard will close the asset(s)." colspan="4"/>
<separator string="" colspan="4"/>
<group colspan="4" col="6">
<label string="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-close" string="Close Asset" name="asset_close" type="object"/>
</group>
</form>
</field>
</record>
<!-- <act_window
id="act_asset_close"
res_model="account.asset.close"
src_model="account.asset.asset"
target="new"
name="Close Asset"
view_mode="form"
key2="client_action_multi"
/>-->
</data>
</openerp>