Invoice display issue with multiple instances of one line item
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Confirmed
|
Medium
|
Unassigned |
Bug Description
Seen in the wild on our 3.8 production server.
Library ordered 5 copies of an item. On the resulting invoice, the vendor split up the quantity onto two lines--one line with 2 copies, and one line with the other 3 copies. Both referenced the same original line item.
On looking at the invoice in Evergreen, only one line appeared, the line with 2 copies. Upon trying to adjust the quantity to 5 and update the Cost/Billed with the total amount for all 5 copies, once clicking Save you get a popup error of "Acq Invoice Entry Count Exceeds Debits."
Looking at the EDI message that created the invoice, I confirmed that the EDI invoice also had the 5 copies split out into different LINs, both referencing the same line item. It was like because it was the same line item ID, it couldn't display both at the same time.
Going back to the invoice UI, I detached the line item and saved. And when it reloaded, there was the *other* instance of the same line item.
So the bug would be that if a vendor splits quantity across lines on an invoice, if they're referencing the same line item then EG can only display one at a time. I wasn't able to initially increase the quantity to 5 because under the hood both instances of the line item existed and there were 5 fund debits--unwittingly I was trying to artificially increase it to 8 so I got the error.
For anyone who stumbles on this bug, the solution to this is to just detach the line item entirely from the invoice until it no longer appears, then reattach and adjust the quantity and prices to match the printed invoice. (Don't try to duplicate the line item twice on your EG invoice, just have it on there once and update it to reflect the total cost and quantity for the title from the printed invoice.)
Changed in evergreen: | |
importance: | Undecided → Medium |
status: | New → Confirmed |
Confirmed this bug by constructing an invoice using SQL that had two invoice entries for the same line item.
Culprit is around line 882 in Open-ILS/ web/js/ ui/default/ acq/invoice/ view.js:
if( dojo.query( '[lineitem= ' + entry.lineitem() +']', entryTbody)[0])
// Is it ever valid to have multiple entries for 1 lineitem in a single invoice?
return;
Superficially, it works if you take out these three lines: both invoice entries appear, you can adjust their counts and amounts individually, and you can detach them individually. (Caveat: I'm not claiming to have tested thoroughly.)
On the face of it, while it's not parsimonious, I don't see an inherent conceptual problem with multiple invoice entries on the same invoice pointing at the same line item so long as the total count of line item copies invoiced doesn't exceed the number ordered.