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

[15.0][FIX] l10n_br_fiscal: ncm starting with 09 conflicts with service type - fwp 3469 #3472

Merged
merged 1 commit into from
Oct 31, 2024
Merged
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
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 @@
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
Loading