[FIX] account : improved the dates in recurring entries
authorManu <>
Tue, 19 Jul 2011 13:07:40 +0000 (18:37 +0530)
committerBharat (OpenERP) <bde@tinyerp.com>
Tue, 19 Jul 2011 13:07:40 +0000 (18:37 +0530)
lp bug: https://launchpad.net/bugs/800767 fixed

bzr revid: bde@tinyerp.com-20110719130740-eq87ant192zguo0n

addons/account/account.py

index 03a9b62..64aab95 100644 (file)
@@ -1331,7 +1331,7 @@ class account_move(osv.osv):
 
     def _centralise(self, cr, uid, move, mode, context=None):
         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:
             context = {}
 
@@ -1593,7 +1593,7 @@ class account_tax_code(osv.osv):
                        (parent_ids,) + where_params)
         res=dict(cr.fetchall())
         obj_precision = self.pool.get('decimal.precision')
-        res2 = {} 
+        res2 = {}
         for record in self.browse(cr, uid, ids, context=context):
             def _rec_get(record):
                 amount = res.get(record.id, 0.0)
@@ -2120,7 +2120,7 @@ class account_model(osv.osv):
         period_id = period_id[0]
 
         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, {
                 'ref': entry['name'],
                 'period_id': period_id,
@@ -2141,7 +2141,7 @@ class account_model(osv.osv):
                     '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 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!" \