Monitor de DF-e (Base)
l10n_br_fiscal_dfe · OCA/l10n-brazil
-
Security25/25No findings
-
Activity25/25Last human commit 1 month ago
-
Required by5/250 modules depend on it
-
Maturity25/25In 6 Odoo series since 14.0
Heuristic over the facts below, not an audit · How it's computed
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 porfiscal_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) el10n_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 porres.company.dfe_get_banner_data(fiscal_type), exibido nas listas dos módulos específicos via ajs_classdfe_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.dfepara as consultas automáticas
Dependencies
- Odoo dependencies
- 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 ID | Name | Model | Type | Status |
|---|---|---|---|---|
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
-
access_keyCharhelp='Access Key of the electronic fiscal document to be searched.' -
company_idMany2one → res.companycomodel_name='res.company'default=<expr> -
fiscal_typeSelectionrequired=Trueselection=[('nfe', 'NF-e'), ('cte', 'CT-e')] -
nsuCharhelp='NSU (Numero Sequencial Unico) is a unique sequential number assigned to each document in the Brazilian electronic fiscal document system.'string='NSU' -
search_typeSelectiondefault='access_key'required=Trueselection=[('access_key', 'Search by Access Key'), ('nsu', 'Search by NSU')]
-
action_confirm_search(self)
-
access_keyCharindex=Truesize=50 -
attachment_idMany2one → ir.attachmentcomodel_name='ir.attachment'help='XML Attachment stored in Odoo.' -
company_idMany2one → res.companycomodel_name='res.company'default=<expr>readonly=True -
dfe_document_idMany2one → l10n_br_fiscal_dfe.documentcomodel_name='l10n_br_fiscal_dfe.document'string='DF-e Document' -
document_type_dfeSelectionselection=[('complete', 'Complete'), ('summary', 'Summary'), ('event', 'Event')]string='DF-e Type' -
event_type_dfeCharstring='Event Type' -
event_type_dfe_labelCharcompute='_compute_event_type_dfe_label'string='Event' -
fiscal_typeSelectionindex=Trueselection=[('nfe', 'NF-e'), ('cte', 'CT-e')] -
nsuCharindex=Truesize=25string='NSU' -
operation_typeSelectionselection=OPERATION_TYPE -
schema_typeCharhelp='Type of the DF-e document according to the XML schema.' -
xml_prettyTextcompute='_compute_xml_pretty'string='XML Pretty'
-
action_download_xml(self) -
create_xml_attachment(self, xml)
-
company_idMany2one → res.companycomodel_name='res.company'index=Truereadonly=Truerequired=True -
fiscal_typeSelectionindex=Truereadonly=Trueselection=[('nfe', 'NF-e'), ('cte', 'CT-e')] -
log_typeSelectiondefault='info'readonly=Truerequired=Trueselection=[('success', 'Success'), ('info', 'Info'), ('warning', 'Warning'), ('error', 'Error')] -
messageTextreadonly=Truerequired=True -
request_xmlTexthelp='SOAP envelope sent to SEFAZ'readonly=Truestring='SOAP Request' -
response_xmlTexthelp='SOAP envelope received from SEFAZ'readonly=Truestring='SOAP Response'
No public methods.
-
access_keyCharindex=Truerequired=Truesize=50 -
color_statusSelectioncompute='_compute_color_status'store=True args: [('green', 'Complete'), ('blue', 'Summary'), ('muted', 'Cancelled/Denied')] -
company_idMany2one → res.companycomodel_name='res.company'default=<expr>index=Truerequired=True -
currency_idMany2one → res.currencycomodel_name='res.currency'default=<expr> -
dfe_idsOne2many → l10n_br_fiscal_dfe.dfecomodel_name='l10n_br_fiscal_dfe.dfe'inverse_name='dfe_document_id'string='DF-e records' -
document_amountMonetarystring='Document Total Value' -
document_emission_dateDatetimestring='Emission Date' -
document_numberCharsize=18 -
document_stateCharhelp='Document situation code as received from the distribution service (semantics depend on the fiscal document type).'string='State Code' -
document_state_labelCharcompute='_compute_document_state_label'string='State' -
emitterCharsize=60 -
fiscal_document_idMany2one → l10n_br_fiscal.documentcomodel_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_typeSelectionindex=Trueselection=[('nfe', 'NF-e'), ('cte', 'CT-e')] -
import_block_reasonCharcompute='_compute_import_block_reason'help='Why this document cannot be imported. Empty when the import can proceed.'string='Block Reason' -
is_own_documentBooleancompute='_compute_is_own_document'help='True when the emitter CNPJ in the access key matches the company CNPJ.'store=Truestring='Own Document' -
partner_idMany2one → res.partnercomodel_name='res.partner'compute='_compute_partner_id'store=True -
serieCharsize=5 -
utilizationSelectioncompute='_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')] -
vatCharsize=18string='CNPJ/CPF'
-
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).
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.modelCalled from the banner's Search All button. -
dfe_action_specific_search(self, fiscal_type)@api.modelCalled from the banner's Specific Search button. -
dfe_get_banner_data(self, fiscal_type)@api.modelReturn 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)
-
dfe_notificationBooleanhelp='Receive Inbox notifications when the DF-e distribution finds new third-party documents.'string='DF-e Notification'
-
SELF_READABLE_FIELDS(self)@property -
SELF_WRITEABLE_FIELDS(self)@property
Loading…
Loading…
Loading…
Loading…
Loading…