Announcing the launch of the Saudi Zatca-2 E-Invoicing app on FrappeCloud

Pushed bug-fixes ( Correctred OID on CSR ) . please pull / update.
Lets know if anyone face any more issues.

If you get this error -
Failed to get method for command zatca_erpgulf.zatca_erpgulf.sign_invoice.create_csr with cannot import name ‘NameOID’ from ‘cryptography.hazmat._oid’ (/home/frappe/frappe-bench/env/lib/python3.8/site-packages/cryptography/hazmat/_oid.py)

Upgrade cryptography libraries with following command
env/bin/pip3 install pyOpenSSL --upgrade

If the above not working try this.
pip uninstall pyopenssl
pip uninstall cryptography
pip install pyopenssl
pip install cryptography

Error:
Failed to get method for command zatca_erpgulf.zatca_erpgulf.sign_invoice.create_csr with module ‘cryptography.utils’ has no attribute ‘Enum’

Upgrade cryptography libraries with following command
env/bin/pip3 install pyOpenSSL --upgrade

If the above not working try this.
pip uninstall pyopenssl
pip uninstall cryptography
pip install pyopenssl
pip install cryptography

Error
error in getting the tlv data value
error in getting the entire tlv data
error in getting the tlv data value: object of type ‘NoneType’ has no len()

Check TAX ID in compnay doc. 15 Digit VAT ID.

Is this app cover standard point of sales invoices ?

Working on it. Not yet implemented

On simplified invoice validation, old versions get a QR Validation Error because of the Arabic Name of the Company.

Error in complaince: {“validationResults”:{“infoMessages”:[{“type”:“INFO”,“code”:“XSD_ZATCA_VALID”,“category”:“XSD validation”,“message”:“Complied with UBL 2.1 standards in line with ZATCA specifications”,“status”:“PASS”}],“warningMessages”:,“errorMessages”:[{“type”:“ERROR”,“code”:“QRCODE_INVALID”,“category”:“QRCODE_VALIDATION”,“message”:“Invalid QR code format, Please follow the ZATCA QR code specifications”,“status”:“ERROR”}],“status”:“ERROR”},“reportingStatus”:“NOT_REPORTED”,“clearanceStatus”:null,“qrSellertStatus”:null,“qrBuyertStatus”:null}

This issue has been fixed by latest update. Please pull or change the company name to Arabic.

Hi Team,

This query is regarding the implementation of ZATCA KSA E-Invoicing.

I have gone through the video uploaded on YouTube and installed the Zatca app.

While configuring, I am unable to figure out the CSR Config part.

Could you please guide me on how to generate/create the CSR Config file and upload to the ERPNext.

CSR configuration should be in JSON format. See the above replies
CSR Conf

Zatca E-Invoicing Update


We have added a CR number field on the Company setting, it is requirement from Zatca

Please do the following on app/zatca_erpgulf folder

git pull

bench --site yoursitename migrate

bench restart

It will create a field called company registration in the company doctype. Enter CR Number there. ( Not VAT ID )

Error in complaince: {“validationResults”:{“infoMessages”:[{“type”:“INFO”,“code”:“XSD_ZATCA_VALID”,“category”:“XSD validation”,“message”:“Complied with UBL 2.1 standards in line with ZATCA specifications”,“status”:“PASS”}],“warningMessages”:[{“type”:“WARNING”,“code”:“BR-KSA-08”,“category”:“KSA”,“message”:“The seller identification (BT-29) must exist only once with one of the scheme ID (BT-29-1) (CRN, MOM, MLS, SAG, OTH, 700) and must contain only alphanumeric characters. Commercial Registration number with "CRN" as schemeID. Momrah license with "MOM" as schemeID. MHRSD license with "MLS" as schemeID. 700 Number with "700" as schemeID. MISA license with "SAG" as schemeID . Other OD with "OTH" as schemeID.In case of multiple commercial registrations, the seller should fill the commercial registration of the branch in respect of which the Tax Invoice is being issued. In case multiple IDs exist then one of the above must be entered following the sequence specified above.”,“status”:“WARNING”}],“errorMessages”:,“status”:“WARNING”},“reportingStatus”:“REPORTED”,“clearanceStatus”:null,“qrSellertStatus”:null,“qrBuyertStatus”:null}

If you get this error, you missed the CR number on Company settings.
There should be VAT number and CR number on company doctype.
We have added a custom field for CR on company doctype, pull the latest code.

@Support-at-ERPgulf while creating csr i am getting an error that

TypeError: create_csr() missing 1 required positional argument: 'company_abbr'
{
  "data": [
    {
      "company": "TT",
      "csr_config": {
      "csr.common.name": "TST-886431145-300970199900003",
      "csr.serial.number": "1-TST|2-TST|3-ed22f1d8-e6a2-1119-9b58-d9a9f11e874f",
      "csr.organization.identifier": "300990908800003",
      "csr.organization.unit.name": "300990908800003",
      "csr.organization.name": "Your Company name",
      "csr.country.name": "KSA",
      "csr.invoice.type": "1100",
      "csr.location.address": "RIYADH",
      "csr.industry.business.category": "Your company activities"
     }
    }
  ]
}

here is the csr configuration. @Zaid_Zaidu any idea?

Can you check selected company abbr in the company is same as in csr config ?

@Zaid_Zaidu when i checked the code of zatca_erpgulf

    create_csr: function (frm) {
        frappe.call({
            method: "zatca_erpgulf.zatca_erpgulf.sign_invoice.create_csr",
            args: {
                "portal_type":  frm.doc.select
            },
            callback: function (r) {
                if (!r.exc) {
                    frm.save();
                }
            },
        });
    },

there is no argument is passed in the code.
also i have this error i all the functions.
here is my screenshots




@Support-at-ERPgulf can anyone please explain this error.

@Support-at-ERPgulf @Zaid_Zaidu one more thing i want to know is that on saving the zatca erpgulf settings is the values are storing to any table in the database? but i got only zatca_success_log table on bench get-app zatca_erpgulf repo. Another this is that in the code functions of sign_invoice.py i can see many custom fields are being checked with company_doc where i dont have that fields added in my company table too. Is the fields are coming from the zatca_erpgulf on saving the settings? should i need to create fields in database? can anybody help in these doubts and clarify to me? @saud1 @rainoharvest @Ahmed01 @Usama_Naveed anyone please who have finished zatca phase 2 implementation.

any news.

In the new update, we have moved the Zatca setting to the company doctype and don’t use JSON format for the setting page fields. We hope this will reduce the confusion that many in this group complained about.

The Zatca setting page is still there, but it’s just for backward compatibility.

You can put CSR configuration on the Company page without JSON, as shown below.

csr.common.name=TST-886431145-399999999900003
csr.serial.number=1-TST|2-TST|3-ed22f1d8-e6a2-1118-9b58-d9a8f11e874f
csr.organization.identifier=399999999900003
csr.organization.unit.name=399999999900003
csr.organization.name=Test Company LTD
csr.country.name=SA
csr.invoice.type=1100
csr.location.address=RIYADH
csr.industry.business.category=Testing zatca

Also fixed some rounding issues.

Thanks for your feedback and suggestions.

See the latest update here.

See the latest update. No need to use ABBR or JSON format.