Duplicate item in purchase order


now in purchase or sales order the same item can be entered twice if the description is different , but now i want the same item can be entered twice as long as a certain field is diffenrent each for another…
in my case the filed is SPK filed , SPK is an item request code (its different with MREQ or PROD)…

how i can do that ?


You will have to change the validation code that raises duplicate items.

where is the code ?..

and i think im not supposed to change erpnext code…and i think if i do in validate hook than my code is being run after the original so its should be raise and error first before my code run…is there any method i can overide ?


You can fix it and send a pull request :smile:


But i think what i do here is unique for my software only…

so i need to change the erpnext code after all , ok ill do it…


The checking against unique item is indeed sometimes very nasty.

It is in all doctypes as i can see.

This is a big problem when selling the same item with 2 different batches. Eg. in Receipt i get 4 items from one batch and 6 item from another batch. The system refuses it because of duplicate item.

I suggest to make it switchable in system settings in case of other people, who need this feature.

@bobzz_zone Changing the core can only be an interim-solution. You loose your update ability when doing this.