Skip to content

Commit

Permalink
fix: use POS print template width from print settings
Browse files Browse the repository at this point in the history
  • Loading branch information
AbleKSaju committed Jan 3, 2025
1 parent 8523b61 commit aeeebc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion main/getPrintTemplates.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs/promises';
import path from 'path';
import { fyo } from 'src/initFyo';
import { TemplateFile } from 'utils/types';

export async function getTemplates() {
Expand All @@ -13,7 +14,10 @@ export async function getTemplates() {
const filePath = path.join(paths.root, file);
const template = await fs.readFile(filePath, 'utf-8');
const { mtime } = await fs.stat(filePath);
const width = file?.split('-')[1]?.split('.')[0] === 'POS' ? 8 : 0;
const width =
file?.split('-')[1]?.split('.')[0] === 'POS'
? (fyo.singles.PrintSettings?.posPrintWidth as number)
: 0;
const height = file?.split('-')[1]?.split('.')[0] === 'POS' ? 22 : 0;

templates.push({
Expand Down
2 changes: 1 addition & 1 deletion schemas/app/PrintSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"fieldname": "posPrintWidth",
"label": "Pos Print Width",
"fieldtype": "Float",
"default": 10,
"default": 8,
"section": "Customizations"
}
]
Expand Down

0 comments on commit aeeebc3

Please sign in to comment.