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

Impossibilidade de informar NCM com inicio em 09.. #3095

Open
crsilveira opened this issue May 24, 2024 · 5 comments
Open

Impossibilidade de informar NCM com inicio em 09.. #3095

crsilveira opened this issue May 24, 2024 · 5 comments
Labels

Comments

@crsilveira
Copy link
Contributor

Ao tentar cadastrar um produto com NCM iniciado em 09, o mesmo é alterado para 00000, tipo Serviço.
ksnip_20240524-100413
ksnip_20240524-100438

@crsilveira crsilveira added the bug label May 24, 2024
@crsilveira
Copy link
Contributor Author

Isso é causado por isso: PRODUCT_FISCAL_TYPE_SERVICE = "09".

@api.onchange("ncm_id", "fiscal_genre_id")
def _onchange_ncm_id(self):
     ....
     if r.fiscal_genre_id.code == PRODUCT_FISCAL_TYPE_SERVICE:
            r.ncm_id = self.env.ref(NCM_FOR_SERVICE_REF)

@antoniospneto
Copy link
Contributor

Boa observação, @crsilveira.

Parece que houve um equívoco na implementação deste código. O PRODUCT_FISCAL_TYPE_SERVICE foi utilizado para tratar do código de serviço no campo fiscal_type, onde realmente, para serviços, o valor é "09". No entanto, ao considerar o campo fiscal_genre_id, que representa o "Código do Gênero Fiscal" e é uma classificação distinta, o código correto para serviço é "00".

Sugiro criar uma nova constante chamada FISCAL_GENRE_SERVICE com o valor "00" e substituir as ocorrências pertinentes no código.

Você consegue propor uma PR com essa correção?

@crsilveira
Copy link
Contributor Author

sim , vou fazer.

@crsilveira
Copy link
Contributor Author

Parece q o problema é somente no onchange do ncm_id :

aqui :
if r.fiscal_genre_id.code == PRODUCT_FISCAL_TYPE_SERVICE:
r.ncm_id = self.env.ref(NCM_FOR_SERVICE_REF)

assim , resolveria :
if r.fiscal_type == PRODUCT_FISCAL_TYPE_SERVICE:
r.ncm_id = self.env.ref(NCM_FOR_SERVICE_REF)

obviamente, com o código assim, se o tipo fiscal(fiscal_type) for Serviço, não será aceito nenhum outro NCM , somente o NCM_FOR_SERVICE_REF, posso fazer assim ?

@antoniospneto
Copy link
Contributor

Parece q o problema é somente no onchange do ncm_id :

aqui : if r.fiscal_genre_id.code == PRODUCT_FISCAL_TYPE_SERVICE: r.ncm_id = self.env.ref(NCM_FOR_SERVICE_REF)

assim , resolveria : if r.fiscal_type == PRODUCT_FISCAL_TYPE_SERVICE: r.ncm_id = self.env.ref(NCM_FOR_SERVICE_REF)

obviamente, com o código assim, se o tipo fiscal(fiscal_type) for Serviço, não será aceito nenhum outro NCM , somente o NCM_FOR_SERVICE_REF, posso fazer assim ?

Parece q o problema é somente no onchange do ncm_id :

aqui : if r.fiscal_genre_id.code == PRODUCT_FISCAL_TYPE_SERVICE: r.ncm_id = self.env.ref(NCM_FOR_SERVICE_REF)

assim , resolveria : if r.fiscal_type == PRODUCT_FISCAL_TYPE_SERVICE: r.ncm_id = self.env.ref(NCM_FOR_SERVICE_REF)

obviamente, com o código assim, se o tipo fiscal(fiscal_type) for Serviço, não será aceito nenhum outro NCM , somente o NCM_FOR_SERVICE_REF, posso fazer assim ?

Me parece uma boa, pra mim tá OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants