2
0

[IMP] account_asset_management: use reload_on_button instead of reloading page

This commit is contained in:
Stéphane Bidoul 2015-04-23 12:06:10 +02:00 committed by Rodrigo
parent 193f56c6ae
commit e9bbf96a9a
2 changed files with 1 additions and 15 deletions

View File

@ -1552,12 +1552,6 @@ class account_asset_depreciation_line(orm.Model):
return super(account_asset_depreciation_line, self).write(
cr, uid, ids, vals, context)
def reload_page(self, cr, uid, asset_id, context=None):
return {
'type': 'ir.actions.client',
'tag': 'reload',
}
def _setup_move_data(self, depreciation_line, depreciation_date,
period_id, context):
asset = depreciation_line.asset_id
@ -1643,8 +1637,6 @@ class account_asset_depreciation_line(orm.Model):
if currency_obj.is_zero(cr, uid, asset.company_id.currency_id,
asset.value_residual):
asset.write({'state': 'close'})
if len(ids) == 1 and context.get('create_move_from_button'):
return self.reload_page(cr, uid, asset.id, context)
return created_move_ids
def open_move(self, cr, uid, ids, context=None):
@ -1675,14 +1667,9 @@ class account_asset_depreciation_line(orm.Model):
self.write(cr, uid, [line.id], {'move_id': False}, context=ctx)
if line.parent_state == 'close':
line.asset_id.write({'state': 'open'})
if len(ids) == 1:
return self.reload_page(
cr, uid, line.asset_id.id, context)
elif line.parent_state == 'removed' and line.type == 'remove':
line.asset_id.write({'state': 'close'})
self.unlink(cr, uid, [line.id])
if len(ids) == 1:
return self.reload_page(cr, uid, line.asset_id.id, context)
return True

View File

@ -153,7 +153,7 @@
<header>
<button type="object" name="compute_depreciation_board" string="Compute" icon="terp-stock_format-scientific" colspan="2" attrs="{'invisible':[('state','in',['close','removed'])]}"/>
</header>
<field name="depreciation_line_ids" mode="tree">
<field name="depreciation_line_ids" mode="tree" options="{'reload_on_button': true}">
<tree string="Asset Lines" colors="blue:(move_check == False) and (init_entry == False)" create="false">
<field name="type"/>
<field name="line_date"/>
@ -164,7 +164,6 @@
<field name="move_check"/>
<field name="parent_state" invisible="1"/>
<button name="create_move" icon="gtk-execute" string="Create Move" type="object"
context="{'create_move_from_button':True}"
attrs="{'invisible':['|','|',('init_entry','=',True),('move_check','!=',False),('parent_state','!=','open')]}"/>
<button name="open_move" icon="terp-gtk-jump-to-ltr" string="View Move" type="object"
attrs="{'invisible':[('move_check','!=',True)]}"/>