Merge lp:~openerp-dev/openobject-addons/trunk-bug-1078004-jco into lp:openobject-addons

Proposed by Josse Colpaert (OpenERP)
Status: Merged
Merged at revision: 8551
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1078004-jco
Merge into: lp:openobject-addons
Diff against target: 22 lines (+4/-1)
1 file modified
account_asset/account_asset.py (+4/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1078004-jco
Reviewer Review Type Date Requested Status
qdp (OpenERP) Pending
Review via email: mp+141080@code.launchpad.net

Description of the change

The period of the moves created by the compute assets wizard is now that of the chosen period. The date chosen is end of the month of that period.

To post a comment you must log in.

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 2012-12-17 15:23:03 +0000
3+++ account_asset/account_asset.py 2012-12-21 14:55:51 +0000
4@@ -331,6 +331,9 @@
5 depreciation_obj = self.pool.get('account.asset.depreciation.line')
6 period = period_obj.browse(cr, uid, period_id, context=context)
7 depreciation_ids = depreciation_obj.search(cr, uid, [('asset_id', 'in', ids), ('depreciation_date', '<=', period.date_stop), ('depreciation_date', '>=', period.date_start), ('move_check', '=', False)], context=context)
8+ if context is None:
9+ context = {}
10+ context.update({'depreciation_date':period.date_stop})
11 return depreciation_obj.create_move(cr, uid, depreciation_ids, context=context)
12
13 def create(self, cr, uid, vals, context=None):
14@@ -388,7 +391,7 @@
15 created_move_ids = []
16 asset_ids = []
17 for line in self.browse(cr, uid, ids, context=context):
18- depreciation_date = time.strftime('%Y-%m-%d')
19+ depreciation_date = context.get('depreciation_date') or time.strftime('%Y-%m-%d')
20 period_ids = period_obj.find(cr, uid, depreciation_date, context=context)
21 company_currency = line.asset_id.company_id.currency_id.id
22 current_currency = line.asset_id.currency_id.id

Subscribers

People subscribed via source and target branches

to all changes: