diff --git a/document_page_approval/security/ir.model.access.csv b/document_page_approval/security/ir.model.access.csv index e4835836..f8e75f15 100644 --- a/document_page_approval/security/ir.model.access.csv +++ b/document_page_approval/security/ir.model.access.csv @@ -1,2 +1,2 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -document_page_history,document.page.history,model_document_page_history,base.group_document_approver_user,1,1,1,0 \ No newline at end of file +document_page_history,document.page.history,model_document_page_history,group_document_approver_user,1,1,1,0 diff --git a/document_page_approval/tests/test_document_page_history_workflow.py b/document_page_approval/tests/test_document_page_history_workflow.py index 419f6e69..3210c926 100644 --- a/document_page_approval/tests/test_document_page_history_workflow.py +++ b/document_page_approval/tests/test_document_page_history_workflow.py @@ -12,30 +12,25 @@ class TestDocumentPageHistoryWorkflow(common.TransactionCase): def test_can_user_approve_this_page(self): """Test if a user can approve this page.""" - group = self.env['res.groups'].search([ - ('name', '=', 'Document approver') - ]) category = self.env.ref('document_page.demo_category1') category.approval_required = True - category.approver_uid = group + category.approver_gid = self.env.ref('document_page_approval.group_document_approver_user') page = self.env['document.page'].create({ 'name': 'Test Page10', + 'content': 'A difficult test', 'parent_id': category.id }) - # history = self.env['document.page.history'] - # history_ids = history.search( - # [ - # ('page_id', '=', page.id) - # ], - # limit=1, - # order='create_date DESC' - #) - #history_ids.signal_workflow('page_approval_draft') - #state = history_ids.state == 'draft' - # state = history_ids[0].page_id == page.id - self.assertTrue(page.is_approval_required(page)) + history = self.env['document.page.history'].search( + [ + ('page_id', '=', page.id) + ], + limit=1, + order='create_date DESC' + ) + + self.assertTrue(history.can_user_approve_page) def test_get_approvers_guids(self): """Get approver guids."""