Skip to content

Commit

Permalink
Merge PR #2574 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Jul 12, 2023
2 parents b57ce43 + f89d93e commit 4d96fdb
Show file tree
Hide file tree
Showing 43 changed files with 871 additions and 139 deletions.
1 change: 0 additions & 1 deletion l10n_br_account/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"l10n_br_account_certificate_user","Fiscal Certificate for Account User","l10n_br_fiscal.model_l10n_br_fiscal_certificate","account.group_account_invoice",1,0,0,0
"l10n_br_account_document_serie_user","Fiscal Document Serie for Account User","l10n_br_fiscal.model_l10n_br_fiscal_document_serie","account.group_account_invoice",1,0,0,0
"l10n_br_account_document_type_user","Fiscal Document Type for Account User","l10n_br_fiscal.model_l10n_br_fiscal_document_type","account.group_account_invoice",1,0,0,0
"l10n_br_account_document_user","Fiscal Document for Account User","l10n_br_fiscal.model_l10n_br_fiscal_document","account.group_account_invoice",1,1,0,0
Expand Down
8 changes: 1 addition & 7 deletions l10n_br_fiscal/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"maintainers": ["renatonlima"],
"website": "https://github.com/OCA/l10n-brazil",
"development_status": "Production/Stable",
"version": "14.0.14.2.1",
"version": "14.0.15.0.0",
"depends": [
"product",
"l10n_br_base",
Expand Down Expand Up @@ -62,7 +62,6 @@
"views/document_type_view.xml",
"views/document_serie_view.xml",
"views/document_email_view.xml",
"views/certificate_view.xml",
"views/simplified_tax_view.xml",
"views/simplified_tax_range_view.xml",
"views/operation_view.xml",
Expand Down Expand Up @@ -107,9 +106,4 @@
"installable": True,
"application": True,
"auto_install": False,
"external_dependencies": {
"python": [
"erpbrasil.assinatura",
]
},
}
13 changes: 0 additions & 13 deletions l10n_br_fiscal/hooks.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Copyright (C) 2019 - Renato Lima Akretion
# Copyright (C) 2021 - Luis Felipe Mileo - KMEE
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

import logging

from odoo import SUPERUSER_ID, _, api, tools

from .constants.fiscal import CERTIFICATE_TYPE_ECNPJ
from .tools import misc

_logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -98,15 +94,6 @@ def post_init_hook(cr, registry):
env.ref("l10n_br_base.empresa_simples_nacional", raise_if_not_found=False),
]

for company in companies:
l10n_br_fiscal_certificate_id = env["l10n_br_fiscal.certificate"]
company.certificate_nfe_id = l10n_br_fiscal_certificate_id.create(
misc.prepare_fake_certificate_vals()
)
company.certificate_ecnpj_id = l10n_br_fiscal_certificate_id.create(
misc.prepare_fake_certificate_vals(cert_type=CERTIFICATE_TYPE_ECNPJ)
)

if not is_demo:
prodfiles = []
# Load full CSV files with few lines unless a flag
Expand Down
22 changes: 22 additions & 0 deletions l10n_br_fiscal/migrations/14.0.15.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2023 - TODAY Akretion - Raphael Valyi <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade

to_install = "'l10n_br_fiscal_certificate'"


def install_new_modules(cr):
sql = """
UPDATE ir_module_module
SET state='to install'
WHERE name = {} AND state='uninstalled'
""".format(
to_install,
)
openupgrade.logged_query(cr, sql)


@openupgrade.migrate()
def migrate(env, version):
install_new_modules(env.cr)
1 change: 0 additions & 1 deletion l10n_br_fiscal/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
from . import document_type
from . import document_serie
from . import product_genre
from . import certificate
from . import product_mixin
from . import product_template
from . import product_product
Expand Down
12 changes: 0 additions & 12 deletions l10n_br_fiscal/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,6 @@ def _compute_simplified_tax(self):

ibpt_update_days = fields.Integer(string="IBPT Token Updates", default=15)

certificate_ecnpj_id = fields.Many2one(
comodel_name="l10n_br_fiscal.certificate",
string="E-CNPJ",
domain="[('type', '=', 'e-cnpj')]",
)

