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)
  qdp (OpenERP) (qdp)
  Mustufa Rangwala (Open ERP) (mra-tinyerp)

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-01 13:37:11 +0000
+++ account_asset/account_asset.py	2011-07-05 11:51:36 +0000
@@ -1,4 +1,4 @@
-	# -*- encoding: utf-8 -*-
+# -*- encoding: utf-8 -*-
 ##############################################################################
 #
 #    OpenERP, Open Source Management Solution
@@ -130,12 +130,16 @@
         undone_dotation_number = asset.method_delay
         if asset.method_time == 'end':
             end_date = datetime.strptime(asset.method_end, '%Y-%m-%d')
+            total_days = asset.method_period != 12 and asset.method_period * 30 or total_days
+            no_of_days = float((end_date - depreciation_date).days) / float(total_days)
             undone_dotation_number = (end_date - depreciation_date).days / total_days
-        if asset.prorata or asset.method_time == 'end':
+            if no_of_days - undone_dotation_number > 0.5:
+                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:

_______________________________________________
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

Reply via email to