How can I transfer more qty than mentioned in purchase order via stock entry in case of subcontract

I have submitted one purchase order with the qty of “500” Meter. But I want to transfer the more qty to supplier in case of subcontract in stock entry. Is there any way to transfer more qty than mentioned in that purchase order…?

Purchase Order only has finished item in it. In the Stock Entry, the qty of raw-material item will be updated in proportion to finished item. Perhaps you can add an additional row for the extra item, or create separate Material Transfer entry.

1 Like

Actually I want to overwrite the following function of stock entry from my custom app,

def validate_purchase_order(self):
	"""Throw exception if more raw material is transferred against Purchase Order than in
	the raw materials supplied table"""
	if self.purpose == "Subcontract" and self.purchase_order:
		purchase_order = frappe.get_doc("Purchase Order", self.purchase_order)
		for se_item in self.items:
			total_allowed = sum([flt(d.required_qty) for d in purchase_order.supplied_items \
				if d.rm_item_code == se_item.item_code])
			if not total_allowed:
				frappe.throw(_("Item {0} not found in 'Raw Materials Supplied' table in Purchase Order {1}")
					.format(se_item.item_code, self.purchase_order))
			total_supplied = frappe.db.sql("""select sum(qty)
				from `tabStock Entry Detail`, `tabStock Entry`
				where `tabStock Entry`.purchase_order = %s
					and `tabStock Entry`.docstatus = 1
					and `tabStock Entry Detail`.item_code = %s
					and `tabStock Entry Detail`.parent = `tabStock Entry`.name""",
						(self.purchase_order, se_item.item_code))[0][0]

			if total_supplied > total_allowed:
				frappe.throw(_("Not allowed to tranfer more {0} than {1} against Purchase Order {2}").format(se_item.item_code,
					total_allowed, self.purchase_order))
  • Is there any way to ignore the above validation from the stock entry… is there any way to overwrite this function and ignore the default functionality.?

were you ever able to figure this out? Perhaps a way to do this would be to have a setting in setup that disables or enables this function call.