Add id to Reversal note

When you reverse an invoice (or a credit) the code creates a credit (or invoice) where the Note field is set to 'Created by Reversal' - but there is no indication of what transaction got reversed.

Am I correct in guessing that the id of the reversed transaction could be inserted by:

a) changing the customer.account.reverse.notes  entry in messages.properties to  "Created by Reversal of id {0}"

b) adjusting the code in AccountCRUDwindow.java (approx line 141) to:
    rules.reverse(act, new Date(), Messages.get("customer.account.reverse.notes",act.getId().toString()));

This change will also do the same for the payment/refund reversal.

Regards, Tim G

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Add id to Reversal note

Yep. You could also include the type of the transaction being reversed i.e. given a format string:

Created by reversal of {0} {1,number,####}

It would display:

Created by reversal of Invoice 1234567

The code would be:

 String notes = Messages.format("customer.account.reverse.notes",DescriptorHelper.getDisplayName(act), act.getId()));

rules.reverse(act, new Date(), notes); 

If you JIRA it, I'll make the change.

-Tim A

Re: Add id to Reversal note

Tim A - done - https://openvpms.atlassian.net/browse/OVPMS-1358

I really do need to get IDEA fired up with a complete source set so that I can examine the class definitions. I saw the DescriptorHelper.getDisplayName() further up - I didn't realise you could give it an act. I also didn't realise that Message.format could handle numbers and thus the toString() was unnecessary.

Thanks, Tim G

Re: Add id to Reversal note

I tweaked the CSH text to reflect the above change, and then I though - humm - given that the reversed transaction now has the note "Reversal of Invoice 12345", how do I find the transaction with id 12345.

I think that the following needs to be added to jira 1358:

In order to make the reversed transaction locatable, the reversable financial acts (ie act.customerAccountPayment, act.supplierAccountPayment, act.customerAccountChargesCounter, act.customerAccountChargesCredit, act.customerAccountChargesInvoice,
act.supplierAccountChargesCredit, and act.supplierAccountChargesInvoice) should have their description node set to concat('id ',/id)

This then makes the description column (on for example the Customers|Account screen) show the id.

Even more sexy, since the description column is sortable, you can click on its column header to sort by id. [Well not strictly because we are sorting on the string so id 2 will come after id 1234 whereas it should really come before - but it should be good enough.]

Also - it now makes more sense to display the id on the printed invoice etc.

Regards, Tim G

Re: Add id to Reversal note

It would be better to expose the id node of the relevant acts (i.e set hidden="false"), and include an Id column in the account table.

-Tim A

Re: Add id to Reversal note

Tim A - you are correct - this is cleaner. My way was something I could do without changing the code. [I still have not figured out what controls the screen layout/contents.]

Do you want me to add your solution to the jira ?

Regards, Tim G

Re: Add id to Reversal note

No - just raise a new JIRA.

Re: Add id to Reversal note

Jira 1360 created.  Regards, Tim G

Syndicate content