DEV Community

Cover image for Automating Intrastat Returns in Ireland From ERP Data
iCustoms
iCustoms

Posted on

Automating Intrastat Returns in Ireland From ERP Data

You can automate Intrastat returns in Ireland by extracting monthly EU movements from your ERP, mapping them to the five fields Revenue expects, validating codes and values before upload and filtering out Great Britain trade. Submission is the easy part. Reshaping ERP export data the same way every month is the real engineering problem.

The Data Model

Each movement on the return needs five fields. Here is where they usually live:

  • Nature of transaction (sale, return, repair): order or document type
  • 8-digit CN commodity code: item master
  • Partner member state: ship-from or ship-to country
  • Net mass or supplementary quantity: item master or delivery, depending on the commodity
  • Statistical value: invoice or delivery value

Why Validation Must Happen Upstream

Revenue's Return Preparation Facility (RPF) and its arrival and dispatch templates do not validate commodity codes or value consistency. Whatever your pipeline sends is what gets filed. The rules these checks enforce come from the full guide to Intrastat reporting for Irish importers and exporters.

A Minimal Pre-Filing Check

THRESHOLD_EUR = 750_000  # confirm the current figure with Revenue

def check_line(line):
    errors = []
    if not (line["cn_code"].isdigit() and len(line["cn_code"]) == 8):
        errors.append("CN code must be 8 digits")
    if line["partner_state"] == "GB":
        errors.append("GB trade goes on AIS/AES, not Intrastat")
    if line["net_mass_kg"] is None and line["supp_qty"] is None:
        errors.append("Net mass or supplementary quantity missing")
    return errors

def must_file(direction_total_eur):
    return direction_total_eur > THRESHOLD_EUR
Enter fullscreen mode Exit fullscreen mode

Keep Separate Totals Per Direction

Store arrivals and dispatches as two running totals. Each crosses the threshold on its own, and the obligation starts from that point, not retroactively.

Pull Codes From One Master Record

If a product carries different codes on AIS, AES and Intrastat, the datasets stop matching. Read the CN code from a single source for every filing.

Want this pipeline without building and maintaining it yourself? Watch a demo.

Top comments (0)