# Configure the fiscal operation, its lines and the CFOP

> Configure the fiscal operation that gives the fiscal documents their name, purpose and CFOP, create the lines that separate taxpayer, non-taxpayer, resale.

Fonte: https://docs.kmee.com.br/en/odoo/localizacoes/brasil/tributacao/operacoes-e-cfop/

Configure the fiscal operation that gives the fiscal documents their name, purpose and CFOP, create the lines that separate taxpayer, non-taxpayer, resale, production and ST, and define which operation each company uses in sales, purchases and inventory.

## Before you start

Use a user with the Fiscal Manager profile and have the list of CFOPs your accountant defined for each type of sale and purchase. To change an approved operation, click **Back to Draft**, adjust it and approve it again.

## Step by step

### 1. Open the operation

Open **Fiscal > Configuration > Operations > Operation** and choose the operation, for example **Venda**. The header has the name, the code, the **Type** (Incoming or Outgoing), the **Fiscal Type** (Sale, Purchase, Return, Other) and the **Purpose**.

The operation name is the nature of the operation of the fiscal document: it goes to the natOp (nature of operation) tag of the XML and to the Natureza da operação field of the DANFE. The purpose goes to the finNFe (purpose of the document) tag: Normal for a regular sale, Goods Return for the return document, Complementary and Adjustment for the correction documents.

### 2. Define the return and the journal

In the operation, fill in the **Return Operation**: it is the operation Odoo uses when you reverse an invoice of this operation. Venda returns through **Devolução de Venda**, and Compra through **Devolução de Compras**.

In the **Account** tab, choose the journal. The invoice created with this operation goes to that journal.

### 3. Create or review the lines

In the **Operation Line** tab, each line is a scenario of the operation. Open a line and fill in only the conditions that separate this scenario from the others:

- **ICMS Taxpayer**: 1 for taxpayer, 2 for taxpayer exempt from state registration, 9 for non-taxpayer;
- **Product Fiscal Type**: Goods for Resale, Finished Product, Use and Consumption Material, Fixed Asset, Service;
- **ICMS or ISSQN Tax**: separates goods from services;
- **Origin**: separates domestic from imported products;
- the regime fields, in the Company and Partner boxes, separate Simples Nacional from the normal regime.

Leave blank what does not matter for that scenario. The line with more conditions filled in wins over the more generic one.

### 4. Enter the three CFOPs of the line

In the **General** tab of the line, enter the **Internal CFOP** (same UF), the **External CFOP** (another UF) and the **Foreign CFOP** (another country). Odoo uses one of them according to the customer billing address.

Example from the Venda operation: the **Revenda** line has 5102, 6102 and 7102; the **Revenda não Contribuinte** line has 5102, 6108 and 7102; the **Revenda ST** line has 5403 and 6403. When the line CFOP is a tax substitution CFOP, Odoo marks the line as **ICMS ST?** and uses it for products subject to ST at the destination.

### 5. Separate the document type and the series

In the line, the **Document Type** separates items that go in different documents. The **Prestação de Serviço** line uses the NFS-e: in a sales order with goods and services, Odoo generates an NF-e for the goods and an NFS-e for the services.

In the **Fiscal Documents** tab of the operation, indicate the series each company uses for each document type. Without this indication, Odoo uses the first active series of the company for that document type.

### 6. Approve the operation

With the lines ready, click **Approve**. The operation and its lines change to **Approved** and become available in orders and invoices. A line in **Review** is left out of the choice until it is approved.

### 7. Define the default operation of each company

Open **Fiscal > Partners > Company**, choose the company and, in the **Fiscal** tab, fill in the **Default Sales Fiscal Operation**, in the **Sales** subtab, the **Default Purchase Fiscal Operation**, in the **Purchases** subtab, and the incoming and outgoing operations of the **Inventory** subtab. The sales order opens with the default sales operation, the purchase order with the purchase one, and the inventory transfer without a source order uses the incoming or outgoing inventory operation. In the order, you can change the operation of the whole order or of one item.

### 8. Check it in an invoice

Create a draft invoice for a taxpayer customer in Porto Alegre, with a table for resale. The **Operation Line** column shows **Revenda**, and the item comes out with CFOP 6102. Change the customer to one from Belo Horizonte registered as a non-taxpayer: the line changes to **Revenda não Contribuinte** and the CFOP to 6108. After confirming, check the CFOP in the prod/CFOP (CFOP of the item) tag of the XML and in the CFOP column of the DANFE.

## Expected result

The operation is approved, with the lines that cover your customers and products, the three CFOPs of each line, the return and the series. Each fiscal document comes out with the correct nature of the operation and CFOP.

## If something goes wrong

- The operation does not appear in the order: check that it is **Approved** and that its type matches the document, outgoing for sales and incoming for purchases.

- The item came out without an operation line: check the **Product Fiscal Type** of the product in the active company and the customer **ICMS Taxpayer**, and create a line that matches them.

- The reversal asked for a return operation: fill in the **Return Operation** in the original operation.

## Continue the process

- [Understand how the fiscal document gets the CFOP and the taxes](https://docs.kmee.com.br/en/odoo/localizacoes/brasil/tributacao/como-a-nota-recebe-cfop-e-impostos/)
- [Configure the document types, series and numbering](https://docs.kmee.com.br/en/odoo/localizacoes/brasil/implantacao/series-e-numeracao/)
- [Check the sales fiscal operation](https://docs.kmee.com.br/en/odoo/localizacoes/brasil/tributacao/entender-a-operacao-fiscal/)
