[IMP] added dependancy of auth_signup module for signup, make signup by default tru, show favourite questions on user profile.
bzr revid: tpa@tinyerp.com-20140407115650-5qr23bn7taj1mwzt
This commit is contained in:
parent
dfcc2e3a96
commit
847d0a9408
|
@ -29,7 +29,7 @@
|
|||
Ask questions, get answers, no distractions
|
||||
""",
|
||||
'author': 'OpenERP SA',
|
||||
'depends': ['website', 'website_mail', 'gamification', 'website_partner'],
|
||||
'depends': ['website', 'website_mail', 'gamification', 'website_partner', 'auth_signup'],
|
||||
'data': [
|
||||
'data/forum_data.xml',
|
||||
'views/website_forum.xml',
|
||||
|
|
|
@ -237,6 +237,10 @@ class website_forum(http.Controller):
|
|||
que_ids = Post.search(cr, uid, [('id', 'in', post_ids), ('forum_id', '=', forum.id), ('parent_id', '=', False)], context=context)
|
||||
followed = Post.browse(cr, uid, que_ids, context=context)
|
||||
|
||||
#showing Favourite questions of user.
|
||||
fav_que_ids = Post.search(cr, uid, [('favourite_ids', '=', user.id), ('forum_id', '=', forum.id), ('parent_id', '=', False)], context=context)
|
||||
favourite = Post.browse(cr, uid, fav_que_ids, context=context)
|
||||
|
||||
#votes which given on users questions and answers.
|
||||
data = Vote.read_group(cr, uid, [('post_id.forum_id', '=', forum.id), ('post_id.user_id', '=', user.id)], ["vote"], groupby=["vote"], context=context)
|
||||
up_votes, down_votes = 0, 0
|
||||
|
@ -273,6 +277,7 @@ class website_forum(http.Controller):
|
|||
'questions': user_questions,
|
||||
'answers': user_answers,
|
||||
'followed': followed,
|
||||
'favourite': favourite,
|
||||
'total_votes': total_votes,
|
||||
'up_votes': up_votes,
|
||||
'down_votes': down_votes,
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
<field name="state">open</field>
|
||||
</record-->
|
||||
|
||||
<record id="default_allow_auth_signup" model="ir.config_parameter">
|
||||
<field name="key">auth_signup.allow_uninvited</field>
|
||||
<field name="value" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- related subtypes -->
|
||||
<record id="mt_question_create" model="mail.message.subtype">
|
||||
<field name="name">Asked a question</field>
|
||||
|
|
|
@ -94,9 +94,6 @@ class Post(osv.Model):
|
|||
res[post.id] = len(post.child_ids)
|
||||
return res
|
||||
|
||||
def _get_child(self, cr, uid, ids, context=None):
|
||||
return ids
|
||||
|
||||
def _get_view_count(self, cr, uid, ids, field_name=False, arg={}, context=None):
|
||||
res = dict.fromkeys(ids, 0)
|
||||
for post in self.browse(cr, uid, ids, context=context):
|
||||
|
@ -171,7 +168,7 @@ class Post(osv.Model):
|
|||
'child_ids': fields.one2many('website.forum.post', 'parent_id', 'Answers'),
|
||||
'child_count':fields.function(_get_child_count, string="Answers", type='integer',
|
||||
store={
|
||||
'website.forum.post': (_get_child, [], 10),
|
||||
'website.forum.post': (lambda self, cr, uid, ids, c={}: ids, [], 10),
|
||||
}
|
||||
),
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<field name="name">res_partner: public</field>
|
||||
<field name="model_id" ref="base.model_res_partner"/>
|
||||
<field name="domain_force">[]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_public'))]"/>
|
||||
<field name="groups" eval="[(4, ref('base.group_public')),(4, ref('base.group_portal'))]"/>
|
||||
<field name="perm_create" eval="False"/>
|
||||
<field name="perm_unlink" eval="False"/>
|
||||
<field name="perm_write" eval="False"/>
|
||||
|
|
|
@ -763,15 +763,18 @@
|
|||
<li>
|
||||
<a href="#answers" data-toggle="tab"><t t-esc="len(answers)"/> Answers</a>
|
||||
</li>
|
||||
<li t-if="uid == user.id">
|
||||
<a href="#favourite_question" data-toggle="tab"><t t-esc="len(favourite)"/> Favourite Questions</a>
|
||||
</li>
|
||||
<li t-if="uid == user.id">
|
||||
<a href="#followed_question" data-toggle="tab"><t t-esc="len(followed)"/> Followed Questions</a>
|
||||
</li>
|
||||
<li t-if="uid == user.id">
|
||||
<a href="#activity" data-toggle="tab">Activity</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#badges" data-toggle="tab">Badges</a>
|
||||
</li>
|
||||
<li t-if="uid == user.id">
|
||||
<a href="#followed_question" data-toggle="tab"><t t-esc="len(followed)"/> Followed Question</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#votes" data-toggle="tab">Votes</a>
|
||||
</li>
|
||||
|
@ -792,6 +795,11 @@
|
|||
<div class="tab-pane" id="badges">
|
||||
<t t-call="website_forum.user_badges"/>
|
||||
</div>
|
||||
<div class="tab-pane" id="favourite_question">
|
||||
<div t-foreach="favourite" t-as="question">
|
||||
<t t-call="website_forum.post_list"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="followed_question">
|
||||
<div t-foreach="followed" t-as="question">
|
||||
<t t-call="website_forum.post_list"/>
|
||||
|
|
Loading…
Reference in New Issue