From 89e4db2876bd1ad217eeb4d903385d9e01ca3126 Mon Sep 17 00:00:00 2001 From: micheledic Date: Thu, 11 Jul 2024 17:57:48 +0200 Subject: [PATCH] [FIX] l10n_it_fatturapa: link fatturapa.attachments tests --- .../tests/test_import_fatturapa_xml.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py b/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py index fad34d0d5bfb..14e81eb82289 100644 --- a/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py +++ b/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py @@ -1126,6 +1126,29 @@ 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 files 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(login="attachment_user") + # pre-condition + self.assertFalse(user.has_group(access_right_group_xmlid)) + self.assertNotEqual(user, other_user) + + # Act + with self.with_user(other_user.login): + import_action = self.run_wizard( + "access_other_user_e_invoice_attachments", "IT02780790107_11004.xml" + ) + + # Assert + 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):