~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to account_corrections/wizard/analytic_distribution_wizard.py

  • Committer: jf
  • Date: 2016-02-11 14:30:21 UTC
  • mfrom: (2766.2.2 unifield-wm)
  • Revision ID: jfb@tempo-consulting.fr-20160211143021-4s7uzizukuvfb8hb
US-828 [FIX] Don't change posting date and period when an AJI is corrected and no not trigger REV/COR
lp:~jfb-tempo-consulting/unifield-wm/us-828

Show diffs side-by-side

added added

removed removed

Lines of Context:
360
360
            amount_cur = (ml.credit_currency - ml.debit_currency) * line.percentage / 100
361
361
            amount = self.pool.get('res.currency').compute(cr, uid, ml.currency_id.id, company_currency_id, amount_cur, round=False, context=ctx)
362
362
 
363
 
            date_to_use = orig_date
364
 
            if ml.journal_id.type == 'hq':
365
 
                # US-773: keep date when correcting hq entry
366
 
                date_to_use = False
367
 
            # UFTP-169: Use the correction line date in case we are correcting a line that is a correction of another line.
368
 
            if ml.corrected_line_id:
369
 
                date_to_use = ml.date
370
363
            vals = {
371
364
                'account_id': line.analytic_id.id,
372
365
                'cost_center_id': line.cost_center_id.id,
374
367
                'amount_currency': amount_cur,
375
368
                'amount': amount,
376
369
            }
377
 
            if date_to_use:
 
370
 
 
371
            # UFTP-169: Use the correction line date in case we are correcting a line that is a correction of another line.
 
372
            if ml.corrected_line_id:
378
373
                vals.update({
379
 
                    'date': date_to_use,
 
374
                    'date': ml.date,
380
375
                    'source_date': orig_date,
381
376
                    'document_date': orig_document_date,
382
377
                })
383
378
            self.pool.get('account.analytic.line').write(cr, uid, to_override_ids, vals)
384
 
            # UTP-1118: Fix problem of entry_sequence that is not the right one regarding the journal
385
 
 
386
 
            # UFTP-373: The block below is commented out, as there is no reason to replace the Seq in here
387
 
#             for ana_line in self.pool.get('account.analytic.line').browse(cr, uid, to_override_ids, context=context):
388
 
#                 prefix = ana_line.instance_id.move_prefix
389
 
#                 seqnum = ana_line.entry_sequence.split('-')[2]
390
 
#                 entry_seq = "%s-%s-%s" % (prefix, ana_line.journal_id.code, seqnum)
391
 
#                 cr.execute('UPDATE account_analytic_line SET entry_sequence = %s WHERE id = %s', (entry_seq, ana_line.id))
392
379
            # update the distib line
393
380
            self.pool.get('funding.pool.distribution.line').write(cr, uid, [line.distribution_line_id.id], {
394
381
                    'analytic_id': line.analytic_id.id,
398
385
                })
399
386
            if greater_amount['gap_amount'] and greater_amount['wl'] and greater_amount['wl'].id == line.id:
400
387
                greater_amount['aji_id'] = to_override_ids[0]
401
 
                greater_amount['date'] = date_to_use
 
388
                greater_amount['date'] = orig_date
402
389
 
403
390
        #####
404
391
        # US-676