MODULES / FINANCE

Pakistan FBR Digital Invoicing

Submit posted customer invoices to FBR, retain validation history and print the FBR invoice number on documents.

Overview

Module idask_fbr_pakistan
Version1.0.0
Who uses itAnyone who uses the screens listed below.
InstalledOn demand, from Settings → Modules. Anything it needs is installed with it.

Where to find it

AccountingFBR submissions

The menu entries appear once the module is installed and your role allows them.

How it links to other modules

  • Needs: Accounting, Invoicing
  • Works better with: no other module in particular
  • Needed by: no other module

A module that is needed cannot be turned off while the module that needs it is on.

Details

Pakistan FBR Digital Invoicing

ASKERP port of the Asksol Odoo module ask_fbr_pakistan (18.0.1.2.0, D:\Odoo18\asksol\custom_addons\ask_fbr_pakistan). It submits posted customer invoices and credit notes to the FBR Digital Invoicing (DI) API and works the same way as the Odoo module, with the differences listed below (DECISIONS D112).

Configure (Settings → FBR)

  • Environment: Sandbox or Production, each with its own editable URL. Only https:// addresses on fbr.gov.pk that point to postinvoicedata are accepted, so the token is never sent to another host. Validate with FBR calls the same URL with validateinvoicedata.
  • Security token: encrypted at rest and never shown again.
  • Seller NTN/CNIC, province and address.
  • FBR line tax accounts: FED payable, further tax payable, extra tax payable, and sales tax withheld (receivable). These are needed only when an invoice uses those taxes.
  • Allowed scenarios: the scenarios your NTN is registered for. If none are ticked, all 28 are allowed.

Customers: NTN/CNIC, FBR province, Registration Type (Registered / Unregistered). Products (FBR tab): HS code (searched from the 9,010-code FBR master, and only listed codes are accepted), HS unit of measure, SRO schedule and item, optional sale-type override, a 3rd Schedule flag, and default FED / further / extra / withholding %.

Use

  1. Create the invoice or credit note and choose the FBR Scenario in the form. The *Required data* box shows what FBR expects for that scenario.
  2. Each line has FBR fields for FED %, Further %, Extra %, WHT % and 3rd Schedule. When you pick a product, these are filled from the product's defaults. The percentages apply to quantity × unit price before discount, as in Odoo.
  3. Post the invoice. FED, further and extra tax are credited to their accounts, and withholding is debited. The invoice total, the receivable and the FBR payload all show the same figures. The PDF prints a separate row for each tax.
  4. Validate with FBR checks the invoice without issuing it. Submit to FBR issues it. An accepted FBR number and a QR code are printed on the PDF.
  5. A credit note is sent as a "Debit Note". It references the original invoice's FBR number and keeps that invoice's scenario and rates.

Each attempt keeps its payload and FBR's response in the invoice history and in Accounting → FBR Submissions. The submission report can be filtered by date, result, operation and scenario, and exported as PDF/XLSX with invoice drill-downs. A timeout or interrupted request locks the invoice until an administrator records the portal check, because FBR's POST has no idempotency key.

Scenario rules (from the Odoo _scenario_snNNN functions)

  • Sale type per scenario. The SRO is fixed for SN012, SN013, SN015, SN020, SN022, SN023 and SN025. The product's SRO is required for SN005, SN006, SN007 and SN024.
  • SN006 is sent as Exempt with no sales tax and a total value of 0. SN007 is sent at 0% with zero extra taxes.
  • SN008 sends the line's retail value (qty × price) as fixedNotifiedValueOrRetailPrice. Discounted lines must be flagged 3rd Schedule, so that sales tax is charged on the retail value.
  • SN017 follows PRAL's sample: FED is collected inside sales tax, so the retail value, total and extra taxes are all 0 and no SRO is sent.
  • SN001 requires a Registered buyer and SN002 an Unregistered buyer.

Differences from the Odoo module

  • FED, further, extra and withholding tax are posted to the ledger. In Odoo they are only shown in the totals widget, so the ledger and FBR disagree.
  • Where Odoo would send figures different from the posted invoice, ASKERP refuses and explains why. Examples: extra taxes on SN007 or SN017, sales tax on SN006 or SN007, or a discounted SN008 line that is not flagged 3rd Schedule.
  • discount is sent as an amount, as the FBR DI API v1.12 specifies, not as Odoo's percentage. rate keeps its decimals (for example 1.43%) instead of being truncated.
  • Not ported: - the cookie string (the API authenticates with the bearer token) - FBR taxes on sales orders (invoices take the product defaults instead) - editable scenario records (the guidance text is in scenarios.ts)

Production use requires the taxpayer's arrangement with an FBR-licensed integrator or PRAL. ASKERP does not claim to be a licensed integrator. Tests use fake responses and never contact FBR.

Pakistan FBR Digital Invoicing | ASKERP Docs