[MERGE] fix of bug 1078004

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

bzr revid: qdp-launchpad@openerp.com-20130213174551-uzu6jql330ejvguv
This commit is contained in:
Quentin (OpenERP) 2013-02-13 18:45:51 +01:00
commit fdc7eee9b3
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