Merge lp:~openerp-dev/openobject-addons/trunk-bug-1241559-cod into lp:openobject-addons

Proposed by Chirag Dodiya(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1241559-cod
Merge into: lp:openobject-addons
Diff against target: 34 lines (+8/-3)
1 file modified
account_asset/account_asset.py (+8/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1241559-cod
Reviewer Review Type Date Requested Status
Chirag Dodiya(OpenERP) (community) Needs Resubmitting
Amit Parik (community) Needs Fixing
Turkesh Patel (openERP) Pending
Review via email: mp+192125@code.launchpad.net

Description of the change

Hello,

         I have fixed this issue, wrong depreciation date for fiscal years not starting jan 1st in Accounting -> Asset.

Thanks,
Chirag Dodiya(cod).

To post a comment you must log in.
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

Not good for me! What will be happen is mutiple fiscal year for the same company!
Better you have to search the fiscal year for the assets purchase date(purchase_date).

Also please improve the help for Prorata Temporis.

Thank you!

review: Needs Fixing
8955. By Chirag Dodiya(OpenERP)

[IMP] improved code for search fiscal start date based on purchase date and improved help of prorata field

8956. By Chirag Dodiya(OpenERP)

[IMP] improved help of prorata field

Revision history for this message
Chirag Dodiya(OpenERP) (chirag.dodiya-openerp) wrote :

Hello sir,

      I have improved code as par your suggestion.

Thanks,
Chirag Dodiya(cod).

review: Needs Resubmitting
8957. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

Unmerged revisions

8957. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

8956. By Chirag Dodiya(OpenERP)

[IMP] improved help of prorata field

8955. By Chirag Dodiya(OpenERP)

[IMP] improved code for search fiscal start date based on purchase date and improved help of prorata field

8954. By Chirag Dodiya(OpenERP)

[FIX] Improved code for set depreciation date

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_asset/account_asset.py'
--- account_asset/account_asset.py 2013-10-27 12:31:04 +0000
+++ account_asset/account_asset.py 2014-01-15 16:16:14 +0000
@@ -153,14 +153,19 @@
153 if asset.prorata:153 if asset.prorata:
154 depreciation_date = datetime.strptime(self._get_last_depreciation_date(cr, uid, [asset.id], context)[asset.id], '%Y-%m-%d')154 depreciation_date = datetime.strptime(self._get_last_depreciation_date(cr, uid, [asset.id], context)[asset.id], '%Y-%m-%d')
155 else:155 else:
156 # depreciation_date = 1st January of purchase year
157 purchase_date = datetime.strptime(asset.purchase_date, '%Y-%m-%d')156 purchase_date = datetime.strptime(asset.purchase_date, '%Y-%m-%d')
158 #if we already have some previous validated entries, starting date isn't 1st January but last entry + method period157 #if we already have some previous validated entries, starting date isn't 1st January but last entry + method period
159 if (len(posted_depreciation_line_ids)>0):158 if (len(posted_depreciation_line_ids)>0):
160 last_depreciation_date = datetime.strptime(depreciation_lin_obj.browse(cr,uid,posted_depreciation_line_ids[0],context=context).depreciation_date, '%Y-%m-%d')159 last_depreciation_date = datetime.strptime(depreciation_lin_obj.browse(cr,uid,posted_depreciation_line_ids[0],context=context).depreciation_date, '%Y-%m-%d')
161 depreciation_date = (last_depreciation_date+relativedelta(months=+asset.method_period))160 depreciation_date = (last_depreciation_date+relativedelta(months=+asset.method_period))
162 else:161 else:
163 depreciation_date = datetime(purchase_date.year, 1, 1)162 # depreciation_date = start date of fiscal year or 1st January of purchase year
163 fiscal_date = self.pool.get('account.fiscalyear').search_read(cr, uid, [('date_start', '<=', purchase_date), ('date_stop', '>=', purchase_date)], ['date_start'], context=context)
164 if fiscal_date:
165 fis_date = datetime.strptime(fiscal_date[0]['date_start'], '%Y-%m-%d')
166 depreciation_date = datetime(purchase_date.year, fis_date.month, fis_date.day)
167 else:
168 depreciation_date = datetime(purchase_date.year, 1, 1)
164 day = depreciation_date.day169 day = depreciation_date.day
165 month = depreciation_date.month170 month = depreciation_date.month
166 year = depreciation_date.year171 year = depreciation_date.year
@@ -268,7 +273,7 @@
268 help="Choose the method to use to compute the dates and number of depreciation lines.\n"\273 help="Choose the method to use to compute the dates and number of depreciation lines.\n"\
269 " * Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n" \274 " * Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n" \
270 " * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."),275 " * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."),
271 'prorata':fields.boolean('Prorata Temporis', readonly=True, states={'draft':[('readonly',False)]}, help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first January'),276 'prorata':fields.boolean('Prorata Temporis', readonly=True, states={'draft':[('readonly',False)]}, help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first January/start date of fiscal year'),
272 'history_ids': fields.one2many('account.asset.history', 'asset_id', 'History', readonly=True),277 'history_ids': fields.one2many('account.asset.history', 'asset_id', 'History', readonly=True),
273 'depreciation_line_ids': fields.one2many('account.asset.depreciation.line', 'asset_id', 'Depreciation Lines', readonly=True, states={'draft':[('readonly',False)],'open':[('readonly',False)]}),278 'depreciation_line_ids': fields.one2many('account.asset.depreciation.line', 'asset_id', 'Depreciation Lines', readonly=True, states={'draft':[('readonly',False)],'open':[('readonly',False)]}),
274 'salvage_value': fields.float('Salvage Value', digits_compute=dp.get_precision('Account'), help="It is the amount you plan to have that you cannot depreciate.", readonly=True, states={'draft':[('readonly',False)]}),279 'salvage_value': fields.float('Salvage Value', digits_compute=dp.get_precision('Account'), help="It is the amount you plan to have that you cannot depreciate.", readonly=True, states={'draft':[('readonly',False)]}),

Subscribers

People subscribed via source and target branches

to all changes: