[FIX] account : improved the dates in recurring entries

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

bzr revid: bde@tinyerp.com-20110719130740-eq87ant192zguo0n
This commit is contained in:
Manu 2011-07-19 18:37:40 +05:30 committed by Bharat (OpenERP)
parent e4b1ae8c1a
commit c38c7d055c
1 changed files with 4 additions and 4 deletions

View File

@ -1331,7 +1331,7 @@ class account_move(osv.osv):
def _centralise(self, cr, uid, move, mode, context=None): def _centralise(self, cr, uid, move, mode, context=None):
assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection
currency_obj = self.pool.get('res.currency') currency_obj = self.pool.get('res.currency')
if context is None: if context is None:
context = {} context = {}
@ -1593,7 +1593,7 @@ class account_tax_code(osv.osv):
(parent_ids,) + where_params) (parent_ids,) + where_params)
res=dict(cr.fetchall()) res=dict(cr.fetchall())
obj_precision = self.pool.get('decimal.precision') obj_precision = self.pool.get('decimal.precision')
res2 = {} res2 = {}
for record in self.browse(cr, uid, ids, context=context): for record in self.browse(cr, uid, ids, context=context):
def _rec_get(record): def _rec_get(record):
amount = res.get(record.id, 0.0) amount = res.get(record.id, 0.0)
@ -2120,7 +2120,7 @@ class account_model(osv.osv):
period_id = period_id[0] period_id = period_id[0]
for model in self.browse(cr, uid, ids, context=context): for model in self.browse(cr, uid, ids, context=context):
entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')} entry['name'] = model.name%{'year':context.get('date',time.strftime('%Y')), 'month':context.get('date',time.strftime('%m')), 'date':context.get('date',time.strftime('%d'))}
move_id = account_move_obj.create(cr, uid, { move_id = account_move_obj.create(cr, uid, {
'ref': entry['name'], 'ref': entry['name'],
'period_id': period_id, 'period_id': period_id,
@ -2141,7 +2141,7 @@ class account_model(osv.osv):
'analytic_account_id': analytic_account_id 'analytic_account_id': analytic_account_id
} }
date_maturity = time.strftime('%Y-%m-%d') date_maturity = context.get('date',time.strftime('%Y-%m-%d'))
if line.date_maturity == 'partner': if line.date_maturity == 'partner':
if not line.partner_id: if not line.partner_id:
raise osv.except_osv(_('Error !'), _("Maturity date of entry line generated by model line '%s' of model '%s' is based on partner payment term!" \ raise osv.except_osv(_('Error !'), _("Maturity date of entry line generated by model line '%s' of model '%s' is based on partner payment term!" \