Skip to content

[16.0][IMP] Implementação das mudanças da Reforma Tributária #3770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: 16.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions l10n_br_fiscal/constants/fiscal.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,14 @@
FINAL_CUSTOMER_YES = "1"


PUBLIC_ENTIRY_TYPE = [
("1", "União"),
("2", "Estado"),
("3", "Distrito Federal"),
("4", "Município"),
]


CFOP_TYPE_MOVE = [
("purchase_industry", "Purchase Industry"),
("purchase_commerce", "Purchase Commerce"),
Expand Down Expand Up @@ -477,13 +485,28 @@
("2", "Complementar"),
("3", "Ajuste"),
("4", "Devolução de mercadoria"),
("5", "Nota de Crédito"),
("6", "Nota de Débito"),
]

EDOC_PURPOSE_NORMAL = "1"
EDOC_PURPOSE_COMPLEMENTAR = "2"
EDOC_PURPOSE_AJUSTE = "3"
EDOC_PURPOSE_DEVOLUCAO = "4"

EDOC_REFUND_DEBIT_TYPE = [
("01", "Transferência de créditos para Cooperativas"),
("02", "Anulação de Crédito por Saídas Imunes/Isentas"),
("03", "Débitos de notas fiscais não processadas na apuração"),
("04", "Multa e juros"),
("05", "Transferência de crédito de sucessão"),
]

# TODO - Implementar nas proximas versões da NT da Reforma tributária
EDOC_REFUND_CREDIT_TYPE = [
("00", "Não Implementado"),
]

PROCESSADOR_NENHUM = "nenhum"
PROCESSADOR_OCA = "oca"

Expand Down
18 changes: 18 additions & 0 deletions l10n_br_fiscal/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
DOCUMENT_ISSUER_PARTNER,
EDOC_PURPOSE,
EDOC_PURPOSE_NORMAL,
EDOC_REFUND_DEBIT_TYPE,
EDOC_REFUND_CREDIT_TYPE,
FISCAL_IN_OUT_DICT,
MODELO_FISCAL_CTE,
MODELO_FISCAL_NFCE,
MODELO_FISCAL_NFE,
MODELO_FISCAL_NFSE,
PUBLIC_ENTIRY_TYPE,
SITUACAO_EDOC,
SITUACAO_EDOC_AUTORIZADA,
SITUACAO_EDOC_CANCELADA,
Expand Down Expand Up @@ -158,6 +161,21 @@ class Document(models.Model):
default=EDOC_PURPOSE_NORMAL,
)

edoc_refund_debit_type = fields.Selection(
selection=EDOC_REFUND_DEBIT_TYPE,
string="Tipo de Nota de Débito",
)

edoc_refund_credit_type = fields.Selection(
selection=EDOC_REFUND_CREDIT_TYPE,
string="Tipo de Nota de Crédito",
)

public_entity_type = fields.Selection(
selection=PUBLIC_ENTIRY_TYPE,
string="Tipo de Entidade Governamental",
)

document_type = fields.Char(
string="Document Type Code",
related="document_type_id.code",
Expand Down
6 changes: 6 additions & 0 deletions l10n_br_fiscal/models/partner_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
NFE_IND_IE_DEST_DEFAULT,
TAX_FRAMEWORK,
TAX_FRAMEWORK_NORMAL,
PUBLIC_ENTIRY_TYPE,
)


Expand All @@ -32,6 +33,11 @@ class PartnerProfile(models.Model):
"other government-controlled organizations.",
)

public_entity_type = fields.Selection(
selection=PUBLIC_ENTIRY_TYPE,
string="Tipo de Entidade Governamental",
)

default = fields.Boolean(string="Default Profile", default=True)

ind_ie_dest = fields.Selection(
Expand Down
7 changes: 7 additions & 0 deletions l10n_br_fiscal/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
NFE_IND_IE_DEST,
NFE_IND_IE_DEST_9,
NFE_IND_IE_DEST_DEFAULT,
PUBLIC_ENTIRY_TYPE,
TAX_FRAMEWORK,
TAX_FRAMEWORK_NORMAL,
)
Expand Down Expand Up @@ -65,6 +66,11 @@ def _default_fiscal_profile_id(self, is_company=False):
"other government-controlled organizations.",
)

public_entity_type = fields.Selection(
selection=PUBLIC_ENTIRY_TYPE,
string="Tipo de Entidade Governamental",
)

ind_final = fields.Selection(
selection=FINAL_CUSTOMER,
string="Final Consumption Operation",
Expand Down Expand Up @@ -112,6 +118,7 @@ def _onchange_fiscal_profile_id(self):
p.tax_framework = p.fiscal_profile_id.tax_framework
p.ind_ie_dest = p.fiscal_profile_id.ind_ie_dest
p.is_public_entity = p.fiscal_profile_id.is_public_entity
p.public_entity_type = p.fiscal_profile_id.public_entity_type

@api.onchange("ind_ie_dest")
def _onchange_ind_ie_dest(self):
Expand Down
6 changes: 6 additions & 0 deletions l10n_br_fiscal/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
force_save="1"
attrs="{'readonly': [('fiscal_profile_id', '!=', False)]}"
/>
<field
name="public_entity_type"
force_save="1"
attrs="{'readonly': [('fiscal_profile_id', '!=', False)],
'invisible': [('is_public_entity', '=', False)]}"
/>
<field
name="cnae_main_id"
options="{'no_create': True, 'no_create_edit': True}"
Expand Down
6 changes: 6 additions & 0 deletions l10n_br_nfe/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,16 @@ def _inverse_nfe40_Id(self):

nfe40_finNFe = fields.Selection(related="edoc_purpose")

nfe40_tpNFDebito = fields.Selection(related="edoc_refund_debit_type")

nfe40_tpNFCredito = fields.Selection(related="edoc_refund_credit_type")

nfe40_indFinal = fields.Selection(related="ind_final")

nfe40_indPres = fields.Selection(related="ind_pres")

nfe40_tpEnteGov = fields.Selection(related="public_entity_type")

nfe40_procEmi = fields.Selection(default="0")

nfe40_verProc = fields.Char(
Expand Down
Loading