Skip to content

Commit

Permalink
fix: await formattedValue and don't format image url (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
maharshivpatel authored Jul 8, 2024
2 parents d730b87 + 37e877c commit 154d30b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions print_designer/public/js/print_designer/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,16 @@ export const getFormattedValue = async (field, row = null) => {
field.fieldname
);
}
formattedValue.value = frappe.format(
rawValue,
{ fieldtype: field.fieldtype, options: field.options },
{ inline: true },
MainStore.docData
);
if (!(field.fieldtype == "Image") && !(field.fieldtype == "Attach Image")) {
formattedValue.value = frappe.format(
rawValue,
{ fieldtype: field.fieldtype, options: field.options },
{ inline: true },
MainStore.docData
);
} else {
formattedValue.value = rawValue;
}
if (!formattedValue.value) {
if (["Image", "Attach Image"].indexOf(field.fieldtype) != -1) {
formattedValue.value = null;
Expand Down Expand Up @@ -483,7 +487,7 @@ export const updateDynamicData = async () => {
row = MainStore.docData[el.tableName];
row && (row = row[0]);
}
let value = getFormattedValue(el, row);
let value = await getFormattedValue(el, row);
if (typeof value == "string" && value.startsWith("<svg")) {
value.match(new RegExp(`data-barcode-value="(.*?)">`));
value = result[1];
Expand Down

0 comments on commit 154d30b

Please sign in to comment.