certificate_nfe_id = fields.Many2one(
comodel_name="l10n_br_fiscal.certificate",
string="NFe",
domain="[('type', '=', 'nf-e')]",
)

accountant_id = fields.Many2one(comodel_name="res.partner", string="Accountant")

accounting_office = fields.Many2one(
Expand Down
7 changes: 0 additions & 7 deletions l10n_br_fiscal/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ class ResConfigSettings(models.TransientModel):
readonly=False,
)

cert_expired_alert = fields.Integer(
string="Certificate Expired Alert",
config_parameter="l10n_br_fiscal_cert_expired_alert",
required=True,
default=30,
)

document_type_id = fields.Many2one(
comodel_name="l10n_br_fiscal.document.type",
related="company_id.document_type_id",
Expand Down
2 changes: 0 additions & 2 deletions l10n_br_fiscal/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
"l10n_br_fiscal_document_email_manager","Fiscal Document Email for Manager","model_l10n_br_fiscal_document_email","l10n_br_fiscal.group_manager",1,1,1,1
"l10n_br_fiscal_document_serie_user","Fiscal Document Serie for User","model_l10n_br_fiscal_document_serie","l10n_br_fiscal.group_user",1,0,0,0
"l10n_br_fiscal_document_serie_manager","Fiscal Document Serie for Manager","model_l10n_br_fiscal_document_serie","l10n_br_fiscal.group_manager",1,1,1,1
"l10n_br_fiscal_certificate_user","Fiscal Certificate for User","model_l10n_br_fiscal_certificate","l10n_br_fiscal.group_user",1,0,0,0
"l10n_br_fiscal_certificate_manager","Fiscal Certificate for Manager","model_l10n_br_fiscal_certificate","l10n_br_fiscal.group_manager",1,1,1,1
"l10n_br_fiscal_simplified_tax_user","Fiscal Simplified Tax for User","model_l10n_br_fiscal_simplified_tax","l10n_br_fiscal.group_user",1,0,0,0
"l10n_br_fiscal_simplified_tax_manager","Fiscal Simplified Tax for Manager","model_l10n_br_fiscal_simplified_tax","l10n_br_fiscal.group_manager",1,0,0,0
"l10n_br_fiscal_simplified_tax_maintenance","Fiscal Simplified Tax for Maintenance","model_l10n_br_fiscal_simplified_tax","l10n_br_fiscal.group_data_maintenance",1,1,1,1
Expand Down
1 change: 0 additions & 1 deletion l10n_br_fiscal/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import (
test_certificate,
test_cnae,
test_fiscal_document_generic,
test_fiscal_document_nfse,
Expand Down
21 changes: 1 addition & 20 deletions l10n_br_fiscal/tools/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
import logging
import os

from erpbrasil.assinatura import misc
from erpbrasil.base.misc import punctuation_rm

from odoo.tools import config

from ..constants.fiscal import CERTIFICATE_TYPE_NFE, EVENT_ENV_HML, EVENT_ENV_PROD
from ..constants.fiscal import EVENT_ENV_HML, EVENT_ENV_PROD

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -45,24 +44,6 @@ def domain_field_codes(
return domain


def prepare_fake_certificate_vals(
valid=True,
passwd="123456",
issuer="EMISSOR A TESTE",
country="BR",
subject="CERTIFICADO VALIDO TESTE",
cert_type=CERTIFICATE_TYPE_NFE,
):
return {
"type": cert_type,
"subtype": "a1",
"password": passwd,
"file": misc.create_fake_certificate_file(
valid, passwd, issuer, country, subject
),
}


def path_edoc_company(company_id):
db_name = company_id._cr.dbname
filestore = config.filestore(db_name)
Expand Down
6 changes: 1 addition & 5 deletions l10n_br_fiscal/views/dfe/dfe_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
<sheet>
<group>
<group col="4" colspan="4">
<field
name="company_id"
required="1"
domain="[('certificate_nfe_id', '!=', False)]"
/>
<field name="company_id" required="1" />
<newline />
<field name="last_nsu" required="1" />
<newline />
Expand Down
17 changes: 0 additions & 17 deletions l10n_br_fiscal/views/l10n_br_fiscal_action.xml
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,6 @@
</field>
</record>

<!-- Certificate -->
<record id="certificate_action" model="ir.actions.act_window">
<field name="name">Certificate</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">l10n_br_fiscal.certificate</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="certificate_tree" />
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Add a new Certificate
</p><p>
All Certificate by
Brazilian Fiscal modulo for Odoo.
</p>
</field>
</record>

<!-- Fiscal Document Email -->
<record id="document_email_action" model="ir.actions.act_window">
<field name="name">Fiscal Document Email</field>
Expand Down
9 changes: 0 additions & 9 deletions l10n_br_fiscal/views/l10n_br_fiscal_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,6 @@
sequence="30"
/>

<!-- Fiscal Document Certificate -->
<menuitem
id="certificate_menu"
action="certificate_action"
groups="l10n_br_fiscal.group_manager"
parent="others_config_menu"
sequence="40"
/>

<!-- Comment -->
<menuitem
id="comment_menu"
Expand Down
10 changes: 0 additions & 10 deletions l10n_br_fiscal/views/res_company_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,6 @@
/>
</group>
</page>
<page name="certificate" string="Certificates">
<group name="certificate" string="Certificate">
<group>
<field name="certificate_ecnpj_id" />
</group>
<group>
<field name="certificate_nfe_id" />
</group>
</group>
</page>
<page name="delivery_costs" string="Delivery Costs">
<group>
<group>
Expand Down
19 changes: 0 additions & 19 deletions l10n_br_fiscal/views/res_config_settings_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,6 @@
</div>
</div>
</div>

<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
</div>
<div
class="o_setting_right_pane"
id="max_qty_exceeded_perc_settings"
>
<label for="cert_expired_alert" />
<div class="text-muted">
Alert certificate expiration.
</div>
<div>
<div class="content-group mt16">
<field name="cert_expired_alert" /> Days Before
</div>
</div>
</div>
</div>
</div>
<h2>Fiscal Documents</h2>
<div class="row mt16 o_settings_container">
Expand Down
107 changes: 107 additions & 0 deletions l10n_br_fiscal_certificate/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
===========================================
A1 fiscal certificate management for Brazil
===========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d5a0459e7e288accb9bb38c1bc7a82ddbaf8202afdff5940c3c114422597f4e5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n_br_fiscal-lightgray.png?logo=github
:target: https://github.com/OCA/l10n_br_fiscal/tree/14.0/l10n_br_fiscal_certificate
:alt: OCA/l10n_br_fiscal
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n_br_fiscal-14-0/l10n_br_fiscal-14-0-l10n_br_fiscal_certificate
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n_br_fiscal&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Permite gerenciar seus certificados A1 para a assinar e transmitir seus documentos eletrônicos.

**Table of contents**

.. contents::
:local:

Usage
=====

Abra o menu Configurações>Empresas. Dentro da aba fiscal tem uma nova página "certificados"
onde você pode fazer o upload dos certificados A1.

Changelog
=========

14.0.1.0.0 (2023)
~~~~~~~~~~~~~~~~~

Primeira versão do módulo: o código vinha sendo desenvolvido desde a versão 8 mas
estava integrado dentro módulo l10n_br_fiscal. O código foi extraído para deixar
o módulo l10n_br_fiscal mais leve.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n_br_fiscal/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n_br_fiscal/issues/new?body=module:%20l10n_br_fiscal_certificate%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Akretion

Contributors
~~~~~~~~~~~~

* `Akretion <https://www.akretion.com/pt-BR>`_:

* Renato Lima <[email protected]>
* Raphaël Valyi <[email protected]>

* `KMEE <https://www.kmee.com.br>`_:

* Luis Felipe Mileo <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-renatonlima| image:: https://github.com/renatonlima.png?size=40px
:target: https://github.com/renatonlima
:alt: renatonlima

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-renatonlima|

This module is part of the `OCA/l10n_br_fiscal <https://github.com/OCA/l10n_br_fiscal/tree/14.0/l10n_br_fiscal_certificate>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions l10n_br_fiscal_certificate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from .hooks import post_init_hook

from . import models
Loading

0 comments on commit 4d96fdb

Please sign in to comment.