mirror of
https://github.com/OCA/knowledge.git
synced 2025-08-28 10:16:13 -06:00
[MIG] document_page_tag_print_control: Migration to 18.0
This commit is contained in:
parent
4d004dacb3
commit
c3fb63dbc7
@ -3,7 +3,7 @@
|
||||
{
|
||||
"name": "Document Page Tag Print Control",
|
||||
"summary": "Restricts document page printing based on assigned tags",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "18.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Sygel, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/knowledge",
|
||||
|
@ -39,6 +39,14 @@ class TestDocumentPrintControl(TransactionCase):
|
||||
}
|
||||
)
|
||||
|
||||
for doc in [
|
||||
cls.doc_without_tags,
|
||||
cls.doc_printable,
|
||||
cls.doc_non_printable,
|
||||
cls.doc_mixed_tags,
|
||||
]:
|
||||
doc._compute_is_not_printable()
|
||||
|
||||
def test_document_without_tags_is_printable(self):
|
||||
"""Document without tags is printable."""
|
||||
self.assertFalse(self.doc_without_tags.is_not_printable)
|
||||
@ -57,6 +65,9 @@ class TestDocumentPrintControl(TransactionCase):
|
||||
|
||||
def test_report_non_printable_raises_error(self):
|
||||
"""Report fails if all documents are non-printable."""
|
||||
self.env.user.groups_id -= self.env.ref("document_page.group_document_manager")
|
||||
self.doc_non_printable._compute_is_not_printable()
|
||||
|
||||
with self.assertRaises(UserError) as ctx:
|
||||
self.env["report.document_page.report_documentpage"]._get_report_values(
|
||||
[self.doc_non_printable.id]
|
||||
@ -65,6 +76,10 @@ class TestDocumentPrintControl(TransactionCase):
|
||||
|
||||
def test_report_mixed_docs_raises_error(self):
|
||||
"""Report fails if some documents are non-printable."""
|
||||
self.env.user.groups_id -= self.env.ref("document_page.group_document_manager")
|
||||
self.doc_printable._compute_is_not_printable()
|
||||
self.doc_non_printable._compute_is_not_printable()
|
||||
|
||||
with self.assertRaises(UserError) as ctx:
|
||||
self.env["report.document_page.report_documentpage"]._get_report_values(
|
||||
[self.doc_printable.id, self.doc_non_printable.id]
|
||||
|
Loading…
Reference in New Issue
Block a user