Disable ZATCA Configuration in Odoo During Database Restore

Odoo’s Integration with ZATCA

by Syed Awais

The Zakat, Tax, and Customs Authority (ZATCA) is a government agency under the Ministry of Finance in Saudi Arabia, responsible for the assessment and collection of taxes and zakat, a form of obligatory almsgiving in Islam.

Odoo's latest versions are compatible with ZATCA, allowing companies to sync their taxes and zakat without any hassle. The ZATCA e-invoicing system in Odoo is designed to streamline and digitize the invoicing process for businesses operating in Saudi Arabia. This system converts traditional paper invoices and notes into an electronic format, enabling the exchange and processing of invoices, credit notes, and debit notes between buyers and sellers through an integrated electronic solution.

User Story: Database Synced to ZATCA

One of our clients is currently using Odoo with its database synced to ZATCA, where invoices are automatically synchronized. They wish to customize their invoicing flow and have engaged Numla for this task. To develop and test the new customized flow, our development team requires a database backup. During this process, invoices will be created and may be synced with ZATCA, potentially causing issues. To avoid these complications and proceed with the customization work, it is necessary to temporarily disable the ZATCA configuration.

As the API integration will be in production, Odoo will not permit changes. This document outlines the steps to disable the ZATCA configuration.

Steps to Disable ZATCA Configuration

1. Access ZATCA API Mode
  • Navigate to Settings > Accounting page.
  • Locate the ZATCA API mode.
Access ZATCA API Mode in Odoo
2. Modify Validation Settings
  • Search for the following text in the module: raise ValidationError(_("The %s of a subsidiary must be the same as its root company.", description)) by pressing CTRL+SHIFT+F.
  • Ensure the search is within the Odoo addons directory.
  • The text can be found in the file located at /odoo-17.0/odoo/addons/base/models/res_company.py.
  • Comment out the function that raises the validation error and save the changes.
@api.constrains('active')
def _check_active(self):...
# @api.constrains(lambda self: self._get_company_root_delegated_field_names()
# + ['parent_id'])
# def _check_root_delegated_fields(self):
#     for company in self:
#         if company.parent_id:
#             for fname in company._get_company_root_delegated_field_names():
#                 if company[fname] != company.parent_id[fname]:
#                     description = self.env['ir.model.fields'].
#                     l_get("res.company", fname).field_description
#                     raise ValidationError(_("The %s of a subsidiary must be
#                     the same as it's root company.", description))
def open_company_edit_report(self):...
def write company and print report(self):...
3. Change API Mode
  • Return to Settings > Accounting page and change the API Mode to Simulation (Pre-Production).
Change ZATCA API Mode in odoo
4. Verify Journal Settings
  • Ensure that a journal is attached in the journal field, as this is a required field. If no journal exists, create a dummy journal with the type "Miscellaneous."
5. Update Company Settings
  • Go to Settings > Users & Companies > Companies.
  • Open each company and uncheck the "Allow ZATCA e-invoicing" field. Repeat this step for all companies.
Uncheck Allow ZATCA e-invoicing in company settings in Odoo
6. Backup and Restore Database
  • After completing the above steps, take a backup of the database.
  • Restore the database on the server as needed.

By following these steps, you will be able to disable the ZATCA configuration easily, allowing for customization and development work without syncing issues.

Need help with Odoo and ZATCA integration?


Numla provides expert customization to streamline your processes.

Contact Us Today

في ERP
How to Set Up Shipping Policies in Odoo 17 Inventory App