Charge in allocate tab on windows payment

295 views
Skip to first unread message

Eduardo Gil

unread,
Oct 22, 2014, 10:52:16 AM10/22/14
to idem...@googlegroups.com
Some cases i have a payment that need to be distributed in many charges but i have just one. In allocate tab on windows payment i just can select an invoice and i have to create an ar reciepe document type distrubute an payment after and that's so much work.

If we could have the charge un allocate tab we can have as many as we need to distribute in just one payment. An example of this is when the client have many petty cash and want to make just one payment to reposition.

Nicolas Micoud

unread,
Oct 22, 2014, 11:20:41 AM10/22/14
to idem...@googlegroups.com
Hi,

As we talked in RIC today, we've done something on ADempiere and we planned to migrate it to iDempiere.
If it's useful, i can contribute it on trunk.

We called the functionnality 'MultiCharge payment"

On the header tab, i added a new checkbox : "IsMultiCharge".
If unticked => actual behaviour
if ticked => you will find new fields on Payment Allocate tab.

Charge, Tax and Description

So, you are able to allocate the amount to an invoice, a charge or a tax (made a mistake on irc, you can't have charge and tax).

Posting has been adapted to those new fields

Voiding : it will generate 2 payments : one for the invoices and another for the charges/taxes. (Honestly, i don't remember why i've done it this way, but there was probably a good reason :))

WDYT ?

Regards,

Nicolas

Eduardo Gil

unread,
Oct 22, 2014, 11:32:18 AM10/22/14
to idem...@googlegroups.com
I think  multi charge check its not necesary.

On defautl payment interface when we select charge the invoice field is disable that could be equals there

about create two payment on void should be good check that running to visualize why.

Regards,

Eduardo Gil

Nicolas Micoud

unread,
Oct 22, 2014, 1:26:39 PM10/22/14
to idem...@googlegroups.com
AFAIR, i put the checkbox to facilitate the control and specific behaviour.
I think it can be removed.

For the voiding part, i don't remember why. When I will face that step, we will see.

Nicolas Micoud

unread,
Oct 23, 2014, 3:27:21 AM10/23/14
to idem...@googlegroups.com
We have implemanted this in 2010. At the beginning, it was not possible to have charge and tax on a same line. Then, we made some modifications in order to authorize that. That explain why this point was not clear yesterday, sorry.

Carlos pointed that handling taxes from payment could be problematic (ATM, reports for taxes are based on C_InvoiceTax table).
Note that this functionnality is for accountant - they are suppose to know what they are doing - and it's designed for purchase transactions. I've checked and it was NEVER used on AR Payment, only for AP payment. 
But maybe a new view or a new report could be needed.

If it's ok for everyone, I can migrate it to idempiere trunk and submit a patch ?

WDYT ?

Regards,

Nicolas

Anh Hàn

unread,
Oct 24, 2014, 2:49:56 AM10/24/14
to idem...@googlegroups.com
We modified the Payment in other way. We added a Payment Header on top of existing Payment (which we considered Payment Lines), then ensure that some information from Payment Header (like business partner, currency, bank account, etc) is automatically copied to Payment Lines (of course you can change).
Then just write a process to ensure once you click Complete in Payment Header, all Payment Lines is automatically completed.

--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/idempiere/76a10bfd-24df-45f1-8ebb-d60ef4207b3e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Eduardo Gil

unread,
Oct 24, 2014, 11:27:17 AM10/24/14
to idem...@googlegroups.com
This is a great idea to. it looks like gl journal batch and that is so usefull.

Some questions 

Did you let it have payments of diferents bp?
if you use this on invoice payment it should create as many allocation tha invoice you have. do you create any process to remove the lote of allocations?

Nicolas Micoud

unread,
Oct 24, 2014, 4:48:23 PM10/24/14
to idem...@googlegroups.com
But it will generate several payments (one per charge) whereas you will only one on the bank statement, so that's not really for the described use case, no ?
Otherwise, it's an interesting idea, well spotted !

Nicolas

Anh Hàn

unread,
Oct 25, 2014, 2:21:42 AM10/25/14
to idem...@googlegroups.com
Yes, it acts like batch payment. Our main purpose is to solve a specific problem: Proxy Payment (one payer/payee for various invoices of different partners) while still ensure strict control over document sequences.

