The problem nobody tells you about the ATS in Odoo
Imagine this situation: you have been working with Odoo at your company in Ecuador for months. Invoices, collections, withholdings... everything seems to flow correctly. Then comes the time to generate the Simplified Transactional Annex (ATS) for the SRI, and you download it with confidence.
You open the XML file, check the sales section, and there is the problem:
<detalleVentas>
<tpIdCliente>04</tpIdCliente>
<idCliente>1790012345001</idCliente>
<tipoComprobante>18</tipoComprobante>
<baseImponible>5000.00</baseImponible>
<valorRetIva>0.00</valorRetIva>
<valorRetRenta>0.00</valorRetRenta>
</detalleVentas>
valorRetIva: 0.00. valorRetRenta: 0.00.
But you know that customer gave you a withholding. You recorded it in Odoo, posted it, and the voucher is there. So why does the ATS say there is no withholding?
The short answer: Odoo is not reading that data. The internal method that generates the sales section of the ATS initializes both fields to zero and never fills them with the actual withholding values received.
And no, it is not something you are doing wrong. It is an omission in the base code of the l10n_ec_reports_ats module that affects all Ecuadorian companies using Odoo Enterprise.
Why this matters more than it seems
You might think: "well, the SRI hasn't rejected my ATS yet." And that is possible. But consider the following:
- Tax inconsistency: If your customer declares they withheld $600 of VAT from you, but your ATS says you received no withholding, there is a discrepancy the SRI can detect in its information cross-checks.
- Future audits: An ATS with zero withholdings when there should be real amounts is a red flag for any auditor.
- Wasted time: Many accountants end up editing the XML by hand before uploading it to the SRI. Every month. For every customer.
Veronica's story: editing XML every month
Veronica is an accountant at a food distributor in Guayaquil. Every month, after generating the ATS from Odoo, she would open the XML in a text editor and look for each sales record where she knew she had received withholdings. One by one, she replaced the zeros with the correct amounts taken from the withholding vouchers.
"In a good month it was 15 or 20 customers with withholdings," she says. "In peak season, more than 40. It would take me a whole morning just to correct the file."
Veronica did not know the problem was neither hers nor her team's. It was the system's.
What exactly causes the problem
For those who want to understand the technical detail (without needing to be a programmer), here is the simplified explanation:
Odoo generates the ATS through an internal method called _get_sales_info_by_partner. This method goes through the sales invoices, groups the information by customer, and generates the fields the SRI requires. However, when it reaches the sales withholding fields, it does this:
# Original Odoo code (simplified)
resultado = {
'baseImponible': base_calculada,
'valorRetIva': 0.0, # Always zero
'valorRetRenta': 0.0, # Always zero
}
The values are initialized to zero and the withholding records are never queried (out_withhold) that Odoo itself correctly stores in the database.
The data is there. Odoo simply does not read it when building the XML.
The solution: a free module that installs in 2 minutes
We have developed a module called ATS Sales Retention (l10n_ec_ats_sales_retention) that automatically fixes this omission. It is free, open source, and requires no additional configuration.
How it works
The module extends the original method to add an extra step after Odoo generates the base data:
- Calls the original method (preserving all existing behavior).
- Searches the database for all withholding records (
out_withhold) that are in posted state and linked to the sales invoices of the period. - Filters by tax type:
withhold_vat_salefor VAT withholdings.withhold_income_salefor income tax withholdings.
- Adds up the amounts and assigns them to
valorRetIvaandvalorRetRentain the correct ATS group.
The result in the XML changes from this:
<valorRetIva>0.00</valorRetIva>
<valorRetRenta>0.00</valorRetRenta>
To this:
<valorRetIva>72.00</valorRetIva>
<valorRetRenta>17.50</valorRetRenta>
Veronica's story (continued)
After installing l10n_ec_ats_sales_retention, Veronica generated next month's ATS directly from Odoo. She opened the XML expecting to have to correct it as usual.
"I checked the first three customers and the amounts were already correct. I checked five more. All good. I did not have to change a single number."
What used to take her a whole morning now takes exactly zero extra minutes.
Step-by-step installation
You do not need to be a programmer. If you can install a module in Odoo, you can solve this problem right now.
Step 1: Download the module
Download l10n_ec_ats_sales_retention from the Odoo App Store and place it in your custom addons directory.
Step 2: Update the app list
In Odoo, go to Apps and click Update Apps List.
Step 3: Search and install
Search for "ATS Sales Retention" in the apps list and click Install.
Step 4: There is no step 4
Seriously. There is nothing to configure. The module starts working automatically the next time you generate the ATS.
Requirements
- Odoo 18 Enterprise (compatible with Odoo.SH and on-premise deployments).
- The
l10n_ec_reports_atsmodule must be installed (it is the standard ATS module that comes with the Ecuadorian localization).
Is it safe? What happens if Odoo fixes the problem in the future?
This is a question we are asked frequently, and the answer is: we designed it with that in mind from the start.
Built-in proactive protection
The module includes an automatic check: if in a future version of Odoo the original method already returns non-zero values for valorRetIva or valorRetRenta, l10n_ec_ats_sales_retention it detects that the problem has already been fixed and deactivates itself automatically. It does not duplicate amounts or create conflicts.
In short: you can leave it installed indefinitely. The day Odoo fixes it natively, the module will simply stop doing its job because it will no longer be needed.
Risk-free uninstall
If you ever decide to uninstall it, the operation is completely clean:
- It does not create new tables in the database.
- It does not add fields to existing models.
- It does not modify XML views.
- It does not generate data records.
The module is, literally, a pure logic extension. It installs cleanly and uninstalls cleanly.
Carlos's story: the cautious administrator
Carlos is the IT manager of an importing company in Quito. When his accountant asked him to install the module, his first reaction was the same as any responsible administrator's: "What if I can't remove it later?"
He reviewed the documentation, saw that the module did not touch the database, and decided to test it first in the Odoo.SH staging environment. He installed it, generated the ATS, verified that the numbers added up, and uninstalled it to confirm it left no trace.
"I installed it in production that same afternoon," says Carlos. "It's the kind of module that should come included in Odoo."
How to verify it is working correctly
After installing l10n_ec_ats_sales_retention, you can run a quick test with these scenarios:
Scenario 1: Basic VAT withholding
- Create and post a sales invoice.
- Record a customer withholding (
out_withhold) with a VAT withholding tax (for example, 10%). - Post the withholding.
- Generate the ATS from Accounting, Reporting, Tax Report, ATS.
- Open the XML and look for that customer's record.
Expected result: valorRetIva shows the actual withholding amount. valorRetRenta stays at 0.00 (because you did not apply an income tax withholding).
Scenario 2: Combined VAT and income tax withholding
- Create a sales invoice and record a withholding with both types: VAT and income tax.
- Generate the ATS.
Expected result: Both fields show the correct amounts.
Scenario 3: Cancelled withholding
- Record a withholding and then cancel it.
- Generate the ATS.
Expected result: The amounts of the cancelled withholding do not appear in the XML. Only posted withholdings are included.
Frequently asked questions
Does this module affect purchase withholdings?
No. The module only modifies the sales section (<ventas>) of the ATS. The withholdings your company applies to its suppliers (in_withhold) are handled separately and are not affected.
Does it work with multi-company?
Yes. The module uses Odoo's standard infrastructure and fully respects company boundaries.
Do I need to do anything after updating Odoo?
No. Thanks to the proactive protection, the module adapts automatically. If an Odoo update fixes the problem, the module detects it and stops intervening.
Which Odoo versions does it work with?
It is currently available for Odoo 18 Enterprise. It is compatible with Odoo.SH and on-premise deployments.
Conclusion
The ATS is a monthly tax obligation for all Ecuadorian companies. If you use Odoo, there should be no gap between what actually happens in your accounting and what the system reports to the SRI.
l10n_ec_ats_sales_retention This module closes that gap. It installs in minutes, needs no configuration, protects itself against future Odoo fixes, and can be uninstalled without leaving a trace.
It is free because we believe correct tax information should not be a luxury.
Download the free module and fix your ATS today
Stop editing the XML by hand. Install the module, generate your ATS, and check that the numbers finally add up.
Do you need to implement Odoo in Ecuador?
At Ganemo we are an Odoo partner and we develop Latin American localization apps. We implement, migrate, and customize Odoo for Ecuadorian companies, with dedicated support in Spanish.