Ujjvala Collins (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-account-asset-ending_date_correction-uco
into lp:~openerp-dev/openobject-addons/trunk-account-asset.
Requested reviews:
Ujjvala Collins (OpenERP) (uco-openerp)
Mustufa Rangwala (Open ERP) (mra-tinyerp)
qdp (OpenERP) (qdp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-asset-ending_date_correction-uco/+merge/66429
account_asset:
--------------------------
ending period: choose a date and the number of month between 2 depreciations:
doesn't work.
Improvements I did:
----------------------------------
-> Depreciation dates were getting changed after a move is created and we press
compute button.
-> For calculating the number of depreciation lines, Period length is supposed
be taken into account.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-asset-ending_date_correction-uco/+merge/66429
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-account-asset.
=== modified file 'account_asset/account_asset.py'
--- account_asset/account_asset.py 2011-07-05 14:23:22 +0000
+++ account_asset/account_asset.py 2011-07-06 09:12:43 +0000
@@ -1,4 +1,4 @@
- # -*- encoding: utf-8 -*-
+# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
@@ -130,12 +130,15 @@
undone_dotation_number = asset.method_delay
if asset.method_time == 'end':
end_date = datetime.strptime(asset.method_end, '%Y-%m-%d')
- undone_dotation_number = (end_date - depreciation_date).days / total_days
- if asset.prorata or asset.method_time == 'end':
+ undone_dotation_number = 0
+ while depreciation_date <= end_date:
+ depreciation_date = (datetime(depreciation_date.year, depreciation_date.month, depreciation_date.day) + relativedelta(months=+asset.method_period))
+ undone_dotation_number += 1
+ if asset.prorata:
undone_dotation_number += 1
return undone_dotation_number
-
- def compute_depreciation_board(self, cr, uid,ids, context=None):
+
+ def compute_depreciation_board(self, cr, uid, ids, context=None):
depreciation_lin_obj = self.pool.get('account.asset.depreciation.line')
for asset in self.browse(cr, uid, ids, context=context):
if asset.value_residual == 0.0:
@@ -152,6 +155,8 @@
month = depreciation_date.month
year = depreciation_date.year
total_days = (year % 4) and 365 or 366
+ if asset.method_time == 'end':
+ total_days = asset.method_period != 12 and asset.method_period * 30 or total_days
undone_dotation_number = self._compute_board_undone_dotation_nb(cr, uid, asset, depreciation_date, total_days, context=context)
for x in range(len(posted_depreciation_line_ids), undone_dotation_number):
_______________________________________________
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