@Void_Moon if you are creating invoice from sales order with using
Sales Order
Create > Invoice
Sales Invoice
Get Items From > Sales Order
This core function uses mapper method which auto map same field names and fetch data, so if in can case you want to use same data in all the documents, better to create field with same fieldname in all the documents.
In Quotes and Orders, our custom “description”-field got named “description”. When adding it to Invoices however, it appeared as “custom-description”, hence the different names.
As I couldn’t make Void_Moon’s approach work (no property “prevdoc_docname” found) I am thinking of adding matching fields named “custom-description” to Quotes and Orders and moving over the information via SQL.
So, following procedure:
add custom field in Quotation, call it “custom-description”
add custom field in Sales Order, call it “custom-description”
UPDATE tabQuotation SET custom-description = description;
UPDATE `tabSales Order` SET custom-description = description;
Delete old “description”-fields in Quotation and Sales Order
The prevdoc_docname is set only if you create the SI from the SO via create->SI button in SO.
I’m not sure if that’s what you’re doing and still unable to get the value. Have your tried inspecting with cur_frm.doc to see all the attributes attached to the frm?
I might’ve misspelled it, cause I’ve used it multiple times and it should work…
As for your solution, yeah that should work as well… But ensure everywhere this custom_description field is linked with also changes to description. (Like in the customize form of the SI).
But in retrospect, shouldn’t there already be a description field in all item tables? Thereby fetching the description value directly?
and then searched for “prev” with CTRL-F but to no avail. Maybe it’s because we’re on 14.49.0 and frappe 14.56.1. as we only get cur_frm and not frm.
On the other hand there must be some reference to the previous document somewhere. But anyhow, I will try the other approach in a test installation now.
And you are absolutely right that there already are description fields for items! Ours is for the process in general so you get a hint of what it was in list views of Quotations, SO and SI.