Skip to main content
VeriFactu

The VeriFactu Switch Environment button in Odoo: myths and facts

The Switch Environment button of VeriFactu España (AEAT RRSIF Compliance) switches the company's AEAT environment between Test (AEAT pre-production) and Production, but only after you type the company NIF. If the NIF does not match, the button stops and nothing is saved; if it matches and the chosen environment differs from the current one, it saves the new environment and shows a notice; if it is the same one, the window closes and nothing changes.

FlexigoTech · Editor in charge: Víctor Gómez · Updated 5 November 2026

Key facts

Module
VeriFactu
Versions
Odoo 17, 18, 19 and 20
Checked
in the module's source code, version 20.0 · against the sources linked at the end
Reading time
4 min

What is in the button's window

The Switch Environment button is in every published branch of the module (Odoo 17, 18, 19 and 20), and its view condition never hides it. In Odoo 20, when you press it, the button does what is described below. Purchase and version details are on the Odoo Apps listing.

The window that holds the button has, among others, these fields:

  • Company, in the Company group, read-only. In the code its default is the active company.
  • Confirm Company NIF, in the Confirmation group. Its help text reads: Type the company NIF to confirm the environment switch..
  • Switch to Environment, in the Target group, with the options Test (AEAT pre-production) and Production.
Diagram made with code from the module's published code, not an Odoo screen: the environment switch button and, to one side, the messages that go with it
Diagram made with code, not an Odoo screenshot: the button with its messages, the NIF mismatch one and the environment switched one.

Misconceptions about the button, one by one

Myth: "I press the button and the environment changes"

Fact: before touching anything, the button compares. First it works out the expected NIF: the NIF the company has set for VeriFactu and, if that is empty, the company's tax identification number. Then it compares that with what you typed in Confirm Company NIF. Only if they match does the button carry on.

Myth: "I have to copy the NIF exactly, capitals included"

Fact: the code strips the spaces at the start and end of both NIFs and compares them ignoring upper and lower case. Typing it in lower case, or with a stray space at the end, does not stop the switch. What does matter is which NIF is expected: if the company has its own NIF for VeriFactu, that is the one compared.

Myth: "If the NIF fails, the switch is left half done"

Fact: when it does not match, the button stops with this message: NIF confirmation does not match company NIF "…". Please type the exact NIF to confirm the environment switch.. In place of «…» it shows the company NIF the code expected, so the message itself tells you what to type.

The error stops the action and nothing it was going to change is saved: the company's environment stays as it was. The fix is what the message says: type that NIF in Confirm Company NIF and press Switch Environment again.

Myth: "If I pick the environment I am already on, it errors or applies it again"

Fact: the NIF is checked first, so even if the target is the current one you still need to type it correctly. If the NIF is right and the environment chosen in Switch to Environment is the one the company already has, the window simply closes: nothing changes and no notice appears. If the window closes with no message, that is what happened: the target matched the current environment.

Myth: "The switch leaves no trace"

Fact: when the chosen environment differs from the current one, the button asks the company to make the change. That company method checks again whether the environment is already the requested one and, if not, writes the new environment. After that, the code records an informational line in the Odoo log with the company name, the new environment and the name of the user who did it.

Finally, the screen shows a success notification. Its title is Environment Switched and its message is AEAT environment switched to "…"., with the chosen environment in place of «…». That notice is what the button gives when it finishes.

Myth: "This button is only in Odoo 20"

Fact: the button is in branches 17.0, 18.0, 19.0 and 20.0, and the module is published on Odoo Apps for those versions. With Odoo in Spanish it is called Cambiar Entorno; in Catalan, Canviar Entorn; in English, Switch Environment.

Diagram made with code from the module's published translations, not an Odoo screen: the button text in Spanish and in Catalan
Diagram made with code, not an Odoo screenshot: the button is called Switch Environment in Spanish and Cambiar Entorno in Catalan.

The button's order of work, start to finish

In short, and going by the Odoo 20 code, this is what happens when you press Switch Environment:

  1. The company's expected NIF is worked out and compared with the one you typed, ignoring spaces at the ends and upper or lower case.
  2. If they differ, the NIF message appears and everything stops: nothing is saved.
  3. If they match and the target is the current environment, the window closes with no notice.
  4. If the target is a different environment, the new one is written to the company and a line goes into the log with the company, the environment and the user.
  5. The Environment Switched notification is shown.

To see what the module adds to invoices, there is what it adds to invoices; and if you are curious about another button in the module, with the same format, there is the Generar Exportación one.

How FlexigoTech can help

FlexigoTech implements Odoo 17, 18, 19 and 20 and builds custom connectors and integrations. If you are preparing the VeriFactu go-live in your Odoo and want someone to review the company data before you switch environment, get in touch.

Keep reading

What VeriFactu España adds to the Odoo invoice and when it actsThe fields VeriFactu España adds to the Odoo invoice, when it creates the record on posting and how to check it has acted, step by step.«Only a SIF Manager can retry AEAT submissions.»: when it appears and what to doWhat the VeriFactu message «Only a SIF Manager can retry AEAT submissions.» means in Odoo: when it appears, which buttons trigger it and how to fix it.What the Generate Export button in VeriFactu España does in OdooWhat the Generate Export button in VeriFactu España for Odoo does: who can see it, what each export type produces and the event it logs.
Checked in the module's source code (version 20.0) and the linked sources

Sources