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

[FIX] l10n_it_fatturapa: link fatturapa.attachments #4250

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions l10n_it_fatturapa/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ Contributors

- Simone Rubino <[email protected]>

- `Stesi Consulting Srl <https://www.stesi.consulting/>`__:

- Michele Di Croce <[email protected]>

Maintainers
-----------

Expand Down
2 changes: 1 addition & 1 deletion l10n_it_fatturapa/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{
"name": "ITA - Fattura elettronica - Base",
"version": "16.0.1.1.0",
"version": "16.0.1.1.1",
"category": "Localization/Italy",
"summary": "Fatture elettroniche",
"author": "Davide Corio, Agile Business Group, Innoviu, "
Expand Down
10 changes: 10 additions & 0 deletions l10n_it_fatturapa/migrations/16.0.1.1.1/post-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2024 Michele Di Croce - Stesi Consulting srl
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
fatturapa_attachments = env["fatturapa.attachments"].search([])
fatturapa_attachments._l10n_it_link_attachments()
2 changes: 1 addition & 1 deletion l10n_it_fatturapa/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2014 Davide Corio <[email protected]>

from . import link_e_invoice_ir_attachment
from . import account
from . import company
from . import partner
from . import ir_attachment
from . import link_e_invoice_ir_attachment
1 change: 1 addition & 0 deletions l10n_it_fatturapa/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ class FatturaAttachments(models.Model):
_name = "fatturapa.attachments"
_description = "E-invoice attachments"
_inherits = {"ir.attachment": "ir_attachment_id"}
_inherit = ["l10n_it_fatturapa.attachment.e_invoice.link"]

ir_attachment_id = fields.Many2one(
"ir.attachment", "Attachment", required=True, ondelete="cascade"
Expand Down
2 changes: 2 additions & 0 deletions l10n_it_fatturapa/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
> - Giovanni Serra \<<[email protected]>\>
- [Aion Tech](https://aiontech.company/):
- Simone Rubino \<<[email protected]>\>
- [Stesi Consulting](https://www.stesi.consulting):
- Michele Di Croce \<<[email protected]>\>
5 changes: 5 additions & 0 deletions l10n_it_fatturapa/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,11 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<li>Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;aion-tech.it">simone.rubino&#64;aion-tech.it</a>&gt;</li>
</ul>
</li>
<li><p class="first"><a class="reference external" href="https://www.stesi.consulting">Stesi Consulting</a>:</p>
<ul class="simple">
<li>Michele Di Croce &lt;<a class="reference external" href="mailto:dicroce.m&#64;stesi.consulting">dicroce.m&#64;stesi.consulting</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
22 changes: 22 additions & 0 deletions l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,28 @@ def test_access_other_user_e_invoice(self):
e_invoice = invoices.fatturapa_attachment_in_id
self.assertTrue(e_invoice.ir_attachment_id.read())

def test_access_other_user_e_invoice_attachments(self):
"""A user can see the e-invoice attachments created by other users."""
# Arrange
access_right_group_xmlid = "base.group_erp_manager"
user = self.env.user
user.groups_id -= self.env.ref("base.group_system")
user.groups_id -= self.env.ref(access_right_group_xmlid)
other_user = user.copy(default={"login": "attachment_user"})
# pre-condition
self.assertFalse(user.has_group(access_right_group_xmlid))
self.assertNotEqual(user, other_user)
import_action = self.run_wizard(
"access_other_user_e_invoice_attachments", "IT02780790107_11004.xml"
)
# Assert
with self.with_user(other_user.login):
invoices = self.env[import_action["res_model"]].search(
import_action["domain"]
)
e_invoice = invoices.fatturapa_doc_attachments
self.assertTrue(e_invoice.ir_attachment_id.read())
Comment on lines +1148 to +1149
Copy link
Contributor

Choose a reason for hiding this comment

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

e_invoice può essere fuorviante perché in realtà questo è un allegato della fattura elettronica, lo si potrebbe chiamare ad esempio e_attachment?



class TestFatturaPAEnasarco(FatturapaCommon):
def setUp(self):
Expand Down
Loading