Skip to content
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

[14.0][FIX] nfce - serie and check anonymous customer #3380

Draft
wants to merge 2 commits into
base: 14.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
8 changes: 7 additions & 1 deletion l10n_br_fiscal/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) 2020 - TODAY Luis Felipe Mileo - KMEE
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import api, fields, models
from odoo import _, api, fields, models

from ..constants.fiscal import (
FINAL_CUSTOMER,
Expand Down Expand Up @@ -136,3 +136,9 @@ def _commercial_fields(self):
"inscr_est",
"inscr_mun",
]

@api.constrains("is_anonymous_consumer")
def _check_anonymous_consumer(self):
for p in self:
if p.is_anonymous_consumer and p.cnpj_cpf:
raise ValueError(_("Anonymous consumer cannot have a CNPJ/CPF number."))
8 changes: 1 addition & 7 deletions l10n_br_pos_nfce/models/pos_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,13 @@ class PosConfig(models.Model):

nfce_document_serie_sequence_number_next = fields.Integer(
string="Document Serie Number",
default=lambda self: self._default_next_number(),
related="nfce_document_serie_id.internal_sequence_id.number_next_actual",
)

nfce_city_ibge_code = fields.Char(
related="company_id.city_id.ibge_code",
)

def _default_next_number(self):
if not self.nfce_document_serie_id:
return 1

return self.nfce_document_serie_id.internal_sequence_id.number_next_actual

def update_nfce_serie_number(self, serie_number):
if self.nfce_document_serie_sequence_number_next < serie_number:
self.nfce_document_serie_sequence_number_next = serie_number
Expand Down
Loading