|
17 | 17 |
|
18 | 18 |
|
19 | 19 | class Operation(models.Model):
|
| 20 | + """ |
| 21 | + Defines a Fiscal Operation, representing the nature and fiscal intent of |
| 22 | + a transaction (e.g., Sale, Return, Import, Industrialization). |
| 23 | +
|
| 24 | + A Fiscal Operation is a core configuration entity in the Brazilian |
| 25 | + fiscal localization. It serves as a central point to orchestrate how |
| 26 | + fiscal documents and their lines are processed by determining: |
| 27 | +
|
| 28 | + 1. **Transaction Type**: Specifies if the operation is an Inbound |
| 29 | + (e.g., purchase, return from customer), Outbound (e.g., sale, |
| 30 | + return to supplier), or Other type of fiscal movement. |
| 31 | +
|
| 32 | + 2. **Operation Lines (`line_ids`)**: Each Fiscal Operation contains |
| 33 | + one or more `l10n_br_fiscal.operation.line` records. These lines |
| 34 | + define specific rules or conditions (based on partner profiles, |
| 35 | + product types, company tax regime, etc.) under which a |
| 36 | + particular set of fiscal treatments apply. The system selects |
| 37 | + the "best match" operation line based on the context of a |
| 38 | + transaction. |
| 39 | +
|
| 40 | + 3. **CFOP (Código Fiscal de Operações e Prestações)**: The selected |
| 41 | + `operation.line` determines the appropriate CFOP codes |
| 42 | + (internal, external, export) for the transaction line. The CFOP |
| 43 | + itself carries significant fiscal meaning and influences tax |
| 44 | + calculations and reporting. |
| 45 | +
|
| 46 | + 4. **Tax Definitions (`tax_definition_ids` on `operation.line` and `cfop`)**: |
| 47 | + The selected `operation.line` and the determined `cfop` can both |
| 48 | + hold `l10n_br_fiscal.tax.definition` records. These tax |
| 49 | + definitions specify which taxes (ICMS, IPI, PIS, COFINS, etc.) |
| 50 | + apply, along with their respective CST/CSOSN codes and other |
| 51 | + parameters. This linkage allows the Fiscal Operation to drive |
| 52 | + the tax calculation engine. |
| 53 | +
|
| 54 | + 5. **Document Characteristics**: It can also define default behaviors |
| 55 | + or properties for documents generated under this operation, such |
| 56 | + as the electronic document purpose (`edoc_purpose`), default |
| 57 | + price type (sale vs. cost), and links to inverse or return |
| 58 | + operations. |
| 59 | +
|
| 60 | + Essentially, when a fiscal document is created, the user selects a |
| 61 | + Fiscal Operation. The system then uses this operation and the |
| 62 | + transactional context (partner, product, company) to find the most |
| 63 | + suitable `operation.line`. This line, in turn, provides the CFOP |
| 64 | + and a set of tax definitions, which are then used by the tax engine |
| 65 | + to calculate all applicable taxes. |
| 66 | + """ |
| 67 | + |
20 | 68 | _name = "l10n_br_fiscal.operation"
|
21 | 69 | _description = "Fiscal Operation"
|
22 | 70 | _inherit = ["mail.thread", "mail.activity.mixin"]
|
|
0 commit comments