Payment to Sales/Purchase Refund Invoice is wrong

Bug #865854 reported by Weichen Wang
110
This bug affects 22 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Committed
Medium
OpenERP Publisher's Warranty Team

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

Tags: maintenance

Related branches

Amit Parik (amit-parik)
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Weichen Wang (kingcarrie) wrote :

I think it should be at least 'Medium' Importance. It is a very frequent used function!

Anybody can escalate it?

Revision history for this message
Weichen Wang (kingcarrie) wrote :

Please update the status?

Amit Parik (amit-parik)
Changed in openobject-addons:
importance: Low → Medium
Changed in openobject-addons:
assignee: OpenERP R&D Addons Team 3 (openerp-dev-addons3) → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
removed: payment purchase refund sales
Revision history for this message
Weichen Wang (kingcarrie) wrote :

Hello Priyesh, what is the meaning of changing the tags to maintenance, does that mean it will be solved in an unknown time frame?

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Hello Weichen Wang,
it means the bug has been reported by an OpenERP Enterprise contract:
http://doc.openerp.com/v6.0/contribute/11_bug_tracker.html#bug-management-policy
http://www.openerp.com/catalog/146

Revision history for this message
Lorenzo Battistini (elbati) wrote :
Revision history for this message
Weichen Wang (kingcarrie) wrote :

Thanks!

Revision history for this message
Thomas Winteler (Win-Soft) (thomi) wrote :

so.. the workaround is just:

create a invoice for the refund amount and refund this invoice.. ;)

anyway... when will this be fixed? customers are waiting.. and the workaround its ok.. but customers are unhappy about that..

at 11.11.2011 it was assigned to OPW team.. hm.. so it' should be fixed within one or max. two weeks, right?

we also can report it as OPW from our customer... if that help to force the fix.

thanks for updating us.
thomi

Revision history for this message
Thomas Winteler (Win-Soft) (thomi) wrote :

ha.. tested...

it's simpler, i think..

just create a refund (w/o a invoice), validate and make payment and be sure to set a negative paid amount..
Payment: http://i.imgur.com/19nUQ.png
General Ledger: http://i.imgur.com/gIyWd.png

so.. i think, a easy workaround ;)

thomi

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

I just opened the same bug report (cf https://bugs.launchpad.net/openobject-addons/+bug/920863) and someone noticed it was a duplicate of this bug. So let's continue to discuss this bug here.

As explained on my bug report, the amount on the payment voucher must be negative in order to have the accounting entries generated with debit and credit "the other way around". I wrote a patch (see enclosed) which fixes the issue : the payment voucher generated from a customer/supplier refund as a negative amount.

Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello all,

Issue has been fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574543-pso with revno: 6783
rev-id: <email address hidden>

It will be merged soon with Stable-6.1 as soon as it will get approval from our experts.

@Alexis de Lattre (alexis-via) : Thank you for your contribution.

Thanks for reporting,
Priyesh

Changed in openobject-addons:
status: Confirmed → Fix Committed
Revision history for this message
Thomas Winteler (Win-Soft) (thomi) wrote :

Hey

Thanks for fixing this. I see that it will be merged into 6.1, what about 6.0? Customers still use 6.0 until we have planet the migration to 6.1, which is a lot of work ;)... Will this bug also be merged into 6.0?

Thanks for feedback

Regards
Thomas

Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

I have tested this patch, but seems it don't work.

Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

I found that main issue is that now when voucher amount can be minus, there is need to return absolute value of it before using it.

Revision history for this message
Fabian Semal (fabian.semal) wrote :

Hello,

Same question as Thomas here. When is it going to be fixed for 6.0 ? Our customers (all with OPW) cannot close their accounting period if they cannot validate their refunds.

Regards,

Fabian @ SmartSolution

Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello all,

It has been fixed in

For stable-6.1:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574543-pso with revno: 6798

For stable-6.0:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-574543-pso with revn0: 5227

It will be merged soon with Stable branches.

Thanks for reporting,
Priyesh

Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

Hello Priyesh,

I have tested it and supplier refund don't work like it should, created accounting entries are not correct.

Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

