Unable to Get item from different Purchase Receipts with same item

Hi,

Anyone can help me how to create Invoice from different Purchase receipts with same item? I was trying to make One Invoice out of two different purchase receipts but unfortunately I can’t get the items from the other Purchase receipts.
Scenario:
One PR1 only contains an item x (30qty) and the other PR2 contains two items x (10qty) and y (20qty).
When I try to get items from both PR, It only updates items&qty from PR2.

Please help me resolve this.
Thank you.

@zyc_tess

How are you creating the Invoice?
Did you create a new Purchase Invoice and then click “Get Items from” and fetch the relevant Purchase Receipts? Make sure both Purchase Receipts are from same Supplier. Also make sure you select both Purchase Receipts in the “Get Items from” Query (PR1 and PR2 in your case).
On doing this it will fetch Items from both Purchase Receipts.

Hi,

I created an Invoice based from PR2 and tried to add PR1 through get items from but its not updated. I tried to delete all items in the Invoice and tried to update both PR using Get items from, selected both PR but only PR2 updated.

Did you try other set of transactions to see if you can re-create the issue?
I tried this workflow

Not able to recreate the issue on my end.

If you are still facing the same issue with other set of transactions, post some more details including screenshots to figure out what the issue might be.

Thanks

Duplicate item will get removed by system while pulling items from Get Items option.
Check below :

erpnext.utils.clear_duplicates = function() {
if(!cur_frm.doc.items) return;
const unique_items = new Map();
/*
Create a Map of items with
item_code => [qty, warehouse, batch_no]
*/
let items = ;

for (let item of cur_frm.doc.items) {
if (!(unique_items.has(item.item_code) && unique_items.get(item.item_code)[0] === item.qty &&
unique_items.get(item.item_code)[1] === item.warehouse && unique_items.get(item.item_code)[2] === item.batch_no &&
unique_items.get(item.item_code)[3] === item.delivery_date && unique_items.get(item.item_code)[4] === item.required_date &&
unique_items.get(item.item_code)[5] === item.rate)) {

  	unique_items.set(item.item_code, [item.qty, item.warehouse, item.batch_no, item.delivery_date, item.required_date, item.rate]);
  	items.push(item);
  }

}
cur_frm.doc.items = items;
}

                                                       +

                                                        =

In my case PR-16 + PR-17 = INV19, FG1 is fetched inspite of being a repeat item (Line item 1 & 3 on Invoice)

1 Like

Hi, what is your setting for duplicate items? Our system is not allowed to avoid possible duplicate items in one PO - which I suspect is the cause of this cases Im facing when wanting to merge multiple PR/DR to one Invoice.

I do not have any setting to restrict duplicate Items. Possibly, that is causing problem for you.