Skip to content

Commit

Permalink
feat: Add submitted field to Docs on print templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mildred committed Dec 22, 2023
1 parent 3c1a3b5 commit 2a3540a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/utils/printTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ export async function getPrintTemplatePropValues(
const fyo = doc.fyo;
const values: PrintValues = { doc: {}, print: {} };
values.doc = await getPrintTemplateDocValues(doc);
(values.doc as PrintTemplateData).entryType = doc.schema.name;
(values.doc as PrintTemplateData).entryLabel = doc.schema.label;

const printSettings = await fyo.doc.getDoc(ModelNameEnum.PrintSettings);
const printValues = await getPrintTemplateDocValues(
Expand Down Expand Up @@ -72,8 +70,6 @@ export function getPrintTemplatePropHints(schemaName: string, fyo: Fyo) {
const hints: PrintTemplateHint = {};
const schema = fyo.schemaMap[schemaName]!;
hints.doc = getPrintTemplateDocHints(schema, fyo);
hints.doc.entryType = fyo.t`Entry Type`;
hints.doc.entryLabel = fyo.t`Entry Label`;

const printSettingsHints = getPrintTemplateDocHints(
fyo.schemaMap[ModelNameEnum.PrintSettings]!,
Expand Down Expand Up @@ -159,6 +155,10 @@ function getPrintTemplateDocHints(
}
}

hints.submitted = fyo.t`Submitted`;
hints.entryType = fyo.t`Entry Type`;
hints.entryLabel = fyo.t`Entry Label`;

if (Object.keys(links).length) {
hints.links = links;
}
Expand Down Expand Up @@ -204,6 +204,10 @@ async function getPrintTemplateDocValues(doc: Doc, fieldnames?: string[]) {
values[fieldname] = table;
}

values.submitted = doc.submitted
values.entryType = doc.schema.name;
values.entryLabel = doc.schema.label;

// Set Formatted Doc Link Data
await doc.loadLinks();
const links: PrintTemplateData = {};
Expand Down

0 comments on commit 2a3540a

Please sign in to comment.