openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #17070
[Bug 865854] Re: Payment to Sales/Purchase Refund Invoice is wrong
If you need to clean your existing data paste this in your code in the class account_voucher and lauch it.
It will search for the existing refunf payment, cancel it, back to draft, change the sign and validate it.
def fix_refund(self, cr, uid, ids=None, context=None):
inv_obj = self.pool.get('account.invoice')
invoice_ids = inv_obj.search(cr, uid, [['type', '=', 'out_refund']], context=context)
for invoice in inv_obj.browse(cr, uid, invoice_ids, context=context):
if invoice.reconciled:
payment_id = invoice.payment_ids[0].id
voucher_id = self.search(cr, uid, [['move_ids', '=', payment_id]])
if voucher_id:
voucher = self.browse(cr, uid, voucher_id[0], context=context)
if voucher.amount > 0:
print '>>> CLEAN VOUCHER %s ====='%voucher.number
voucher.cancel_voucher()
voucher.action_cancel_draft()
voucher.write({
'amount': - voucher.amount,
})
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(
uid, 'account.voucher', voucher.id, 'proforma_voucher', cr)
cr.commit()
print '<<< CLEAN VOUCHER DONE %s ====='%voucher.number
return True
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/865854
Title:
Payment to Sales/Purchase Refund Invoice is wrong
Status in OpenERP Addons (modules):
Fix Committed
Bug description:
Once a Sales Refund and Purchase Refund invoice is validated, there
will be a payment button down there just exactly the same as the
normal invoices. However, I observed there is something wrong with the
journal entries it generates. Take a Sales Refund as an example:
1. After I validate the Sales Refund Invoice (SCNJ by default), the
system CREDIT the Account Receivable while DEBIT the Product Sales,
this step is correct.
2. However, when I click the payment button in the refund invoice and
process it normally, after the payment is settled, in the journal
entry, it records as the normal Sales Invoice Payment which is CREDIT
the Account Receivable while DEBIT the Bank Account. This is wrong, it
should be the other way around.
Could anybody explain it? May be I am wrong, but it is a very
important function in the business.
Thanks,
King W.C. Wang
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/865854/+subscriptions