← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 747915] [NEW] account_payment_extension: accounting moves are reversed

 

Public bug reported:

A payment from customer implies increasing assets hence a Dr in Bank account.
Current move create a Cr in bank account when the payement is receive (ie line.amount <0)
Suggestion in payment.py
Change:
                val = {
                    'name': line.move_line_id and line.move_line_id.name or '/',
                    'move_id': move_id,
                    'date': order.date_done,
                    'ref': line.move_line_id and line.move_line_id.ref or False,
                    'partner_id': line.partner_id and line.partner_id.id or False,
                    'account_id': line.account_id.id,
                    'debit': ((amount>0) and amount) or 0.0,
                    'credit': ((amount<0) and -amount) or 0.0,
                    'journal_id': order.mode.journal.id,
                    'period_id': order.period_id.id,
                    'currency_id': currency_id,
                }
                
by 
                val = {
                    'name': line.move_line_id and line.move_line_id.name or '/',
                    'move_id': move_id,
                    'date': order.date_done,
                    'ref': line.move_line_id and line.move_line_id.ref or False,
                    'partner_id': line.partner_id and line.partner_id.id or False,
                    'account_id': line.account_id.id,
                    'crebit': ((amount>0) and amount) or 0.0,
                    'dedit': ((amount<0) and -amount) or 0.0,
                    'journal_id': order.mode.journal.id,
                    'period_id': order.period_id.id,
                    'currency_id': currency_id,
                }
                
 and change:
                self.pool.get('account.move.line').create(cr, uid, {
                    'name': line.move_line_id and line.move_line_id.name or '/',
                    'move_id': move_id,
                    'date': order.date_done,
                    'ref': line.move_line_id and line.move_line_id.ref or False,
                    'partner_id': line.partner_id and line.partner_id.id or False,
                    'account_id': account_id,
                    'debit': ((amount < 0) and -amount) or 0.0,
                    'credit': ((amount > 0) and amount) or 0.0,
                    'journal_id': order.mode.journal.id,
                    'period_id': order.period_id.id,
                    'amount_currency': amount_currency,
                    'currency_id': move_currency_id,
                }, context)
by 
                self.pool.get('account.move.line').create(cr, uid, {
                    'name': line.move_line_id and line.move_line_id.name or '/',
                    'move_id': move_id,
                    'date': order.date_done,
                    'ref': line.move_line_id and line.move_line_id.ref or False,
                    'partner_id': line.partner_id and line.partner_id.id or False,
                    'account_id': account_id,
                    'crebit': ((amount < 0) and -amount) or 0.0,
                    'dedit': ((amount > 0) and amount) or 0.0,
                    'journal_id': order.mode.journal.id,
                    'period_id': order.period_id.id,
                    'amount_currency': amount_currency,
                    'currency_id': move_currency_id,
                }, context)

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/747915

Title:
  account_payment_extension: accounting moves are reversed

Status in OpenERP Modules (addons):
  New

Bug description:
  A payment from customer implies increasing assets hence a Dr in Bank account.
  Current move create a Cr in bank account when the payement is receive (ie line.amount <0)
  Suggestion in payment.py
  Change:
                  val = {
                      'name': line.move_line_id and line.move_line_id.name or '/',
                      'move_id': move_id,
                      'date': order.date_done,
                      'ref': line.move_line_id and line.move_line_id.ref or False,
                      'partner_id': line.partner_id and line.partner_id.id or False,
                      'account_id': line.account_id.id,
                      'debit': ((amount>0) and amount) or 0.0,
                      'credit': ((amount<0) and -amount) or 0.0,
                      'journal_id': order.mode.journal.id,
                      'period_id': order.period_id.id,
                      'currency_id': currency_id,
                  }
                  
  by 
                  val = {
                      'name': line.move_line_id and line.move_line_id.name or '/',
                      'move_id': move_id,
                      'date': order.date_done,
                      'ref': line.move_line_id and line.move_line_id.ref or False,
                      'partner_id': line.partner_id and line.partner_id.id or False,
                      'account_id': line.account_id.id,
                      'crebit': ((amount>0) and amount) or 0.0,
                      'dedit': ((amount<0) and -amount) or 0.0,
                      'journal_id': order.mode.journal.id,
                      'period_id': order.period_id.id,
                      'currency_id': currency_id,
                  }
                  
   and change:
                  self.pool.get('account.move.line').create(cr, uid, {
                      'name': line.move_line_id and line.move_line_id.name or '/',
                      'move_id': move_id,
                      'date': order.date_done,
                      'ref': line.move_line_id and line.move_line_id.ref or False,
                      'partner_id': line.partner_id and line.partner_id.id or False,
                      'account_id': account_id,
                      'debit': ((amount < 0) and -amount) or 0.0,
                      'credit': ((amount > 0) and amount) or 0.0,
                      'journal_id': order.mode.journal.id,
                      'period_id': order.period_id.id,
                      'amount_currency': amount_currency,
                      'currency_id': move_currency_id,
                  }, context)
  by 
                  self.pool.get('account.move.line').create(cr, uid, {
                      'name': line.move_line_id and line.move_line_id.name or '/',
                      'move_id': move_id,
                      'date': order.date_done,
                      'ref': line.move_line_id and line.move_line_id.ref or False,
                      'partner_id': line.partner_id and line.partner_id.id or False,
                      'account_id': account_id,
                      'crebit': ((amount < 0) and -amount) or 0.0,
                      'dedit': ((amount > 0) and amount) or 0.0,
                      'journal_id': order.mode.journal.id,
                      'period_id': order.period_id.id,
                      'amount_currency': amount_currency,
                      'currency_id': move_currency_id,
                  }, context)



Follow ups

References