Skip to content

Commit

Permalink
[FIX] l10n_br_fiscal: ncm starting with 09 conflicts with service type
Browse files Browse the repository at this point in the history
  • Loading branch information
crsilveira authored and CristianoMafraJunior committed Oct 30, 2024
1 parent 9f53a24 commit 4bdb6e9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions l10n_br_fiscal/models/product_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ def _onchange_fiscal_type(self):
else:
r.tax_icms_or_issqn = TAX_DOMAIN_ICMS

@api.onchange("ncm_id", "fiscal_genre_id")
@api.onchange("ncm_id")
def _onchange_ncm_id(self):
for r in self:
if r.ncm_id:
r.fiscal_genre_id = self.env["l10n_br_fiscal.product.genre"].search(
[("code", "=", r.ncm_id.code[0:2])]
)

if r.fiscal_genre_id.code == PRODUCT_FISCAL_TYPE_SERVICE:
r.ncm_id = self.env.ref(NCM_FOR_SERVICE_REF)
@api.onchange("fiscal_genre_id")
def _onchange_fiscal_genre_id(self):
for r in self:
if r.fiscal_genre_id and r.ncm_id:
if r.fiscal_genre_id.code != r.ncm_id.code[0:2]:
r.ncm_id = False

Check warning on line 40 in l10n_br_fiscal/models/product_mixin.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_fiscal/models/product_mixin.py#L40

Added line #L40 was not covered by tests

0 comments on commit 4bdb6e9

Please sign in to comment.