Skip to content

Commit 60ab201

Browse files
committed
Merge PR #3984 into 18.0
Signed-off-by marcelsavegnago
2 parents 28532a5 + 3826d1e commit 60ab201

26 files changed

+2093
-0
lines changed

l10n_br_fiscal_certificate/README.rst

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
===========================================
2+
A1 fiscal certificate management for Brazil
3+
===========================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:6fc45b0d3cd5e4f9b3c51beff5adcb3851af4bbf8b4bc72dd60f1577cf01a63a
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Production/Stable
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github
20+
:target: https://github.com/OCA/l10n-brazil/tree/18.0/l10n_br_fiscal_certificate
21+
:alt: OCA/l10n-brazil
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/l10n-brazil-18-0/l10n-brazil-18-0-l10n_br_fiscal_certificate
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Permite gerenciar seus certificados A1 para a assinar e transmitir seus
32+
documentos eletrônicos.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Usage
40+
=====
41+
42+
Abra o menu Configurações>Empresas. Dentro da aba fiscal tem uma nova
43+
página "certificados" onde você pode fazer o upload dos certificados A1.
44+
45+
Changelog
46+
=========
47+
48+
14.0.1.0.0 (2023)
49+
-----------------
50+
51+
Primeira versão do módulo: o código vinha sendo desenvolvido desde a
52+
versão 8 mas estava integrado dentro módulo l10n_br_fiscal. O código foi
53+
extraído para deixar o módulo l10n_br_fiscal mais leve.
54+
55+
Bug Tracker
56+
===========
57+
58+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-brazil/issues>`_.
59+
In case of trouble, please check there if your issue has already been reported.
60+
If you spotted it first, help us to smash it by providing a detailed and welcomed
61+
`feedback <https://github.com/OCA/l10n-brazil/issues/new?body=module:%20l10n_br_fiscal_certificate%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
62+
63+
Do not contact contributors directly about support or help with technical issues.
64+
65+
Credits
66+
=======
67+
68+
Authors
69+
-------
70+
71+
* Akretion
72+
73+
Contributors
74+
------------
75+
76+
- `Akretion <https://www.akretion.com/pt-BR>`__:
77+
78+
- Renato Lima <[email protected]>
79+
- Raphaël Valyi <[email protected]>
80+
81+
- `KMEE <https://www.kmee.com.br>`__:
82+
83+
- Luis Felipe Mileo <[email protected]>
84+
85+
Maintainers
86+
-----------
87+
88+
This module is maintained by the OCA.
89+
90+
.. image:: https://odoo-community.org/logo.png
91+
:alt: Odoo Community Association
92+
:target: https://odoo-community.org
93+
94+
OCA, or the Odoo Community Association, is a nonprofit organization whose
95+
mission is to support the collaborative development of Odoo features and
96+
promote its widespread use.
97+
98+
.. |maintainer-renatonlima| image:: https://github.com/renatonlima.png?size=40px
99+
:target: https://github.com/renatonlima
100+
:alt: renatonlima
101+
102+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
103+
104+
|maintainer-renatonlima|
105+
106+
This module is part of the `OCA/l10n-brazil <https://github.com/OCA/l10n-brazil/tree/18.0/l10n_br_fiscal_certificate>`_ project on GitHub.
107+
108+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
2+
3+
from .hooks import post_init_hook
4+
5+
from . import models
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (C) 2023 Raphaël Valyi - Akretion
2+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3+
4+
{
5+
"name": "A1 fiscal certificate management for Brazil",
6+
"category": "Localisation",
7+
"license": "AGPL-3",
8+
"author": "Akretion, Odoo Community Association (OCA)",
9+
"maintainers": ["renatonlima"],
10+
"website": "https://github.com/OCA/l10n-brazil",
11+
"development_status": "Production/Stable",
12+
"version": "18.0.1.0.0",
13+
"depends": [
14+
"l10n_br_fiscal",
15+
],
16+
"data": [
17+
"security/ir.model.access.csv",
18+
"views/certificate_view.xml",
19+
"views/res_company_view.xml",
20+
"views/res_config_settings_view.xml",
21+
],
22+
"post_init_hook": "post_init_hook",
23+
"installable": True,
24+
"application": False,
25+
"auto_install": False,
26+
"external_dependencies": {
27+
"python": [
28+
"erpbrasil.assinatura>=1.7.0",
29+
]
30+
},
31+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (C) 2021 Luis Felipe Mileo - KMEE
2+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3+
4+
CERTIFICATE_TYPE_NFE = "nf-e"
5+
CERTIFICATE_TYPE_ECPF = "e-cpf"
6+
CERTIFICATE_TYPE_ECNPJ = "e-cnpj"
7+
8+
CERTIFICATE_TYPE = [
9+
(CERTIFICATE_TYPE_ECPF, "E-CPF"),
10+
(CERTIFICATE_TYPE_ECNPJ, "E-CNPJ"),
11+
(CERTIFICATE_TYPE_NFE, "NF-e"),
12+
]
13+
14+
CERTIFICATE_TYPE_DEFAULT = CERTIFICATE_TYPE_NFE
15+
16+
CERTIFICATE_SUBTYPE = [("a1", "A1"), ("a3", "A3")]
17+
CERTIFICATE_SUBTYPE_DEFAULT = "a1"

l10n_br_fiscal_certificate/hooks.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright (C) 2021 - Luis Felipe Mileo - KMEE
2+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3+
4+
import logging
5+
6+
from erpbrasil.assinatura import misc
7+
8+
from odoo import _
9+
10+
from .constants import CERTIFICATE_TYPE_ECNPJ, CERTIFICATE_TYPE_NFE
11+
12+
_logger = logging.getLogger(__name__)
13+
14+
15+
def post_init_hook(env):
16+
def prepare_fake_certificate_vals(
17+
valid=True,
18+
passwd="123456",
19+
issuer="EMISSOR A TESTE",
20+
country="BR",
21+
subject="CERTIFICADO VALIDO TESTE",
22+
cert_type=CERTIFICATE_TYPE_NFE,
23+
):
24+
return {
25+
"type": cert_type,
26+
"subtype": "a1",
27+
"password": passwd,
28+
"file": misc.create_fake_certificate_file(
29+
valid, passwd, issuer, country, subject
30+
),
31+
}
32+
33+
env.cr.execute(
34+
"select demo from ir_module_module where name='l10n_br_fiscal_certificate';"
35+
)
36+
if env.cr.fetchone()[0]:
37+
companies = [
38+
env.ref("base.main_company", raise_if_not_found=False),
39+
env.ref("l10n_br_base.empresa_lucro_presumido", raise_if_not_found=False),
40+
env.ref("l10n_br_base.empresa_simples_nacional", raise_if_not_found=False),
41+
]
42+
try:
43+
for company in companies:
44+
l10n_br_fiscal_certificate_id = env["l10n_br_fiscal.certificate"]
45+
company.certificate_nfe_id = l10n_br_fiscal_certificate_id.create(
46+
prepare_fake_certificate_vals()
47+
)
48+
company.certificate_ecnpj_id = l10n_br_fiscal_certificate_id.create(
49+
prepare_fake_certificate_vals(cert_type=CERTIFICATE_TYPE_ECNPJ)
50+
)
51+
except NameError: # (means from erpbrasil.assinatura import misc failed)
52+
_logger.error(
53+
_(
54+
"Python Library erpbrasil.assinatura not installed!"
55+
"You can install it later with: pip install erpbrasil.assinatura."
56+
"Demo companies fake A1 certificates were not created."
57+
)
58+
)

0 commit comments

Comments
 (0)