mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-21 11:37:26 -06:00
commit
44b038da47
@ -5,8 +5,7 @@
|
|||||||
|
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
|
|
||||||
<record id="email_template_new_draft_need_approval"
|
<record id="email_template_new_draft_need_approval" model="mail.template">
|
||||||
model="mail.template">
|
|
||||||
<field name="name">Automated new draft need approval Notification Mail</field>
|
<field name="name">Automated new draft need approval Notification Mail</field>
|
||||||
<field name="email_from">${object.create_uid.company_id.email or 'noreply@localhost.com'}</field>
|
<field name="email_from">${object.create_uid.company_id.email or 'noreply@localhost.com'}</field>
|
||||||
<field name="subject">New version of "${object.page_id.name}" to approve</field>
|
<field name="subject">New version of "${object.page_id.name}" to approve</field>
|
||||||
@ -14,7 +13,8 @@
|
|||||||
<field name="model_id" ref="model_document_page_history"/>
|
<field name="model_id" ref="model_document_page_history"/>
|
||||||
<field name="auto_delete" eval="True"/>
|
<field name="auto_delete" eval="True"/>
|
||||||
<field name="lang">${object.create_uid.partner_id.lang}</field>
|
<field name="lang">${object.create_uid.partner_id.lang}</field>
|
||||||
<field name="body_html"><![CDATA[
|
<field name="body_html">
|
||||||
|
<![CDATA[
|
||||||
<p>Hello,</p>
|
<p>Hello,</p>
|
||||||
|
|
||||||
<p>The page "${object.page_id.name}" has been modified and need your approval.</p>
|
<p>The page "${object.page_id.name}" has been modified and need your approval.</p>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="0">
|
<data noupdate="0">
|
||||||
<record id="base.group_document_approver_user" model="res.groups">
|
<record id="group_document_approver_user" model="res.groups">
|
||||||
<field name="name">Document approver</field>
|
<field name="name">Document approver</field>
|
||||||
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
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
|
document_page_history,document.page.history,model_document_page_history,group_document_approver_user,1,1,1,0
|
||||||
|
|
@ -22,7 +22,8 @@ class TestDocumentPageApproval(common.TransactionCase):
|
|||||||
self.assertIsNotNone(page.display_content, 'Page content')
|
self.assertIsNotNone(page.display_content, 'Page content')
|
||||||
|
|
||||||
# Check if approval is required
|
# Check if approval is required
|
||||||
self.assertFalse(page.is_approval_required(page))
|
self.assertTrue(page.is_approval_required(page) ==
|
||||||
|
category.approval_required)
|
||||||
|
|
||||||
# Check content of an approval page
|
# Check content of an approval page
|
||||||
page.approval_required = True
|
page.approval_required = True
|
||||||
|
@ -12,17 +12,26 @@ class TestDocumentPageHistoryWorkflow(common.TransactionCase):
|
|||||||
|
|
||||||
def test_can_user_approve_this_page(self):
|
def test_can_user_approve_this_page(self):
|
||||||
"""Test if a user can approve this page."""
|
"""Test if a user can approve this page."""
|
||||||
user = self.env.user
|
|
||||||
category = self.env.ref('document_page.demo_category1')
|
category = self.env.ref('document_page.demo_category1')
|
||||||
category.approval_required = True
|
category.approval_required = True
|
||||||
category.approver_uid = user
|
category.approver_gid = self.env.ref(
|
||||||
|
'document_page_approval.group_document_approver_user')
|
||||||
|
|
||||||
pages = self.env['document.page.history'].search([
|
page = self.env['document.page'].create({
|
||||||
('page_id', '=', category.id)
|
'name': 'Test Page10',
|
||||||
])
|
'content': 'A difficult test',
|
||||||
page = pages[0]
|
'parent_id': category.id
|
||||||
|
})
|
||||||
|
|
||||||
self.assertTrue(page.can_user_approve)
|
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):
|
def test_get_approvers_guids(self):
|
||||||
"""Get approver guids."""
|
"""Get approver guids."""
|
||||||
|
Loading…
Reference in New Issue
Block a user