Skip to content

Commit

Permalink
Merge PR #3473 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by antoniospneto
  • Loading branch information
OCA-git-bot committed Oct 31, 2024
2 parents d0580cd + 19e8dae commit b65d99c
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

0 comments on commit b65d99c

Please sign in to comment.