BTW, you can't link voucher with bank statement line if voucher have negative amount, please look to http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/account_voucher/account_voucher.py#L1456

Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello Paulius Sladkevičius,

Yes, you are right.

For that, We are searching some better way which can fix these both issues. We are in discussion with our experts and we will get back to you soon.

Thanks,
Priyesh

Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello Paulius Sladkevičius,

We discussed this issue with our expert and here is the conclusion:

1. Let the customer allow to add the negative amount in Paid Amount of voucher. For that, We added tootlip on that field.
2. We improved write off amount and accounting entries.
3. Bank statement line should not be raise warning message.

Here is the branch info:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574543-pso with rev-no: 6801
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-574543-pso with rev-no: 5229

Regarding Supplier refund payment, Accounting entries are coming correctly, like this:
Partner Payable Account will be credit and Bank Account will be debit.

Let me know your opinion on this, how the accounting entries should come ?

Thanks,
Priyesh

Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

Hello Priyesh,

I have tested and seems everything works like it must. Thanks.

Only one note, that from bank statement line usability side (for bookkeeper it can be strange):
if you will add supplier invoice amount to bank statement line, it will be negative f.e. -100 EUR, but you need to link it with payment which is positive 100 EUR; same with supplier refund, amount will be positive 100 EUR, but payment negative.

Revision history for this message
Romain Deheele - Camptocamp (romaindeheele) wrote :

Hello,

Thanks, it helps me a lot on a 6.0 instance who contained this bug.
But, why don't you directly prefilled the field amount with a negative amount?

Romain

Revision history for this message
Carlos Liebana (carlos-liebana) wrote :

Is this going to be merged soon in trunk? I see it's pending since May, and without this we can't refund supplier invoices already paid.

Here is the merge proposal https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574543-pso/+merge/104692

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Hello bug was up?
Sorry for missing your birthday, already 1 year, it's cool for you ;)
#JOKE

Hi all, I really can not understand how a such bug can be still here after 1 year. And my customer (who is just next to me) can not believe it too, I migrate it in july and since july all refund payment are wrong :S. He is not really happy :(.

I test the patch and I think is still not ok for me.

First amount should be set to negatif by default for payment refund.

Secondly if the customer enter a positive amount, for exemple 71.75€ for a paying a refund of 71.75€ the difference must be 143.50€. 71.75€ + 71.75€ = 143.50€ and not 0€ (seen picture : voucher_positive_seem_ok_but_it_is_wrong).

Thirdly (always a thirdly point) I REPEAT the amount must be set to NEGATIVE by default is not the customer validade the voucher and a wrong entries is done => (picture : voucher_positive_move_line)

If amount is negative everything work (picture : account_voucher_ok). This part have been fix thanks

@OPENERP SA
Also I will give you an advice, take care of customer that paid for a service! Please do it. Today my customer (who have an OPW, we always try to sell OPW) realise that an other customer who have paid for an OPW still wait for a fix after a lot and a lot of month...
And if OpenERP had done he job, my customer was not paying today some extra cost of the time to fix again this bug...

I send a mail to support team with my customer OPW and please this time fix it correctly and merge it! Customers paid for it, don't disappoint them please !

Thanks

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

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

Revision history for this message
qdp (OpenERP) (qdp) wrote :

hi there,

tl;dr

i just set another bug as duplicated as this one: if you need further info, it may be a good idea to look there too: https://bugs.launchpad.net/openobject-addons/+bug/1092489

Thanks,
Quentin

Revision history for this message
Don Kirkby (donkirkby) wrote :

Thanks for posting the fix, but it doesn't handle foreign currencies properly. The currency_amount is incorrect on several account_move_line records.
I added a merge proposal that handles foreign currencies, and it also sets the default payment amount to be negative when paying a refund.

Revision history for this message
Michael Karrer (michaelkarrer81) wrote :

Again a bug that affects more than 20 people and is ratet medium (dont understand why it is not ratet high) is not fixed and merged - Am i the only one who really feels very uncertain about the Quality of OpenERP because of such bugs?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.