odoo/addons/idea/test/test_idea.yml

91 lines
3.1 KiB
YAML

- |
In order to test the Idea module in OpenERP,
we will create a full flow, from the idea definition up to the votes and discussions on the idea.
- |
Given that I have an Idea category "Technical".
-
!record {model: idea.category, id: idea_category_technical0}:
name: Technical
- |
I create a New Idea of "Technical presentation for 1 hours in every day" and specify category "Technical".
-
!record {model: idea.idea, id: idea_idea_0}:
category_id: idea_category_technical0
created_date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
description: I want that Technical presentation are arranged for 1 hours in every
day.\nso, on that presentation, we can know all things what improvement and development
are done in our company.\n\n\n\n\n
name: Technical presentation for 1 hours in every day
user_id: base.user_root
- |
I check that the idea is in draft state.
-
!assert {model: idea.idea, id: idea_idea_0}:
- state == 'draft'
- |
I open this idea by clicking on the "Open" button.
-
!workflow {model: idea.idea, action: idea_open, ref: idea_idea_0}
- |
In order to check voting statistics in real systems I will create 2 new Users "test_idea_user1".
-
!record {model: res.users, id: test_idea_user1}:
company_id: base.main_company
context_lang: en_US
login: test_idea_user1
name: Idea test user1
password: test_idea_user1
groups_id: [ base.group_tool_user, ]
- |
And I will also create user2.
-
!record {model: res.users, id: test_idea_user2}:
company_id: base.main_company
context_lang: en_US
login: test_idea_user2
name: Idea test user2
password: test_idea_user2
groups_id: [ base.group_tool_user, ]
- |
In order to post vote I connect as test_idea_user1 and open the idea page
I click on "Submit Vote" wizard button and vote the idea as "Normal"
-
!python {model: idea.post.vote}: |
uid2 = ref('test_idea_user1')
new_id = self.create(cr, uid2, {'vote': 50}, {"active_ids": [ref("idea_idea_0")]})
self.do_vote(cr, uid2, [new_id], {"active_ids": [ref("idea_idea_0")]})
- |
To add other vote I connect as test_idea_user2 and open the idea page.
I click on "Submit Vote" wizard button and vote the idea as "Very Good".
and put comment "We can learn many things from technical presentation".
-
!python {model: idea.post.vote}: |
uid2 = ref('test_idea_user2')
new_id = self.create(cr, uid2, {'vote': 100, 'note': 'We can learn many things from technical presentation'}, {"active_ids": [ref("idea_idea_0")]})
self.do_vote(cr, uid2, [new_id], {'active_ids': [ref('idea_idea_0')]})
- |
I can see that the Average score changed in "Average score" field with value 75
-
!record {model: idea.idea, id: idea_idea_0}:
vote_avg: 75
- |
I connect as Manager and close this idea by click on "Close" button.
-
!workflow {model: idea.idea, action: idea_close, ref: idea_idea_0}
- |
I check that the idea's state is now Accepted
-
!assert {model: idea.idea, id: idea_idea_0}:
- state == 'close'