JPK MAG in ERPNext

A configurable warehouse file built from ERPNext data and prepared for handover through the Polish Ministry of Finance JPK gateway.

  • JPK MAG(1) and JPK MAG(2) in one application
  • Rules and mappings set in ERPNext, no programming

About the application

JPK MAG is a structure with data on stock movements that a company hands over on request of the tax authority. The summons sets the deadline, which is not shorter than 3 days. The JPK Magazyn application builds the file data from ERPNext documents, so nobody has to assemble it by hand under deadline pressure.

One file covers one warehouse. Values are in PLN, and foreign-currency documents are converted to zloty. Only submitted documents go into the file, so drafts in ERPNext never reach the JPK.

The application runs on Frappe and ERPNext 16. It is part of the ERPNextPL Polish localisation, alongside the KSeF and GUS integrations. These are Polish statutory requirements, so the documentation of the application itself is in Polish.

Two schema versions

The schema version depends on the report period, not on the day the file is generated. The application picks the right one and guards the boundary between them.

Report periodSchemaKey differences
up to 31 Dec 2026JPK MAG(1)Quantity-and-value method, PZ, WZ, RW and MM documents.
from 1 Jan 2027JPK MAG(2)Four accounting methods, PW, MMWE, MMWY and INW documents, KSeF numbers.

A period that crosses 1 January 2027 has to be split into two files.

What you can configure

The rules by which ERPNext turns stock movements into JPK documents are set in the system. Default values are installed together with the application.

Warehouse profiles

Each warehouse has its own profile and accounting method: quantity and value, quantity only, value only, or expensing on the day of purchase (JPK MAG(2)).

Document classification rules

A purchase receipt becomes PZ, a delivery to a customer becomes WZ, internal movements become PW, RW or transfers. The rules can be changed. A movement with no matching rule stops the report with a message instead of silently disappearing.

Descriptive field mapping

Supplier, recipient, invoice number and date, and the KSeF number are read from the fields you choose. A visual editor with JSON import and export makes it easy to move settings between sites.

Company and tax office data

JPK seat data, a dictionary of tax offices and validation of the Polish address. Errors surface before sending, not after.

Roles and permissions

JPK Manager configures and prepares reports, JPK Viewer has read access. Users without a role do not see the JPK settings.

Stock count from Stock Reconciliation

A submitted physical stock count goes into the INW section of JPK MAG(2), even when it showed no differences. A count without differences needs explicit consent when saved.

Process: from summons to UPO

1

Readiness panel

Checks the warehouse profile, company data, period, schema version and movement classification before a report is created.

2

JPK MAG report

Data from submitted stock documents for the chosen period and warehouse, saved as XML in the right schema version.

3

XSD validation

The file is checked against the Ministry of Finance schema. You see an error immediately, not after the gateway rejects the file.

4

Package and signature

Compression, splitting into parts of up to 60 MB, and encryption. Signing the metadata as the gateway specification requires is still in preparation in the interface.

5

Sending and UPO In preparation

Planned: handing the package over to the Ministry of Finance JPK gateway and receiving the official confirmation of receipt (UPO).

Connection to the Ministry of Finance JPK gateway

The application prepares the package as the specification of the Ministry of Finance JPK gateway requires. Handing the package over to the gateway and receiving the UPO from within ERPNext are in preparation, and we mark this on each feature.

Package encryption

File parts are encrypted with AES-256 and the key with the public MF certificate. The public MF test and production certificates are part of the application.

Qualified signature or trusted profile In preparation

An XAdES signature from a PKCS#12 certificate, or an external path: you download the metadata file, sign it with your trusted profile on gov.pl and upload it back.

Status and UPO In preparation

Planned: sending status and the confirmation of receipt visible in ERPNext, plus a warning if the UPO does not appear within 24 hours.

Keys under your control

The certificate file is kept in Frappe private files and the password in a Password field. Using PKCS#12 in production has to be switched on deliberately.

Availability

The application is developed in stages. Status as of October 2026:

  • Ready: configuration of profiles, rules and mappings, the readiness panel, reports with period and schema version checks, the XML serialization engine for both versions, XSD validation, package preparation and encryption.
  • In preparation: generating the final file and sending it to the MF gateway from the ERPNext interface.

Note: in its current specification the MF gateway lists JPK MAG(1). We will confirm JPK MAG(2) support before 2027, based on a newer specification.

Price and licence model will be announced when the work is finished. Write to us and we will tell you when it starts, and propose an implementation as part of the Polish localisation.

A good fit if

  • you run ERPNext 16 with the stock module and keep electronic accounting books
  • you want to be ready for a JPK MAG summons before it arrives
  • you have several warehouses and need a separate file for each
  • you are preparing for JPK MAG(2) from 2027 and want to check that your stock movements classify correctly
  • you want rules that can be changed without writing code

Frequently asked questions

Is JPK MAG filed periodically?

No. JPK MAG is handed over on request of the tax authority, by the deadline in the summons, which is not shorter than 3 days.

What if the company has several warehouses?

A separate file is prepared for each warehouse. In the application every warehouse has its own profile.

How do I correct an error in a file that was already sent?

JPK structures filed on request are not corrected. You agree the fix with the authority and hand over a new file. In the application you cancel and amend the report, and the previous one stays in the history.

Who can sign the package?

A qualified signature or a trusted profile (Profil Zaufany). A person signing on behalf of the company needs a UPL-1 power of attorney filed with the tax office.

What are the technical requirements?

Frappe Framework 16 and ERPNext 16 in the same bench, and Python 3.14. Installation is standard: bench get-app and bench install-app. As part of an implementation we do it for you.

JPK MAG in your ERPNext

Let us talk about preparing your warehouse for JPK MAG and about when the application launches.