For Bank Reconciliation, we domanual reconciliation between our system and bank statement (we didn't use bank statement in our system).

Regards,

Nicolas Micoud

unread,
Oct 25, 2014, 3:36:22 AM10/25/14
to idem...@googlegroups.com
For allowing a bpartner to pay invoices of different bpartners, we made little customization on payment allocation window (allow to select invoices of any bpartners) and add some lines in posting.

Nicolas

HansAnton Riess

unread,
Oct 26, 2014, 11:49:58 AM10/26/14
to idem...@googlegroups.com
Hi Nikolas,

If possible please share the customization, which allow payment of different business partner.

Regards
Hans

Nicolas Micoud

unread,
Oct 27, 2014, 5:35:55 AM10/27/14
to idem...@googlegroups.com
Yes, i can share it.
I will upload it by the end of the week (don't have time ATM).


Regards,

Nicolas

Nicolas Micoud

unread,
Oct 28, 2014, 4:02:36 AM10/28/14
to idem...@googlegroups.com
Hi Hans,

Here what i've done :

Column C_PaymentAllocate.C_Invoice_ID : remove the dynamic validation C_Invoice of Payment and use something like :
C_Invoice.DocStatus IN ('CO', 'CL') AND C_Invoice.C_Currency_ID=@C_Currency_ID@ AND C_Invoice.IsSOTrx='@IsReceipt@'

This way, you will be able to select any completed/closed invoice int the payment currency


Here's the content of the createFacts method :


public ArrayList<Fact> createFacts (MAcctSchema as)
{
ArrayList<Fact> facts = super.createFacts(as); // Normal posting

for (int i = 0; i < p_lines.length; i++) {
DocLine_Allocation line = (DocLine_Allocation)p_lines[i];
if (line.getC_Invoice_ID() > 0 && line.getC_Payment_ID() > 0) {
MInvoice_Tgi invoice = new MInvoice_Tgi(Env.getCtx(), line.getC_Invoice_ID(), null);
MPayment payment = new MPayment(Env.getCtx(), line.getC_Payment_ID(), null);

if (invoice.getC_BPartner_ID() != payment.getC_BPartner_ID()) {
Object[] arguments = new Object[3];
arguments[0] = invoice.getDocumentInfo();
arguments[1] = invoice.getC_BPartner().getName();
arguments[2] = payment.getC_BPartner().getName();
MessageFormat mf = new MessageFormat(Msg.getMsg(Env.getAD_Language(Env.getCtx()), "DocAllocInterBPartnerDescription"), Env.getLanguage(Env.getCtx()).getLocale());
String description = mf.format (arguments);

// Payment
Fact fact = new Fact(this, as, Fact.POST_Actual);
FactLine fl = fact.createLine (line, getAccount(Doc.ACCTTYPE_UnallocatedCash, as), getC_Currency_ID(), line.getAmtSource(), null);
if (fl != null) {
fl.setAD_Org_ID(payment.getAD_Org_ID());
fl.setC_BPartner_ID(payment.getC_BPartner_ID());
fl.setDescription(description);
}

// Invoice
fl = fact.createLine (line, getAccount(Doc.ACCTTYPE_UnallocatedCash, as), getC_Currency_ID(), null, line.getAmtSource());
if (fl != null) {
fl.setAD_Org_ID(invoice.getAD_Org_ID());
fl.setC_BPartner_ID(invoice.getC_BPartner_ID());
fl.setDescription(description);
}
facts.add(fact);
}
}
}

return facts;
}



Regards,

Nicolas

HansAnton Riess

unread,
Oct 28, 2014, 12:38:28 PM10/28/14
to idem...@googlegroups.com
Hello Nicolas,

Thank you very much for sharing.


Regards

Hans

Eduardo Gil

unread,
Nov 10, 2014, 8:24:50 AM11/10/14
to idem...@googlegroups.com
Good morning. Sorry for be late to coment this.

You are rigth the use case describe what you implemenet in the first time. If you introduce a funcionality about multipayments (i did not know anything about this) it could work as payment batch.

Best regards,

Eduardo 

Nicolas Micoud

unread,
Mar 25, 2015, 1:03:01 PM3/25/15
to idem...@googlegroups.com
Hi,

I have starting to work on this subject.
I've migrated the "module" on my locale idempiere instance and do rapid test (create / complete / post) and it seems ok (i haven't look at the reverse/void part)

Are you (or any other) interested for testing it ?

ATM, i had to modify some core methods (callouts / MPayment.prepare/completeIt, Doc_Payment...) ; so i don't think it would be feasible in a plugin.
Here the list of changes in database :

New columns :
C_Payment.IsMultiCharge
C_PaymentAllocate.Line
C_PaymentAllocate.C_Charge_ID
C_PaymentAllocate.C_Tax_ID
C_PaymentAllocate.TaxBaseAmt
C_PaymentAllocate.TaxAmt
C_PaymentAllocate.Description

Changes: 
C_PaymentAllocate.C_Invoice_ID is not mandatory
C_PaymentAllocate.AD_Org_ID : default value = @AD_Org_ID@

View RV_Payment / C_Payment_v
functions paymentAllocated / paymentAvailable


I'm asking to see if there is an interest in making a kind of patch that will contains all sources modifications.


Regards,

Nicolas

Nicolas Micoud

unread,
Mar 26, 2015, 5:47:07 AM3/26/15
to idem...@googlegroups.com
Hi,

I've created https://bitbucket.org/nmicoud/idempiere_paymentmulticharge to manage this enhancement.
ATM, you can create, complete and post those payments.

Some views and functions have been updated (only for Oracle, i'm not using postgre).

A 2Pack which contains the duplicated window (easier to test) is available in the download section (https://bitbucket.org/nmicoud/idempiere_paymentmulticharge/downloads).

This is a migration from a "module" which was done on ADempiere 360, so it needs some enhancement.
ATM, messages are hardcoded and the void/reverse part is missing (will do it in the next few days). The MBPartner.setTotalOpenBalance() is not updated also.

So feel free to download and test.

Regards,

Nicolas
Reply all
Reply to author
Forward
0 new messages