Ujjvala Collins (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-account_asset_prorata_degressive-uco
into lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account_asset_prorata_degressive-uco/+merge/70724
[IMP] account_asset:
----------------------------------
* For asset, prorata had to work for degressive method too.
Changes I did:
-----------------------
* Added prorata condition for calculating the depreciation amount using
degressive method.
* Changes in views : Removed attrs on prorata
* Changes in methods : Changed check constraint on prorata for degressive
method and also changed the on change method.
P.S. : Calculations may differ for degressive depreciation. Need to be checked.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account_asset_prorata_degressive-uco/+merge/70724
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-account_asset_prorata_degressive-uco.
=== modified file 'account_asset/account_asset.py'
--- account_asset/account_asset.py 2011-07-11 11:38:27 +0000
+++ account_asset/account_asset.py 2011-08-08 12:07:29 +0000
@@ -112,6 +112,13 @@
amount = (amount_to_depr / asset.method_number) / total_days * (total_days - days)
elif asset.method == 'degressive':
amount = residual_amount * asset.method_progress_factor
+ #TODO: calculations need to be checked
+ if asset.prorata:
+ days = total_days - float(depreciation_date.strftime('%j'))
+ if i == 1:
+ amount = (residual_amount * asset.method_progress_factor) / total_days * days
+ elif i == undone_dotation_number:
+ amount = (residual_amount * asset.method_progress_factor) / total_days * (total_days - days)
return amount
def _compute_board_undone_dotation_nb(self, cr, uid, asset, depreciation_date, total_days, context=None):
@@ -242,13 +249,13 @@
def _check_prorata(self, cr, uid, ids, context=None):
for asset in self.browse(cr, uid, ids, context=context):
- if asset.prorata and (asset.method != 'linear' or asset.method_time != 'number'):
+ if asset.prorata and asset.method_time != 'number':
return False
return True
_constraints = [
(_check_recursion, 'Error ! You can not create recursive assets.', ['parent_id']),
- (_check_prorata, 'Prorata temporis can be applied only for computation method "linear" and time method "number of depreciations".', ['prorata']),
+ (_check_prorata, 'Prorata temporis can be applied only for time method "number of depreciations".', ['prorata']),
]
def onchange_category_id(self, cr, uid, ids, category_id, context=None):
@@ -267,9 +274,9 @@
}
return res
- def onchange_method_time(self, cr, uid, ids, method='linear', method_time='number', context=None):
+ def onchange_method_time(self, cr, uid, ids, method_time='number', context=None):
res = {'value': {}}
- if method != 'linear' or method_time != 'number':
+ if method_time != 'number':
res['value'] = {'prorata': False}
return res
=== modified file 'account_asset/account_asset_view.xml'
--- account_asset/account_asset_view.xml 2011-07-29 14:03:24 +0000
+++ account_asset/account_asset_view.xml 2011-08-08 12:07:29 +0000
@@ -29,7 +29,7 @@
<separator string="Depreciation Method" colspan="2"/>
<field name="method"/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
- <field name="prorata" attrs="{'invisible':[('method','<>','linear')]}"/>
+ <field name="prorata"/>
<field name="open_asset"/>
</group>
<group col="2" colspan="2" groups="analytic.group_analytic_accounting">
@@ -109,9 +109,9 @@
</group>
<group colspan="2" col="2">
<separator string="Depreciation Method" colspan="2"/>
- <field name="method" on_change="onchange_method_time(method)"/>
+ <field name="method"/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
- <field name="prorata" attrs="{'invisible': ['|',('method_time','=','end'),('method','!=','linear')]}"/>
+ <field name="prorata" attrs="{'invisible': [('method_time','=','end')]}"/>
</group>
<newline/>
<separator string="" colspan="4"/>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp