pennylane-supplier-invoiceslisted
Install: claude install-skill Xileades/pennylane-api-toolkit
# Supplier invoices: mail → Pennylane
**Prerequisite: `pennylane-access`** (loading, companies, tokens, amounts, VAT).
Scopes: `supplier_invoices:all`, `suppliers:all`, `file_attachments:all`.
**Guiding rule: automatic when it is certain, ask when it is not.** Never import
an invoice whose entity, supplier or amounts are uncertain without validation.
## Step 0 — Shared journal and lock
```powershell
PLJournalLock # refuses if someone else is running a batch
$journal = PLJournalRead
```
The journal is **common to the team**, so an invoice already handled by someone
else does not go in twice. A refused lock means **wait** — do not force it
without confirming the other session is dead. `PLJournalRelease` at the end of
the run, on success and on failure.
Period to process: since `$journal.lastProcessed`, else the last 30 days.
## Step 1 — Find the invoice mails
Search the relevant mailboxes for: invoice, receipt, bill, subscription,
statement — bounded by date, and paginate.
Discard: mere mentions of invoices, sales issued *by* the entities, order
confirmations. Keep invoices, receipts and credit notes.
Deduplicate on the internet message-id **and** against the journal:
```powershell
PLSeen $journal $party $number $date $amount
```
## Step 2 — Obtain the PDF
- **PDF attachment** → the simple case.
- **Link** → check domain coherence first (anti-phishing). A direct PDF can be
fetched; a portal behind a login means browser automation, or asking for th