[FIX]: fix a problem for the idea test scenario, also change a comment method
authorMantavya Gajjar <mga@tinyerp.com>
Tue, 18 May 2010 14:09:01 +0000 (19:39 +0530)
committerMantavya Gajjar <mga@tinyerp.com>
Tue, 18 May 2010 14:09:01 +0000 (19:39 +0530)
bzr revid: mga@tinyerp.com-20100518140901-amke1lt2nbdvak4n

addons/idea/__openerp__.py
addons/idea/test/test_idea.yml
addons/idea/wizard/idea_post_vote.py

index c297d42..0db8696 100644 (file)
@@ -45,7 +45,9 @@
     'demo_xml': [
         "idea_data.xml"
     ],
-    'test':['test/test_idea.yml'],
+    'test':[
+        'test/test_idea.yml'
+    ],
     'installable': True,
     'certificate': '0071515601309',
 }
index c1ee6de..6714fbf 100644 (file)
 - 
   !record {model: idea.idea, id: idea.idea_idea_0}:
     comment_ids:
-      - content: We can learn many things from technical presentation
+      - content: "We can learn many things from technical presentation"
         idea_id: idea.idea_idea_0
         user_id: res_users_user1
+        
 - |
   I connect as Manager and  close this idea by click on "Close" button.
 -
 -
   !assert {model: idea.idea, id: idea_idea_0}: 
     - state == 'close'  
-    
\ No newline at end of file
+    
index 73d9176..f68496c 100644 (file)
@@ -93,19 +93,21 @@ class idea_post_vote(osv.osv_memory):
 
         for do_vote_obj in self.read(cr, uid, ids):
             score = str(do_vote_obj['vote'])
-            comment = do_vote_obj['note']
+            comment = do_vote_obj.get('note', False)
             vote = {
                 'idea_id': vote_id, 
                 'user_id': uid, 
                 'score': score
             }
-            comment = {
-                'user_id':uid,
-                'idea_id':vote_id,
-                'content': comment,
-            }
+            if comment:
+                comment = {
+                    'user_id':uid,
+                    'idea_id':vote_id,
+                    'content': comment,
+                }
+                comment = comment_pool.create(cr, uid, comment)
+                
             vote = vote_pool.create(cr, uid, vote)
-            comment = comment_pool.create(cr, uid, comment)
             return {}
 
 idea_post_vote()