Skip to content

Latest commit

 

History

History
102 lines (72 loc) · 3.38 KB

README.md

File metadata and controls

102 lines (72 loc) · 3.38 KB

ERPNext Documents Export

A simple command line utility to automatically export ERPNext or Frappe documents to PDF (and JSON).

Why? While using ERPNext we were looking for a way to always have our submitted sales and purchase invoices available in PDF format, for easy referencing. This simple tool does just that.

How to use?

Installation

ERPNext Documents Export is distributed as a binary executable, which you can download below. Alternatively you can run it with Bun directly.

Binary executable

For ease of use this tool is distributed as a single binary. It runs on Windows, macOS and Linux.

You can download it for different operating systems here:

With Bun

To install dependencies:

bun install

To run:

bun run index.ts

To build:

bun build ./index.ts --compile --outfile ede

# For Linux x64
bun build --compile --target=bun-linux-x64 ./index.ts --outfile ede-linux-x64

# For Windows x64
bun build --compile --target=bun-windows-x64 ./index.ts --outfile ede-windows-x64

# For Windows x64 (baseline version)
bun build --compile --target=bun-windows-x64-baseline ./index.ts --outfile ede-windows-x64-baseline

# For macOS arm64
bun build --compile --target=bun-darwin-arm64 ./index.ts --outfile ede-macos-arm64

# For macOS x64
bun build --compile --target=bun-darwin-x64 ./index.ts --outfile ede-macos-x64

This project was created using bun init in bun v1.1.0. Bun is a fast all-in-one JavaScript runtime.

Usage

All general options:

Options:
  -u, --url <url>            ERPNext URL
  -k, --key <key>            API key
  -s, --secret <secret>      API secret
  -h, --help                 display help for command

Commands:
  watch [options] <doctype>  watch for changes in ERPNext documents
  help [command]             display help for command

To watch a Frappe Doctype and automatically write all new documents to disk, use the watch command:

Usage: erpnext-documents-export watch [options] <doctype>

watch for changes in ERPNext documents

Arguments:
  doctype                      DocType to watch

Options:
  -t, --target-dir <dir>       target directory to save files (default: "./")
  -f, --print-format <format>  format to export
  -d, --date-field <field>     date field to use (default: "posting_date")
  -ds, --docstatus <status>    docstatus to filter on
  -ot, --output-template       output filename template (e.g. "{customer_name} - {name}")
  --include-json               also export JSON file
  -h, --help                   display help for command

For example, to export all submitted purchase invoices sorted by year/month:

ede-macos-arm64 -u https://your-erpnext-site.com -k YOUR_API_KEY -s YOUR_API_SECRET watch "Purchase Invoice" -t ./purchase-invoices -ds 1