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
1=== modified file 'account_asset/account_asset.py'
2--- account_asset/account_asset.py 2013-10-27 12:31:04 +0000
3+++ account_asset/account_asset.py 2014-01-15 16:16:14 +0000
4@@ -153,14 +153,19 @@
5 if asset.prorata:
6 depreciation_date = datetime.strptime(self._get_last_depreciation_date(cr, uid, [asset.id], context)[asset.id], '%Y-%m-%d')
7 else:
8- # depreciation_date = 1st January of purchase year
9 purchase_date = datetime.strptime(asset.purchase_date, '%Y-%m-%d')
10 #if we already have some previous validated entries, starting date isn't 1st January but last entry + method period
11 if (len(posted_depreciation_line_ids)>0):
12 last_depreciation_date = datetime.strptime(depreciation_lin_obj.browse(cr,uid,posted_depreciation_line_ids[0],context=context).depreciation_date, '%Y-%m-%d')
13 depreciation_date = (last_depreciation_date+relativedelta(months=+asset.method_period))
14 else:
15- depreciation_date = datetime(purchase_date.year, 1, 1)
16+ # depreciation_date = start date of fiscal year or 1st January of purchase year
17+ fiscal_date = self.pool.get('account.fiscalyear').search_read(cr, uid, [('date_start', '<=', purchase_date), ('date_stop', '>=', purchase_date)], ['date_start'], context=context)
18+ if fiscal_date:
19+ fis_date = datetime.strptime(fiscal_date[0]['date_start'], '%Y-%m-%d')
20+ depreciation_date = datetime(purchase_date.year, fis_date.month, fis_date.day)
21+ else:
22+ depreciation_date = datetime(purchase_date.year, 1, 1)
23 day = depreciation_date.day
24 month = depreciation_date.month
25 year = depreciation_date.year
26@@ -268,7 +273,7 @@
27 help="Choose the method to use to compute the dates and number of depreciation lines.\n"\
28 " * Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n" \
29 " * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."),
30- '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'),
31+ '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'),
32 'history_ids': fields.one2many('account.asset.history', 'asset_id', 'History', readonly=True),
33 'depreciation_line_ids': fields.one2many('account.asset.depreciation.line', 'asset_id', 'Depreciation Lines', readonly=True, states={'draft':[('readonly',False)],'open':[('readonly',False)]}),
34 '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: