Skip to content
Health
80/100
good
  • Security25/25
    No findings
  • Activity25/25
    Last human commit 1 month ago
  • Required by5/25
    0 modules depend on it
  • Maturity25/25
    In 6 Odoo series since 14.0

Heuristic over the facts below, not an audit · How it's computed

Security findings
Grave / minor (static analysis)
Required by
0
Modules depending on it
External deps
8 pip · 0 bin
Python packages / system binaries
License
AGPL-3
No conflicts with its dependencies
Folder size
0.21 MB
Module directory on disk
Code analysis 0 migration notes 6 models 12 views 0 HTTP endpoints

Description

Framework genérico para monitoramento de documentos fiscais eletrônicos recebidos via os web services de Distribuição de DF-e da SEFAZ (Ambiente Nacional).

Este módulo é agnóstico ao tipo de documento fiscal: ele implementa toda a lógica comum de distribuição DF-e — paginação de NSUs, agendamento inteligente baseado na resposta da SEFAZ (138, 137, 656), desduplicação, notificações, logs SOAP e o painel (banner) — parametrizado por tipo de documento (fiscal_type).

Os módulos específicos implementam apenas o que é particular de cada documento fiscal:

  • l10n_br_nfe_dfe — DF-e de NF-e (NFeDistribuicaoDFe, NT 2014.002)
  • l10n_br_cte_dfe — DF-e de CT-e (CTeDistribuicaoDFe) — futuro

Funcionalidades genéricas:

  • Motor de distribuição em res.company, parametrizado por fiscal_type (campos {fiscal_type}_last_nsu, {fiscal_type}_max_nsu, {fiscal_type}_dfe_last_query, etc. definidos pelos módulos específicos)
  • Modelos genéricos: l10n_br_fiscal_dfe.dfe (payload XML por NSU) e l10n_br_fiscal_dfe.document (documento agrupado por chave de acesso)
  • Consulta manual — assistente de busca específica por chave de acesso (com validação do dígito verificador) ou por NSU
  • Painel (banner) genérico — componente Owl DfeBanner, alimentado por res.company.dfe_get_banner_data(fiscal_type), exibido nas listas dos módulos específicos via a js_class dfe_document_list
  • Notificações no Inbox — notifica usuários sobre novos documentos de terceiros (preferência por usuário)
  • Matching automático de parceiro pelo CNPJ da chave de acesso
  • Log de distribuição com request/response SOAP para depuração
  • Suporte multi-empresa com record rules
  • Canal queue_job root.dfe para as consultas automáticas

Dependencies

Odoo dependencies
OCA/l10n-brazil:
OCA/product-attribute:
OCA/queue:
odoo/odoo:
- web
- bus
- uom
Python dependencies
erpbrasil-base>=2.5.0, xsdata, email-validator, erpbrasil-base>=2.4.2, num2words, phonenumbers, openupgradelib, requests
System dependencies
None
Required by
None

Code analysis

Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.

Views touched 12

XML IDNameModelTypeStatus
dfe_distribution_log_form dfe.distribution.log.form l10n_br_fiscal_dfe.distribution_log form New
dfe_distribution_log_search dfe.distribution.log.search l10n_br_fiscal_dfe.distribution_log search New
dfe_distribution_log_tree dfe.distribution.log.tree l10n_br_fiscal_dfe.distribution_log list New
dfe_form l10n_br_fiscal_dfe.dfe.form l10n_br_fiscal_dfe.dfe form New
dfe_res_company_form dfe.res.company.form res.company form Inherits l10n_br_fiscal.fiscal_res_company_form
dfe_tree l10n_br_fiscal_dfe.dfe.tree l10n_br_fiscal_dfe.dfe list New
l10n_br_fiscal_dfe_document_form l10n_br_fiscal_dfe.document.form l10n_br_fiscal_dfe.document form New
l10n_br_fiscal_dfe_document_search l10n_br_fiscal_dfe.document.search l10n_br_fiscal_dfe.document search New
l10n_br_fiscal_dfe_document_tree l10n_br_fiscal_dfe.document.tree l10n_br_fiscal_dfe.document list New
view_dfe_specific_search_wizard_form dfe.specific.search.wizard.form dfe.specific.search.wizard form New
view_users_form_dfe res.users.form.dfe res.users form Inherits base.view_users_form
view_users_form_simple_modif_dfe res.users.preferences.form.dfe res.users form Inherits base.view_users_form_simple_modif

HTTP endpoints 0

No HTTP endpoints found for this module.

Models touched 6

New fields (5)
  • access_key Char
    help='Access Key of the electronic fiscal document to be searched.'
  • company_id Many2one → res.company
    comodel_name='res.company' default=<expr>
  • fiscal_type Selection
    required=True selection=[('nfe', 'NF-e'), ('cte', 'CT-e')]
  • nsu Char
    help='NSU (Numero Sequencial Unico) is a unique sequential number assigned to each document in the Brazilian electronic fiscal document system.' string='NSU'
  • search_type Selection
    default='access_key' required=True selection=[('access_key', 'Search by Access Key'), ('nsu', 'Search by NSU')]
Public methods (1)
  • action_confirm_search(self)

New fields (12)
  • access_key Char
    index=True size=50
  • attachment_id Many2one → ir.attachment
    comodel_name='ir.attachment' help='XML Attachment stored in Odoo.'
  • company_id Many2one → res.company
    comodel_name='res.company' default=<expr> readonly=True
  • dfe_document_id Many2one → l10n_br_fiscal_dfe.document
    comodel_name='l10n_br_fiscal_dfe.document' string='DF-e Document'
  • document_type_dfe Selection
    selection=[('complete', 'Complete'), ('summary', 'Summary'), ('event', 'Event')] string='DF-e Type'
  • event_type_dfe Char
    string='Event Type'
  • event_type_dfe_label Char
    compute='_compute_event_type_dfe_label' string='Event'
  • fiscal_type Selection
    index=True selection=[('nfe', 'NF-e'), ('cte', 'CT-e')]
  • nsu Char
    index=True size=25 string='NSU'
  • operation_type Selection
    selection=OPERATION_TYPE
  • schema_type Char
    help='Type of the DF-e document according to the XML schema.'
  • xml_pretty Text
    compute='_compute_xml_pretty' string='XML Pretty'
Public methods (2)
  • action_download_xml(self)
  • create_xml_attachment(self, xml)

New fields (6)
  • company_id Many2one → res.company
    comodel_name='res.company' index=True readonly=True required=True
  • fiscal_type Selection
    index=True readonly=True selection=[('nfe', 'NF-e'), ('cte', 'CT-e')]
  • log_type Selection
    default='info' readonly=True required=True selection=[('success', 'Success'), ('info', 'Info'), ('warning', 'Warning'), ('error', 'Error')]
  • message Text
    readonly=True required=True
  • request_xml Text
    help='SOAP envelope sent to SEFAZ' readonly=True string='SOAP Request'
  • response_xml Text
    help='SOAP envelope received from SEFAZ' readonly=True string='SOAP Response'
Public methods (0)

No public methods.

New fields (19)
  • access_key Char
    index=True required=True size=50
  • color_status Selection
    compute='_compute_color_status' store=True args: [('green', 'Complete'), ('blue', 'Summary'), ('muted', 'Cancelled/Denied')]
  • company_id Many2one → res.company
    comodel_name='res.company' default=<expr> index=True required=True
  • currency_id Many2one → res.currency
    comodel_name='res.currency' default=<expr>
  • dfe_ids One2many → l10n_br_fiscal_dfe.dfe
    comodel_name='l10n_br_fiscal_dfe.dfe' inverse_name='dfe_document_id' string='DF-e records'
  • document_amount Monetary
    string='Document Total Value'
  • document_emission_date Datetime
    string='Emission Date'
  • document_number Char
    size=18
  • document_state Char
    help='Document situation code as received from the distribution service (semantics depend on the fiscal document type).' string='State Code'
  • document_state_label Char
    compute='_compute_document_state_label' string='State'
  • emitter Char
    size=60
  • fiscal_document_id Many2one → l10n_br_fiscal.document
    comodel_name='l10n_br_fiscal.document' compute='_compute_fiscal_document_id' help='Fiscal document already imported with this access key.' search='_search_fiscal_document_id'
  • fiscal_type Selection
    index=True selection=[('nfe', 'NF-e'), ('cte', 'CT-e')]
  • import_block_reason Char
    compute='_compute_import_block_reason' help='Why this document cannot be imported. Empty when the import can proceed.' string='Block Reason'
  • is_own_document Boolean
    compute='_compute_is_own_document' help='True when the emitter CNPJ in the access key matches the company CNPJ.' store=True string='Own Document'
  • partner_id Many2one → res.partner
    comodel_name='res.partner' compute='_compute_partner_id' store=True
  • serie Char
    size=5
  • utilization Selection
    compute='_compute_utilization' help='Available while the document is still authorized at the source and no vendor bill is posted. Posted while a vendor bill is posted. Empty when the source cancelled or denied the document.' selection=[('available', 'Available'), ('posted', 'Posted')]
  • vat Char
    size=18 string='CNPJ/CPF'
Public methods (5)
  • action_download_xml(self)
  • action_download_xmls_zip(self)
    Download complete XMLs of selected documents as a zip file.
  • action_match_partner(self)
    Re-run the partner matching logic
  • import_document(self)
    Import the document into the fiscal system. Must be implemented by fiscal type specific modules (e.g., l10n_br_nfe_dfe for NF-e, l10n_br_cte_dfe for CT-e).
  • make_pdf(self)
    Generate a PDF representation of the document. Must be implemented by fiscal type specific modules (e.g., l10n_br_nfe_dfe for NF-e, l10n_br_cte_dfe for CT-e).

New fields (0)

No new fields.

Public methods (6)
  • action_document_distribution(self, fiscal_type)
  • action_search_specific(self, fiscal_type)
  • dfe_action_search_all(self, fiscal_type)
    @api.model
    Called from the banner's Search All button.
  • dfe_action_specific_search(self, fiscal_type)
    @api.model
    Called from the banner's Specific Search button.
  • dfe_get_banner_data(self, fiscal_type)
    @api.model
    Return the DF-e banner state for the current company. Values are returned raw (datetimes in the server format, counters as integers) so the banner component formats them with the user's locale and timezone. The thresholds stay here, as business rules.
  • dfe_search_documents(self, fiscal_type)

New fields (1)
  • dfe_notification Boolean
    help='Receive Inbox notifications when the DF-e distribution finds new third-party documents.' string='DF-e Notification'
Public methods (2)
  • SELF_READABLE_FIELDS(self)
    @property
  • SELF_WRITEABLE_FIELDS(self)
    @property

Loading…

Loading…

Loading…

Loading…

Loading…