Skip to content

Commit

Permalink
Merge PR #4463 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by francesco-ooops
  • Loading branch information
OCA-git-bot committed Nov 28, 2024
2 parents ce388d4 + 5fd7237 commit 1607f6c
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 2 deletions.
3 changes: 3 additions & 0 deletions l10n_it_fatturapa/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ Contributors

* Simone Rubino <[email protected]>

* `Stesi Consulting <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": "14.0.2.3.2",
"version": "14.0.2.3.3",
"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/14.0.2.3.3/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 @@ -216,6 +216,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
3 changes: 3 additions & 0 deletions l10n_it_fatturapa/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
* `Aion Tech <https://aiontech.company/>`_:

* Simone Rubino <[email protected]>

* `Stesi Consulting <https://www.stesi.consulting/>`_:
* Michele Di Croce <[email protected]>
3 changes: 3 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,9 @@ <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>:
* Michele Di Croce &lt;<a class="reference external" href="mailto:dicroce.m&#64;stesi.consulting">dicroce.m&#64;stesi.consulting</a>&gt;</p>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
28 changes: 28 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 @@ -1199,6 +1199,34 @@ 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 = self.env["res.users"].create(
{
"name": "Attachment User",
"login": "attachment_user",
"groups_id": [(6, 0, user.groups_id.ids)],
}
)
# 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())


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

0 comments on commit 1607f6c

Please sign in to comment.