asset mgt fixes

This commit is contained in:
luc-demeyer
2015-01-20 22:16:25 +01:00
parent 23de62a1f4
commit 1c2848b565
4 changed files with 27 additions and 8 deletions

View File

@@ -22,7 +22,7 @@
##############################################################################
{
'name': 'Assets Management',
'version': '2.3',
'version': '2.4',
'depends': ['account'],
'conflicts': ['account_asset'],
'author': 'OpenERP & Noviat',

View File

@@ -1541,7 +1541,7 @@ class account_asset_depreciation_line(orm.Model):
"FROM account_asset_depreciation_line "
"WHERE asset_id = %s "
"AND (init_entry=TRUE OR move_check=TRUE)"
"AND line_date >= %s LIMIT 1",
"AND line_date > %s LIMIT 1",
(dl.asset_id.id, vals['line_date']))
res = cr.fetchone()
if res:

View File

@@ -31,7 +31,7 @@
</group>
<group string="Depreciation Method">
<field name="method"/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','in',['degressive','degr-linear'])]}"/>
<field name="method_progress_factor" digits="(14, 4)" attrs="{'invisible':[('method','=','linear')], 'required':[('method','in',['degressive','degr-linear'])]}"/>
<field name="prorata" attrs="{'readonly':[('method_time','!=','year')]}"/>
<field name="open_asset"/>
</group>
@@ -144,7 +144,7 @@
<group>
<separator string="Depreciation Method" colspan="2"/>
<field name="method"/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','in',['degressive','degr-linear'])]}"/>
<field name="method_progress_factor" digits="(14, 4)" attrs="{'invisible':[('method','=','linear')], 'required':[('method','in',['degressive','degr-linear'])]}"/>
<field name="prorata" attrs="{'readonly':[('method_time','!=','year')]}"/>
</group>
</group>

View File

@@ -657,10 +657,29 @@ class asset_report_xls(report_xls):
error_name = asset.name
if asset.code:
error_name += ' (' + asset.code + ')' or ''
raise orm.except_orm(
_('Data Error'),
_("Depreciation Table error for asset %s !")
% error_name)
if asset.state in ['open']:
cr.execute(
"SELECT line_date "
"FROM account_asset_depreciation_line "
"WHERE asset_id = %s AND type = 'depreciate' "
"AND init_entry=FALSE AND move_check=FALSe "
"AND line_date < %s"
"ORDER BY line_date ASC LIMIT 1",
(data[0], fy.date_start))
res = cr.fetchone()
if res:
raise orm.except_orm(
_('Data Error'),
_("You can not report on a Fiscal Year "
"with unposted entries in prior years. "
"Please post depreciation table entry "
"dd. '%s' of asset '%s' !")
% (res[0], error_name))
else:
raise orm.except_orm(
_('Data Error'),
_("Depreciation Table error for asset %s !")
% error_name)
asset.fy_start_value = asset.asset_value - value_depreciated
# fy_end_value