[REF] account_asset: Corrected usability and indentation. Improvement: Latest history should come first in the list.
bzr revid: uco@tinyerp.com-20110627085142-5amjoke1d3jtkdz3
This commit is contained in:
parent
a3fc4b62b3
commit
0c4460a25f
|
@ -524,10 +524,12 @@ class account_asset_history(osv.osv):
|
|||
'method_end': fields.date('Ending date'),
|
||||
'note': fields.text('Note'),
|
||||
}
|
||||
_order = 'create_date desc'
|
||||
_defaults = {
|
||||
'date': lambda *args: time.strftime('%Y-%m-%d'),
|
||||
'user_id': lambda self,cr, uid,ctx: uid
|
||||
}
|
||||
|
||||
account_asset_history()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
from osv import osv,fields
|
||||
|
||||
class asset_modify(osv.osv_memory):
|
||||
|
@ -71,7 +72,7 @@ class asset_modify(osv.osv_memory):
|
|||
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, {
|
||||
history_vals = {
|
||||
'asset_id': asset_id,
|
||||
'name': asset.name,
|
||||
'method_delay': asset.method_delay,
|
||||
|
@ -80,13 +81,15 @@ class asset_modify(osv.osv_memory):
|
|||
'user_id': uid,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'note': data.note,
|
||||
}, context=context)
|
||||
asset_obj.write(cr, uid, [asset_id], {
|
||||
}
|
||||
history_obj.create(cr, uid, history_vals, context=context)
|
||||
asset_vals = {
|
||||
'name': data.name,
|
||||
'method_delay': data.method_delay,
|
||||
'method_period': data.method_period,
|
||||
'method_end': data.method_end,
|
||||
}, context=context)
|
||||
}
|
||||
asset_obj.write(cr, uid, [asset_id], asset_vals, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
asset_modify()
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="asset_modify_form">
|
||||
<field name="name">wizard.asset.modify.form</field>
|
||||
<field name="model">asset.modify</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Modify Asset">
|
||||
<group colspan="4" col="4">
|
||||
<separator string="Asset properties to modify" colspan="4"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="method_period"/>
|
||||
<group colspan="2" col="2">
|
||||
<field name="name">wizard.asset.modify.form</field>
|
||||
<field name="model">asset.modify</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Modify Asset">
|
||||
<group colspan="4" col="4">
|
||||
<separator string="Asset durations to modify" colspan="4"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="method_period"/>
|
||||
<group colspan="2" col="2">
|
||||
<field name="method_delay" attrs="{'invisible': [('method_end','!=',False)]}"/>
|
||||
<field name="method_end" attrs="{'invisible': [('method_delay','!=',0.0)]}"/>
|
||||
</group>
|
||||
<separator string="Notes" colspan="4"/>
|
||||
<field name="note" nolabel="1" colspan="4"/>
|
||||
<separator string="Notes" colspan="4"/>
|
||||
<field name="note" nolabel="1" colspan="4"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group colspan="4" col="4">
|
||||
|
@ -25,13 +25,13 @@
|
|||
<newline/>
|
||||
<group colspan="2" col="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="modify" string="Modify" type="object" icon="terp-check"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<button name="modify" string="Modify" type="object" icon="terp-camera_test"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_asset_modify" model="ir.actions.act_window">
|
||||
<record id="action_asset_modify" model="ir.actions.act_window">
|
||||
<field name="name">Modify Asset</field>
|
||||
<field name="res_model">asset.modify</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
@ -41,5 +41,5 @@
|
|||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue