If Item has multiple uoms in the master we can’t update or create a new Item.
The responsible code seems this one erpnext/erpnext/stock/doctype/item/item.py at 2b0b24f7c34f6aadec0a334c73263bdf065656f7 · frappe/erpnext · GitHub.
This query causes an exception:
select (first.value / second.value) as value
from `tabUOM Conversion Factor` first
join `tabUOM Conversion Factor` second
on first.from_uom = second.from_uom
where
first.to_uom = %(to_uom)s
and second.to_uom = %(from_uom)s
limit 1
Exception: (1054, “Unknown column ‘first.value’ in ‘field list’”)
But “tabUOM Conversion Factor” table has “value” column.
We can run the query in the System Console if table alias is set with backtrick (ie first
and second
) .
So this query doesn’t generate any error.
select (first.value / second.value) as value
from `tabUOM Conversion Factor` `first`
join `tabUOM Conversion Factor` `second`
on first.from_uom = second.from_uom
where
first.to_uom = %(to_uom)s
and second.to_uom = %(from_uom)s
limit 1
It seems that code is updated 2 years ago and we were updating Item conversion factors yesterday, I can’t find the real reason behind it. We are on Frappe Cloud so we can’t update the code.
Do you have any idea why is that causing this error today? Can we do anything about it on the Frappe Cloud?