---
title: "Export Management \u2014 Data Model & Print Formats"
space: "Wiki"
url: "https://jmtradelink.com/docs/export-management"
updated: "2026-07-05"
---

# Export Management — Data Model & Print Formats

Documentation of the export document system: the data model added, the reusable Quality Inspection flow, and the five generated print formats.

## Print formats
Five branded, letterhead-driven print formats, each matching the client's source document:

| Format | Attaches to | Source |
|---|---|---|
| Proforma Invoice | Export Costing | PI |
| Sale Contract | Export Costing | Sale Contract |
| Commercial Invoice | Export Shipment | Commercial Invoice |
| Packing List | Export Shipment | Packing List |
| Quality & Quantity Certificate | Export Shipment | Q&Q Certificate |

Each renders the JM Chandak letterhead (header + footer) via a Letter Head, the exporter seal from **Export Settings → Signature / Seal**, and pulls commodity quality from the Quality Inspection template.

## Fields created

### Export Shipment
- `notify_parties` — child table (**Export Shipment Notify Party**: party_name, party_address); replaced the old single notify-party fields
- `shipping_bill_no`, `shipping_bill_date`
- `ectn_no`
- `marine_cover_policy_no`, `marine_cover_policy_date`
- `fob_value`, `freight_value`, `insurance_value` (EUR CIF split, copied from the costing)
- `crop_year`

### Export Costing
- `shipment_terms`, `transhipment`, `pi_validity_date`

### Export Settings
- `contact_person`, `website`, `lut_no`
- `contract_terms` — Link → Terms and Conditions
- `document_terms` — child table (**Export Settings Document Terms**: document_type → terms) mapping each document to its T&C
- `signature_seal` — the exporter stamp image

### Item (custom fields)
- `botanical_name`, `hs_code`

## Quality Inspection flow
Quality is modelled with ERPNext's **Quality Inspection** framework — no bespoke moisture/broken/damage fields.

1. **Quality Inspection Parameter** masters: Moisture, Damage & Discolour, Black & Black Pics, Broken, Length, Cleaning, Free From.
2. **Quality Inspection Template** per rice grade (e.g. `IR64 Export Spec`) pairs each parameter with its agreed value (Moisture → 14% Max, Broken → 5%, ...).
3. **Item** links via the standard `quality_inspection_template` field; `brand` gives the bag marking.
4. **Print formats** read `Item → template → parameter rows` and render the quality block live — edit the template in the UI and it flows to every document.

Actual measured values live in a **Quality Inspection** (Outgoing) doc per batch; wiring the Q&Q certificate to read those (instead of the template's agreed values) is the next enhancement.

---

## How to populate the fields

The fields are containers — some **auto-derive**, others you **type once at the right stage**.

### Quality Inspection — set up once per rice grade
The quality block on the PI / Sale Contract / Q&Q Certificate is **not typed per document**; it is read live from the commodity Item's Quality Inspection Template.

**Step 1 — Parameters** (already seeded): Moisture, Damage & Discolour, Black & Black Pics, Broken, Length, Cleaning, Free From. Add a `Quality Inspection Parameter` only if you need a new criterion.

**Step 2 — Quality Inspection Template** (where you type the spec values): open `Quality Inspection Template` → `IR64 Export Spec` (or **New** per grade). For each parameter add a row:
- **Parameter** = e.g. Moisture
- untick **Numeric**
- **Acceptance Value** = the text that prints, e.g. `14% Max`

Repeat for Broken → `5%`, Length → `5.9 mm (Average)`, Free From → `Abnormal Odor / Mud & Stones / Weevils & Insects`, etc. **This table is the source of truth for the agreed spec.**

**Step 3 — Link to the Item** (once per grade): open the commodity **Item** → Quality tab → set **Quality Inspection Template**. Also set **Brand** (= bag marking, e.g. RIZBERRY), **Botanical Name**, **HSN/HS Code**.

Done — every print format now reads `Item → template → rows` automatically. Change the template and all documents update. Actual measured lab values (vs the agreed spec) belong in a `Quality Inspection` (Outgoing) doc against the shipment — a later enhancement to wire into the Q&Q certificate.

### Where every other value comes from

| Field(s) | Where you set it | How |
|---|---|---|
| Export Settings: contact_person, website, lut_no, bank_details, signature_seal (seal image), contract_terms, document_terms | Export Settings (one-time org setup) | Type / upload once; map each document_type → Terms and Conditions in the document_terms table |
| Item: brand, botanical_name, hs_code, quality_inspection_template | Item (once per commodity grade) | Type / link (see Step 3) |
| Export Costing: shipment_terms, transhipment, pi_validity_date | Export Costing (per quote/deal) | Type when preparing the costing |
| Export Shipment: consignee, notify_parties (child rows), payment_terms, invoice_no, bl_no, vessel, ports | Export Shipment (per shipment) | Type as the shipment firms up |
| Export Shipment: shipping_bill_no/date, ectn_no, marine_cover_policy_no/date, crop_year | Export Shipment | Type as those documents arrive (CHA / customs / insurer) |
| Export Shipment: fob_value, freight_value, insurance_value | **auto** | Copied from the linked Export Costing (EUR) when the shipment is created via make_shipment — editable if needed |

### Mental model
- **Set once (masters):** Export Settings (branding / seal / terms) + Item (brand, spec template, HSN, botanical).
- **Per deal:** Export Costing (price, terms, validity).
- **Per shipment:** Export Shipment (parties, doc numbers) — the CIF split auto-flows from the costing, the quality auto-flows from the Item.

The only place you type quality numbers is the **Quality Inspection Template**; everything downstream derives from the Item and Costing links.
