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][ADD] l10n_br_mdfe: add new module #3445

Conversation

marcelsavegnago
Copy link
Member

@marcelsavegnago marcelsavegnago commented Oct 16, 2024

This pull request introduces several new features and improvements related to the Brazilian electronic fiscal document system (MDFe). The changes include adding support for the MDFe document type, updating various models and views, and introducing new constants for MDFe handling.

New Features and Enhancements:

  • MDFe Support:

    • Added new MDFe document type in l10n_br_fiscal/constants/fiscal.py and l10n_br_fiscal/data/l10n_br_fiscal.document.type.csv. [1] [2]
    • Introduced MDFe document handling in l10n_br_fiscal_edi/models/document_workflow.py. [1] [2] [3] [4]
    • Added MDFe-specific constants in l10n_br_mdfe/constants/mdfe.py.
  • Model and View Updates:

    • Updated l10n_br_fiscal/models/document_mixin_fields.py and l10n_br_fiscal/models/document_related.py to include new fields for MDFe. [1] [2] [3]
    • Modified views in l10n_br_fiscal/views/document_related_view.xml and l10n_br_fiscal/views/document_view.xml to display new MDFe fields. [1] [2]
  • Demo and Data Files:

    • Added demo data for MDFe in l10n_br_fiscal/demo/company_demo.xml. [1] [2]
    • Added new MDFe operation records in l10n_br_fiscal/data/operation_data.xml.
  • Module Initialization and Manifest Updates:

    • Created new l10n_br_mdfe module with its own __init__.py, __manifest__.py, and README.rst. [1] [2] [3]
    • Updated version numbers in l10n_br_fiscal/__manifest__.py and l10n_br_fiscal_edi/__manifest__.py. [1] [2]

These changes collectively enhance the system's capabilities to handle MDFe documents, ensuring compliance with Brazilian fiscal regulations.

@OCA-git-bot
Copy link
Contributor

Hi @mileo, @renatonlima, @rvalyi,
some modules you are maintaining are being modified, check this out!

@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_mdfe_rebased-escodoo-wip-withothercommits-spec-nfe-and-others3 branch from 2be2b5c to cbf090a Compare October 16, 2024 17:33
l10n_br_mdfe/hooks.py Outdated Show resolved Hide resolved
@rvalyi
Copy link
Member

rvalyi commented Oct 16, 2024

@marcelsavegnago o _register_hook não foi chamado pros objetos da mdfe. Esse problema foi depois de vc remover o hook apenas? Ele deveria fazer sozinho mas talvez ele cai naquele problema que eu comentei mais cedo de precisar de um loop para cada esquema no #3431.

Para as tabelas desses objetos existirem o _register_hook precisa ser chamado pelo menos uma vez para aquele esquema da mdfe. Normalmente ele deveria fazer sozinho, mas talvez caiu no caso que aquele mro() trouxe apenas as extensões da nfe e que ele parou apenas na primeira extensão "spec" da nfe no caso. Na pior se resolver de chamar o _register_hook em cima de um objeto da mdfe no hook.py, seria um workaround aceitável até fazer aquele loop no spec_driven_model.

@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_mdfe_rebased-escodoo-wip-withothercommits-spec-nfe-and-others3 branch 8 times, most recently from 3bbd0a7 to d9bcf20 Compare October 19, 2024 18:50
@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_mdfe_rebased-escodoo-wip-withothercommits-spec-nfe-and-others3 branch from 86c8bbe to 027a274 Compare October 20, 2024 19:40
Copy link
Member

@rvalyi rvalyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcelsavegnago eu tinha errado no summary do manifest do modulo l10n_br_mdfe_spec (ta como CTe). Pode aproveitar para alterar o summary por algo do tipo: "MDF-e abstract models generated by xsdata-odoo from the oficial xsd" ou algo do tipo que achar melhor por favor? (eu acabei de ajustar dessa forma no summary do l10n_br_nfe_spec em #3461)

@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_mdfe_rebased-escodoo-wip-withothercommits-spec-nfe-and-others3 branch 5 times, most recently from 32a5ba0 to ad38578 Compare October 21, 2024 12:58
Copy link
Member

@rvalyi rvalyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nos logs eu vi esse warning: "2024-10-21 13:08:15,686 535 WARNING odoo odoo.modules.registry: res.partner: inconsistent 'compute_sudo' for computed fields: mdfe30_CNPJ, mdfe30_idEstrangeiro, mdfe30_CPF, mdfe30_choice6, mdfe30_CEP, mdfe30_fone, mdfe30_IE, mdfe30_choice8, mdfe30_choice9, mdfe30_choice10, mdfe30_choice11, mdfe30_choice12 " Na NFe a gente conseguiu corrigir isso.

Tb é ruim usar esses padrões mdfe30_choiceXY, seria melhor botar um nome mdfe30_choice_<alguma coisa explicita> assim como foi feito nos campos choice da NFe.

@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_mdfe_rebased-escodoo-wip-withothercommits-spec-nfe-and-others3 branch 7 times, most recently from 82c5121 to f2346a1 Compare October 21, 2024 18:12
@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_mdfe_rebased-escodoo-wip-withothercommits-spec-nfe-and-others3 branch from 4e3e02d to e5b6e88 Compare October 23, 2024 14:59
@marcelsavegnago
Copy link
Member Author

para não dar problema no merge ainda teria que ajeitar o numero dos modulos. Ja que seria merge nobump, eu diria que pode dar uma incrementada menor em todos outros modulos e patch no l10n_br_focus.

Done

@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_mdfe_rebased-escodoo-wip-withothercommits-spec-nfe-and-others3 branch from 6c6ad11 to 1bad93d Compare October 23, 2024 15:48
@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_mdfe_rebased-escodoo-wip-withothercommits-spec-nfe-and-others3 branch from 1bad93d to ecd6eb3 Compare October 23, 2024 16:17
@rvalyi
Copy link
Member

rvalyi commented Oct 23, 2024

ainda tem a gambiarra do document.suplement herdar do StackedModel, mas enfim o impacto não é muito grande, a gente consegue ajustar depois. Eu diria que a gente já poderia fazer o merge assim.

@rvalyi
Copy link
Member

rvalyi commented Oct 23, 2024

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 14.0-ocabot-merge-pr-3445-by-rvalyi-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 8d51caa into OCA:14.0 Oct 23, 2024
6 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 3081acd. Thanks a lot for contributing to OCA. ❤️

@marcelsavegnago marcelsavegnago deleted the 14.0-add-l10n_br_mdfe_rebased-escodoo-wip-withothercommits-spec-nfe-and-others3 branch October 24, 2024 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants