[MERGE] merged the feature branch with boolean on depreciaiton line to depicts if the line is already in the accounting

bzr revid: qdp-launchpad@openerp.com-20110512171005-yxs93csnzgrez0i0
This commit is contained in:
Quentin (OpenERP) 2011-05-12 19:10:05 +02:00
commit 018dd8122b
2 changed files with 10 additions and 2 deletions

View File

@ -278,6 +278,13 @@ account_asset_asset()
class account_asset_depreciation_line(osv.osv):
_name = 'account.asset.depreciation.line'
_description = 'Asset depreciation line'
def _get_move_check(self, cr, uid, ids, name, args, context=None):
res = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = bool(line.move_id)
return res
_columns = {
'name': fields.char('Depreciation Name', size=64, required=True, select=1),
'sequence': fields.integer('Sequence of the depreciation', required=True),
@ -287,6 +294,7 @@ class account_asset_depreciation_line(osv.osv):
'depreciated_value': fields.float('Amount Already Depreciated', required=True),
'depreciation_date': fields.char('Depreciation Date', size=64, select=1),
'move_id': fields.many2one('account.move', 'Depreciation Entry'),
'move_check': fields.function(_get_move_check, method=True, type='boolean', string='Move Included', store=True)
}
def create_move(self, cr, uid,ids, context=None):

View File

@ -89,8 +89,8 @@
<field name="amount"/>
<field name="depreciated_value"/>
<field name="remaining_value"/>
<field name="move_id" invisible="1"/>
<button name="create_move" attrs="{'invisible':[('move_id','!=',False)]}" icon="gtk-execute" string="Create Move" type="object"/>
<field name="move_check"/>
<button name="create_move" attrs="{'invisible':[('move_check','!=',False)]}" icon="gtk-execute" string="Create Move" type="object"/>
</tree>
<graph type="bar">
<field name="name"/>