Purchase Receipt Validation - an use case not addressed in Stock module

In our company, the UOM in our Purchase Order will be different from the UOM in which we receive the item in Purchase Receipt.

E.g. When we place an order for 100 kgs of Material A, the supplier will send the material in 2 bags of 50 Kg each, or 1 bag of 100 kg. We need to be able to record this info in Purchase Receipt. Currently, We cannot do that since the system expects the same UOM in purchase receipt as in purchase order. Of course, we can enter a direct Purchase Receipt, but then it wont be linked to a purchase order.

def validate_with_previous_doc(self):
super(PurchaseReceipt, self).validate_with_previous_doc({
“Purchase Order”: {
“ref_dn_field”: “prevdoc_docname”,
“compare_fields”: [[“supplier”, “=”], [“company”, “=”], [“currency”, “=”]],
},
“Purchase Order Item”: {
“ref_dn_field”: “prevdoc_detail_docname”,
“compare_fields”: [[“project”, “=”], [“uom”, “=”], [“item_code”, “=”]],
“is_child_table”: True

Why is this validation required? As long as the Quantity in Stock UOM in Purchase receipt is validated against the quantity in stock uom in PO, the purpose should be solved, right?

I’m sure many of the users in the community will have this use case. Has anyone been able to find a work around?
Also, I’m not able to think of consequences of removing that validation in the system.

1 Like

Can’t remove the validation, because received qty (in PO) updated in purchase UOM.

@nabinhait but that can be done against the quantity_in_stock_uom. If both purchase order & purchase receipt are compoared against stock_uom, there wont be any problem in using any UOM in transactions. I can see that the system is deigned like that and is happening in other transactions. Just that the PO & PR need to be enabled for that.

Yeah, I know, that can be done. But it needs some rewriting, and not many people are asking for the feature.

I understand. Are the changes as simple as I think, or there is more to it? I can make the changes and send a pull request if you can guide me.
I made the following change and tested PO & PR - it worked. But I’m not sure if there is more to it. Can you please guide?

Nope, that is just part of the changes.

You have to change the logic or mapper while making PO to PR. Also what about the rate in the PR, the rate entered in the PO is for another UOM, so in the PR if you change the purchase uom, that rate does not make any sense.
Then when PI is made from that PO, the amount updation from PI to PO also should be changed.

There will be many more cases, which I can’t think as of now.