mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Merge pull request #129 from luc-demeyer/7.0-asset-mgt-fix
asset mgt fixes
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
##############################################################################
|
||||
{
|
||||
'name': 'Assets Management',
|
||||
'version': '2.3',
|
||||
'version': '2.4',
|
||||
'depends': ['account'],
|
||||
'conflicts': ['account_asset'],
|
||||
'author': 'OpenERP & Noviat',
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -657,10 +657,34 @@ 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)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user