There's a strange behavior that persists in ERPNext where it attempts file handling on Item valuation reposts. This will trigger an error when cloud storage is active due to an incompatible create_json_gz_file stock function.
The function is triggered via repost() -> repost_sl_entries() in erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py -> repost_future_sle() -> update_args_in_repost_item_valuation() -> create_json_gz_file() in erpnext/stock/stock_ledger.py.
The create_json_gz_file function itself throws an error due to direct file open/write attempts on a file_doc.get_full_path() path, but there's also a strange little artifact where it implements a workaround if the path contains "/frappe_s3_attachment."
if "/frappe_s3_attachment." in file_doc.file_url:
file_doc.delete()
return create_file(doc, compressed_content)
Apparently that exists in deference to the frappe-attachments-s3 app.
Unfortunately, none of this is happening in a class or whitelisted method that can be easily overridden. Barring the occasion that Frappe adopts a more robust designation for local vs remote files, it appears that the most straight-forward approach is to postpend /frappe_s3_attachment. to the cloud storage URLs 😞
There's a strange behavior that persists in ERPNext where it attempts file handling on Item valuation reposts. This will trigger an error when cloud storage is active due to an incompatible create_json_gz_file stock function.
The function is triggered via
repost()->repost_sl_entries()in erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py ->repost_future_sle()->update_args_in_repost_item_valuation()->create_json_gz_file()in erpnext/stock/stock_ledger.py.The
create_json_gz_filefunction itself throws an error due to direct file open/write attempts on afile_doc.get_full_path()path, but there's also a strange little artifact where it implements a workaround if the path contains "/frappe_s3_attachment."Apparently that exists in deference to the frappe-attachments-s3 app.
Unfortunately, none of this is happening in a class or whitelisted method that can be easily overridden. Barring the occasion that Frappe adopts a more robust designation for local vs remote files, it appears that the most straight-forward approach is to postpend
/frappe_s3_attachment.to the cloud storage URLs 😞