[FIX] Changes the period used into the period chosen and not the period of today

lp bug: https://launchpad.net/bugs/1078004 fixed

bzr revid: jco@openerp.com-20121221134956-fgg1ltu1qy1j2ion
This commit is contained in:
Josse Colpaert 2012-12-21 14:49:56 +01:00
parent 1dbea4a07a
commit 0a6f2417e7
1 changed files with 4 additions and 1 deletions

View File

@ -331,6 +331,9 @@ class account_asset_asset(osv.osv):
depreciation_obj = self.pool.get('account.asset.depreciation.line')
period = period_obj.browse(cr, uid, period_id, context=context)
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)
if context is None:
context = {}
context.update({'depreciation_date':period.date_stop})
return depreciation_obj.create_move(cr, uid, depreciation_ids, context=context)
def create(self, cr, uid, vals, context=None):
@ -388,7 +391,7 @@ class account_asset_depreciation_line(osv.osv):
created_move_ids = []
asset_ids = []
for line in self.browse(cr, uid, ids, context=context):
depreciation_date = time.strftime('%Y-%m-%d')
depreciation_date = context.get('depreciation_date') or time.strftime('%Y-%m-%d')
period_ids = period_obj.find(cr, uid, depreciation_date, context=context)
company_currency = line.asset_id.company_id.currency_id.id
current_currency = line.asset_id.currency_id.id