Files
odoo_source/addons/idea/test/test_idea.yml
T
2010-07-08 15:50:32 +05:30

90 lines
2.9 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: '05/13/2010 19:16:26'
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
title: 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 "user1".
-
!record {model: res.users, id: res_users_user0}:
company_id: base.main_company
context_lang: en_US
login: user1
name: user1
password: user1
- |
And I will also create user2.
-
!record {model: res.users, id: res_users_user1}:
company_id: base.main_company
context_lang: en_US
login: user2
name: user2
password: user2
- |
In order to post vote I connect as user1 and open the idea page
I click on "Submit Vote" wizard button and vote the idea as "Normal"
-
!python {model: idea.post.vote}: |
uid = ref('res_users_user0')
new_id = self.create(cr, uid, {'vote': 50}, {"active_ids": [ref("idea_idea_0")]})
self.do_vote(cr, uid, [new_id], {"active_ids": [ref("idea_idea_0")]})
- |
To add other vote I connect as 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}: |
uid = ref('res_users_user1')
new_id = self.create(cr, uid, {'vote': 100, 'note': 'We can learn many things from technical presentation'}, {"active_ids": [ref("idea_idea_0")]})
self.do_vote(cr, uid, [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'