summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>2014-02-21 18:46:08 +0530
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>2014-02-21 18:46:08 +0530
commitd743ac0a8369860b950b3d137c2fa648585e070e (patch)
treec0413a5637a7ee06e1f3f5520520e5a6450f2342
parentd24b67ed3ec568e3eb5b4296519e28a2721314b2 (diff)
[ADD] website_forum for question and answer
bzr revid: tpa@tinyerp.com-20140221131608-e37a88h2u8ljkomr
-rw-r--r--addons/website_event/controllers/main.py4
-rw-r--r--addons/website_forum/__init__.py23
-rw-r--r--addons/website_forum/__openerp__.py25
-rw-r--r--addons/website_forum/controllers/__init__.py3
-rw-r--r--addons/website_forum/controllers/main.py94
-rw-r--r--addons/website_forum/data/forum_data.xml22
-rw-r--r--addons/website_forum/data/forum_demo.xml71
-rw-r--r--addons/website_forum/doc/changelog.rst9
-rw-r--r--addons/website_forum/doc/index.rst10
-rw-r--r--addons/website_forum/models/__init__.py1
-rw-r--r--addons/website_forum/models/forum.py85
-rw-r--r--addons/website_forum/security/ir.model.access.csv2
-rw-r--r--addons/website_forum/security/website_forum.xml6
-rw-r--r--addons/website_forum/static/src/css/Makefile2
-rw-r--r--addons/website_forum/static/src/css/website_forum.css55
-rw-r--r--addons/website_forum/static/src/css/website_forum.sass5
-rw-r--r--addons/website_forum/static/src/js/website.tour.forum.js31
-rw-r--r--addons/website_forum/static/src/js/website_forum.editor.js31
-rw-r--r--addons/website_forum/static/src/xml/website_forum.xml7
-rw-r--r--addons/website_forum/tests/__init__.py24
-rw-r--r--addons/website_forum/tests/test_ui.py6
-rw-r--r--addons/website_forum/views/website_forum.xml292
22 files changed, 808 insertions, 0 deletions
diff --git a/addons/website_event/controllers/main.py b/addons/website_event/controllers/main.py
index 2a6e1d134e3..21d259a3b70 100644
--- a/addons/website_event/controllers/main.py
+++ b/addons/website_event/controllers/main.py
@@ -35,6 +35,7 @@ import werkzeug.urls
class website_event(http.Controller):
@http.route(['/event/', '/event/page/<int:page>'], type='http', auth="public", website=True, multilang=True)
def events(self, page=1, **searches):
+ print "events----------------",self,page,searches
cr, uid, context = request.cr, request.uid, request.context
event_obj = request.registry['event.event']
type_obj = request.registry['event.type']
@@ -162,6 +163,7 @@ class website_event(http.Controller):
@http.route(['/event/<model("event.event"):event>/page/<page:page>'], type='http', auth="public", website=True, multilang=True)
def event_page(self, event, page, **post):
+ print "event_page-------------------"
values = {
'event': event,
'main_object': event
@@ -170,6 +172,7 @@ class website_event(http.Controller):
@http.route(['/event/<model("event.event"):event>'], type='http', auth="public", website=True, multilang=True)
def event(self, event, **post):
+ print "in event---------------"
if event.menu_id and event.menu_id.child_id:
target_url = event.menu_id.child_id[0].url
else:
@@ -180,6 +183,7 @@ class website_event(http.Controller):
@http.route(['/event/<model("event.event"):event>/register'], type='http', auth="public", website=True, multilang=True)
def event_register(self, event, **post):
+ print "event_register-------------------"
values = {
'event': event,
'main_object': event,
diff --git a/addons/website_forum/__init__.py b/addons/website_forum/__init__.py
new file mode 100644
index 00000000000..708d6ce4669
--- /dev/null
+++ b/addons/website_forum/__init__.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import controllers
+import models
diff --git a/addons/website_forum/__openerp__.py b/addons/website_forum/__openerp__.py
new file mode 100644
index 00000000000..5bc52222ba8
--- /dev/null
+++ b/addons/website_forum/__openerp__.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+
+{
+ 'name': 'Forum',
+ 'category': 'Website',
+ 'summary': 'Ask Questions and give Answers',
+ 'version': '1.0',
+ 'description': """
+Ask questions, get answers, no distractions
+ """,
+ 'author': 'OpenERP SA',
+ 'depends': ['website', 'website_mail'],
+ 'data': [
+ 'data/forum_data.xml',
+ 'views/website_forum.xml',
+ 'security/ir.model.access.csv',
+ 'security/website_forum.xml',
+ ],
+ 'qweb': ['static/src/xml/*.xml'],
+ 'demo': [
+ 'data/forum_demo.xml'
+ ],
+ 'installable': True,
+ 'application': True,
+}
diff --git a/addons/website_forum/controllers/__init__.py b/addons/website_forum/controllers/__init__.py
new file mode 100644
index 00000000000..bbd183e955b
--- /dev/null
+++ b/addons/website_forum/controllers/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+import main
diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py
new file mode 100644
index 00000000000..3605085188d
--- /dev/null
+++ b/addons/website_forum/controllers/main.py
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp import SUPERUSER_ID
+from openerp.addons.web import http
+from openerp.addons.web.http import request
+from openerp.tools.translate import _
+from openerp.addons.website.controllers.main import Website as controllers
+controllers = controllers()
+
+
+from datetime import datetime, timedelta
+from dateutil.relativedelta import relativedelta
+from openerp import tools
+import werkzeug.urls
+
+class website_forum(http.Controller):
+ @http.route(['/question/', '/question/page/<int:page>'], type='http', auth="public", website=True, multilang=True)
+ def questions(self, page=1, **searches):
+ print "questions----------------",self,page,searches
+ cr, uid, context = request.cr, request.uid, request.context
+ forum_obj = request.registry['website.forum.post']
+ tag_obj = request.registry['website.forum.tag']
+
+ step = 5
+ question_count = forum_obj.search(
+ request.cr, request.uid, [], count=True,
+ context=request.context)
+ pager = request.website.pager(url="/question/", total=question_count, page=page, step=step, scope=5)
+
+ obj_ids = forum_obj.search(
+ request.cr, request.uid, [], limit=step,
+ offset=pager['offset'], context=request.context)
+ question_ids = forum_obj.browse(request.cr, request.uid, obj_ids,
+ context=request.context)
+
+ print "question_ids----",question_ids
+ values = {
+ 'question_ids': question_ids,
+ 'pager': pager,
+ 'searches': searches,
+ }
+
+ return request.website.render("website_forum.index", values)
+
+ @http.route(['/question/<model("website.forum.post"):question>/page/<page:page>'], type='http', auth="public", website=True, multilang=True)
+ def question_page(self, question, page, **post):
+ values = {
+ 'question': question,
+ 'main_object': question
+ }
+ return request.website.render(page, values)
+
+ @http.route(['/question/<model("website.forum.post"):question>'], type='http', auth="public", website=True, multilang=True)
+ def question_register(self, question, **post):
+ values = {
+ 'question': question,
+ 'main_object': question,
+ 'range': range,
+ }
+ return request.website.render("website_forum.question_description_full", values)
+
+ @http.route('/question/add_question/', type='http', auth="user", multilang=True, methods=['POST'], website=True)
+ def add_question(self, question_name="New question", **kwargs):
+ return self._add_question(question_name, request.context, **kwargs)
+
+ def _add_question(self, question_name=None, context={}, **kwargs):
+ if not question_name:
+ question_name = _("New Question")
+ Question = request.registry.get('website.forum.post')
+ date_begin = datetime.today() + timedelta(days=(14))
+ vals = {
+ 'topic': question_name,
+ }
+ question_id = Question.create(request.cr, request.uid, vals, context=context)
+ return request.redirect("/question/%s/?enable_editor=1" % question_id)
diff --git a/addons/website_forum/data/forum_data.xml b/addons/website_forum/data/forum_data.xml
new file mode 100644
index 00000000000..bd6e56f673e
--- /dev/null
+++ b/addons/website_forum/data/forum_data.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data noupdate="1">
+
+ <record id="menu_questions" model="website.menu">
+ <field name="name">Questions</field>
+ <field name="url">/question</field>
+ <field name="parent_id" ref="website.main_menu"/>
+ <field name="sequence" type="int">40</field>
+ </record>
+ <!--record id="action_open_website" model="ir.actions.act_url">
+ <field name="name">Website Home</field>
+ <field name="target">self</field>
+ <field name="url">/question?tutorial.question=true</field>
+ </record>
+ <record id="base.open_menu" model="ir.actions.todo">
+ <field name="action_id" ref="action_open_website"/>
+ <field name="state">open</field>
+ </record-->
+
+ </data>
+</openerp>
diff --git a/addons/website_forum/data/forum_demo.xml b/addons/website_forum/data/forum_demo.xml
new file mode 100644
index 00000000000..92891bba371
--- /dev/null
+++ b/addons/website_forum/data/forum_demo.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="question_0" model="website.forum.post">
+ <field name="name">How to configure alerts for employee contract expiration.</field>
+ <field name="views">45</field>
+ </record>
+
+ <record id="question_1" model="website.forum.post">
+ <field name="name">How to get translated state through browse ?</field>
+ <field name="body">Hello everybody,
+
+I use a XML-RPC to access to invoices, I want to get the states of invoices, but always I get paid instead of PayƩ (French)</field>
+ <field name="views">45</field>
+ </record>
+
+ <record id="question_2" model="website.forum.post">
+ <field name="name">Restrain the user from confirming the Purchase requisition</field>
+ <field name="views">45</field>
+ <field name="body">Can anybody tell me how to restrict the user from confirming the purchase requisition? In my case when a user is creating a purchase requisition than the user after saving it is able to send it to the supplier rather I want the user to just generate the purchase requisition and let the manager do the remaining works like sending the purchase requisition to the supplier and than receiving the goods. Please help me out. Thanks in advance.</field>
+ </record>
+
+ <record id="question_4" model="website.forum.post">
+ <field name="name">Offline installing for add-ons</field>
+ <field name="views">45</field>
+ <field name="body">How can I install web based addons without Internet connections (I'm using OpenERP over LAN)?
+
+P.S.
+
+AFAIK current version (7.x) supports web interface while the desktop clients became deprecated.
+BTW, I left OpenERP since ver. 6.x to use PostBooks instead but I recently decided to use OpenERP once again after recent new features.</field>
+ </record>
+
+ <record id="question_5" model="website.forum.post">
+ <field name="name">CMS replacement for ERP and eCommerce</field>
+ <field name="views">45</field>
+ <field name="body">I use Wordpress as a CMS and eCommerce platform. The developing in Wordpress is too easy and solid but it missing ERP feature (there is single plugin to integrate with Frontaccounting) so I wonder:
+
+Can I use OpenERP as a replacement CMS of Wordpress + eCommerce plugin?
+
+In simple words does OpenERP became CMS+ERP platform?</field>
+ </record>
+
+ <record id="question_6" model="website.forum.post">
+ <field name="name">Register payment using XMLRPC</field>
+ <field name="views">45</field>
+ <field name="body">Hi there,
+
+I have been trying to register an invoice payment through OpenERP. I have been able to manually create and approve the invoice, the voucher and its line
+
+I'm currently creating the voucher using this information:</field>
+ </record>
+
+ <record id="question_7" model="website.forum.post">
+ <field name="name">Create one field on two modules</field>
+ <field name="views">45</field>
+ <field name="body">Hello,
+
+I shall like creating a field "x" on an order form ( stock.picking.form ) and to reveal it also on the delivery slip ( stock.picking.form ).
+
+Thank you in advance</field>
+ </record>
+
+ <record id="question_8" model="website.forum.post">
+ <field name="name">access rights to one2many field</field>
+ <field name="views">45</field>
+ <field name="body">Now i create new group , assign user and access right as READ &amp; CREATE to object stock.picking.ads but nothing is reflected , iam able to delete and write which should not happen. Very Strange!!!</field>
+ </record>
+ </data>
+</openerp>
diff --git a/addons/website_forum/doc/changelog.rst b/addons/website_forum/doc/changelog.rst
new file mode 100644
index 00000000000..51036d22b70
--- /dev/null
+++ b/addons/website_forum/doc/changelog.rst
@@ -0,0 +1,9 @@
+.. _changelog:
+
+Changelog
+=========
+
+`trunk (saas-3)`
+----------------
+
+ - created ``website_forum``
diff --git a/addons/website_forum/doc/index.rst b/addons/website_forum/doc/index.rst
new file mode 100644
index 00000000000..104e0473263
--- /dev/null
+++ b/addons/website_forum/doc/index.rst
@@ -0,0 +1,10 @@
+Website Forum Module documentation topics
+'''''''''''''''''''''''''''''''''''''''''
+
+Changelog
+'''''''''
+
+.. toctree::
+ :maxdepth: 1
+
+ changelog.rst
diff --git a/addons/website_forum/models/__init__.py b/addons/website_forum/models/__init__.py
new file mode 100644
index 00000000000..55d2f069a75
--- /dev/null
+++ b/addons/website_forum/models/__init__.py
@@ -0,0 +1 @@
+import forum
diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py
new file mode 100644
index 00000000000..087e3a1e5ec
--- /dev/null
+++ b/addons/website_forum/models/forum.py
@@ -0,0 +1,85 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import osv, fields
+from openerp import SUPERUSER_ID
+
+from openerp.tools.translate import _
+import re
+
+from openerp.addons.website.models.website import slug
+
+#class WebsiteForum(osv.Model):
+# _inhrit = "website"
+
+class website_form_post_rate(osv.Model):
+ _name = "website.forum.post.rate"
+ _column = {
+ 'post_id': fields.many2one('website.forum.post', 'Forum Post'),
+ 'user_id': fields.many2one('res.users', 'User'),
+ 'rate': fields.integer('rate'),
+ }
+
+class website_forum_post(osv.Model):
+ _name = "website.forum.post"
+ _description = "Website forum post"
+ _inherit = ['mail.thread', 'website.seo.metadata']
+
+ _columns = {
+ #add version and category , instead of page use category in website,
+ 'name': fields.char('Topic', size=64),
+ 'body': fields.html('Contents', help='Automatically sanitized HTML contents'),
+ #'forum_id': fields.many2one('website.forum', 'Forum'),
+ 'create_date': fields.datetime('Created on', select=True, readonly=True),
+ 'create_uid': fields.many2one('res.users', 'Author', select=True, readonly=True ),
+ 'write_date': fields.datetime('Last Modified on', select=True, readonly=True ),
+ 'write_uid': fields.many2one('res.users', 'Last Contributor', select=True, readonly=True),
+ 'tags': fields.many2many('website.forum.tag', 'forum_tag_rel', 'forum_id', 'forum_tag_id', 'Tag'),
+ 'up_votes': fields.many2many('res.users', 'forum_user_upvotes_rel', 'forum_id', 'user_id', 'Up votes'),
+ 'favourite_que_ids': fields.many2many('res.users', 'forum_user_fav_rel', 'forum_id', 'user_id', 'Down votes'),
+ 'views': fields.integer('Views'),
+ 'state': fields.selection([('active', 'Active'),('close', 'Close'),('offensive', 'Offensive')], 'Status'),
+ 'parent_id': fields.many2one('website.forum.post', 'Parent'),
+ 'child_ids': fields.one2many('website.forum.post', 'parent_id', 'Child'),
+ # TODO FIXME: when website_mail/mail_thread.py inheritance work -> this field won't be necessary
+ 'website_message_ids': fields.one2many(
+ 'mail.message', 'res_id',
+ domain=lambda self: [
+ '&', ('model', '=', self._name), ('type', '=', 'comment')
+ ],
+ string='Website Messages',
+ help="Website communication history",
+ ),
+ }
+ _defaults = {
+ 'state': 'active',
+ }
+
+class website_forum_tag(osv.Model):
+ _name = "website.forum.tag"
+ _description = "Website forum tag"
+ _inherit = ['website.seo.metadata']
+ _columns = {
+ 'name': fields.char('Order Reference', size=64, required=True),
+ #'forum_id': fields.many2one('website.forum', 'Forum'),
+ 'post_ids': fields.many2many('website.forum.post', 'forum_tag_que_rel', 'tag_id', 'forum_id', 'Question', readonly=True),
+ }
+
diff --git a/addons/website_forum/security/ir.model.access.csv b/addons/website_forum/security/ir.model.access.csv
new file mode 100644
index 00000000000..08145a00f54
--- /dev/null
+++ b/addons/website_forum/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+
diff --git a/addons/website_forum/security/website_forum.xml b/addons/website_forum/security/website_forum.xml
new file mode 100644
index 00000000000..b3570a73da0
--- /dev/null
+++ b/addons/website_forum/security/website_forum.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+</data>
+</openerp>
diff --git a/addons/website_forum/static/src/css/Makefile b/addons/website_forum/static/src/css/Makefile
new file mode 100644
index 00000000000..8d2edfb2ed2
--- /dev/null
+++ b/addons/website_forum/static/src/css/Makefile
@@ -0,0 +1,2 @@
+sass:
+ sass --compass --unix-newlines -t expanded website_forum.sass:website_forum.css
diff --git a/addons/website_forum/static/src/css/website_forum.css b/addons/website_forum/static/src/css/website_forum.css
new file mode 100644
index 00000000000..46e39282f90
--- /dev/null
+++ b/addons/website_forum/static/src/css/website_forum.css
@@ -0,0 +1,55 @@
+@charset "utf-8";
+@import url(compass/css3.css);
+
+.MainBody{
+ max-width: 700px;
+}
+.AskButton{
+ float: right;
+}
+.search-navbar{
+ width: 80%;
+}
+.user-profile-image{
+ height: 32px;
+ width: 32px;
+}
+.action-links{
+ margin-left: 10px;
+ margin-right: 10px;
+}
+.like{
+ color: green;
+}
+.badge-gold{
+ color : #FFD700;
+ text-shadow: 0px 0px 10px yellow;
+}
+.badge-silver{
+ color : #C0C0C0;
+ text-shadow: 0px 0px 10px yellow;
+}
+.badge-bronze{
+ color : #8c7853;
+ text-shadow: 0px 0px 10px yellow;
+}
+.-heading{
+ background-color: #428bca;
+ color: white;
+}
+.user-name-pannel{
+ height: 20px;
+}
+.custom-arrow-height{
+ height: 15px;
+ }
+.custom-vote-height{
+ height: 30px;
+}
+.correct-answer{
+ color: green;
+}
+.user-big-profile-image{
+ height: 140px;
+ width: 140px;
+} \ No newline at end of file
diff --git a/addons/website_forum/static/src/css/website_forum.sass b/addons/website_forum/static/src/css/website_forum.sass
new file mode 100644
index 00000000000..02b3490d630
--- /dev/null
+++ b/addons/website_forum/static/src/css/website_forum.sass
@@ -0,0 +1,5 @@
+@charset "utf-8"
+
+@import "compass/css3"
+
+
diff --git a/addons/website_forum/static/src/js/website.tour.forum.js b/addons/website_forum/static/src/js/website.tour.forum.js
new file mode 100644
index 00000000000..143996e5c38
--- /dev/null
+++ b/addons/website_forum/static/src/js/website.tour.forum.js
@@ -0,0 +1,31 @@
+(function () {
+ 'use strict';
+
+ var website = openerp.website;
+ var _t = openerp._t;
+
+ website.EditorBar.include({
+ start: function () {
+ this.registerTour(new website.QuestionTour(this));
+ return this._super();
+ },
+ });
+
+ website.QuestionTour = website.Tour.extend({
+ id: 'question',
+ name: "Create a question",
+ testPath: '/question(/[0-9]+/register)?',
+ init: function (editor) {
+ var self = this;
+ self.steps = [
+ {
+ title: _t("Create a question"),
+ content: _t("Let's go through the first steps to create a new question."),
+ popover: { next: _("Start Tutorial"), end: _("Skip It") },
+ },
+ ];
+ return this._super();
+ }
+ });
+
+}());
diff --git a/addons/website_forum/static/src/js/website_forum.editor.js b/addons/website_forum/static/src/js/website_forum.editor.js
new file mode 100644
index 00000000000..fc4dd863739
--- /dev/null
+++ b/addons/website_forum/static/src/js/website_forum.editor.js
@@ -0,0 +1,31 @@
+(function() {
+ "use strict";
+
+ var website = openerp.website;
+ var _t = openerp._t;
+ website.add_template_file('/website_forum/static/src/xml/website_forum.xml');
+
+ website.is_editable = true;
+ website.EditorBar.include({
+ start: function() {
+ website.is_editable_button = website.is_editable_button || !!$("#wrap.js_event").size();
+ var res = this._super();
+ this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
+ return res;
+ },
+ events: _.extend({}, website.EditorBar.prototype.events, {
+ 'click a[data-action=new_question]': function (ev) {
+ ev.preventDefault();
+ website.prompt({
+ id: "editor_new_question",
+ window_title: _t("New Question"),
+ input: "Question Name",
+ }).then(function (question_name) {
+ website.form('/forum/add_question', 'POST', {
+ question_name: question_name
+ });
+ });
+ }
+ }),
+ });
+})();
diff --git a/addons/website_forum/static/src/xml/website_forum.xml b/addons/website_forum/static/src/xml/website_forum.xml
new file mode 100644
index 00000000000..78042288b23
--- /dev/null
+++ b/addons/website_forum/static/src/xml/website_forum.xml
@@ -0,0 +1,7 @@
+<templates id="template" xml:space="preserve">
+<t t-extend="website.editorbar">
+ <t t-jquery="ul.oe_content_menu" t-operation="append">
+ <li><a href="#" data-action="new_question">New Question</a></li>
+ </t>
+</t>
+</templates>
diff --git a/addons/website_forum/tests/__init__.py b/addons/website_forum/tests/__init__.py
new file mode 100644
index 00000000000..3dcbf31d714
--- /dev/null
+++ b/addons/website_forum/tests/__init__.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Business Applications
+# Copyright (c) 20123TODAY OpenERP S.A. <http://www.openerp.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+#import test_ui
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/website_forum/tests/test_ui.py b/addons/website_forum/tests/test_ui.py
new file mode 100644
index 00000000000..fe95435e4df
--- /dev/null
+++ b/addons/website_forum/tests/test_ui.py
@@ -0,0 +1,6 @@
+import openerp.tests
+
+class TestUi(openerp.tests.HttpCase):
+ def test_admin(self):
+ self.phantom_js("/", "openerp.website.Tour.run_test('question')", "openerp.website.Tour")
+
diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml
new file mode 100644
index 00000000000..f8fdc5e7d06
--- /dev/null
+++ b/addons/website_forum/views/website_forum.xml
@@ -0,0 +1,292 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+<template id="editor_head" inherit_id="website.editor_head" name="Event Editor" groups="event.group_event_manager">
+ <xpath expr="//script[@id='website_tour_js']" position="after">
+ <script type="text/javascript" src="/website_forum/static/src/js/website_forum.editor.js"></script>
+ <script type="text/javascript" src="/website_forum/static/src/js/website.tour.forum.js"></script>
+ </xpath>
+</template>
+
+<!-- Layout add nav and footer -->
+<template id="header_footer_custom" inherit_id="website.layout" name="Footer Questions Link">
+ <xpath expr="//footer//ul[@name='products']" position="inside">
+ <li><a href="/question">Questions</a></li>
+ </xpath>
+</template>
+
+<!-- Page -->
+
+<template id="question_list">
+ <div class="tab-pane active" id="all">
+ <div class="row">
+ <div class="col-xs-12">
+ <div class="row">
+ <div class="col-xs-9">
+ <div class="row">
+ <div class="col-xs-12">
+ <h4><a t-attf-href="/question/#{ slug(question) }"><span> <t t-esc="question.name"/></span></a></h4>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12">
+ <a href="" class="badge">6.1</a>
+ <a href="" class="badge">7.0</a>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12 text-right">
+ <small>
+ <span><t t-esc="question.write_date"/></span>
+ <a href=""><span><t t-esc="question.create_uid.name"/></span></a>
+ <a href=""><span><t t-esc="question.create_uid.id"/></span></a>
+ </small>
+ </div>
+ </div>
+ </div>
+ <div class="col-xs-3">
+ <h5>
+ <span itemprop="Votes" class="label label-success"><t t-esc="len(question.up_votes)"/> Votes</span>
+ </h5>
+ </div>
+ <div class="col-xs-3">
+ <h5>
+ <span itemprop="Votes" class="label label-success"><t t-esc="len(question.up_votes)"/> Answers</span>
+ </h5>
+ </div>
+ <div class="col-xs-3">
+ <h5>
+ <span itemprop="Votes" class="label label-success"><t t-esc="question.views"/> Views</span>
+ </h5>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<template id="question_search">
+ <form class="navbar-form " role="search">
+ <div class="form-group search-navbar">
+ <input type="text" class="form-control" placeholder="Search Or Ask your Question"/>
+ </div>
+ <button type="submit" class="btn btn-default AskButton">Ask Question</button>
+ </form>
+</template>
+
+
+<template id="index" name="Question">
+ <t t-call="website.layout">
+ <div id="wrap">
+ <t t-call="website_forum.question_search"/>
+ <div class="row">
+ <div class="col-xs-3">
+ <span itemprop="name" class="badge"><t t-esc="len(question_ids)"/> Question</span>
+ </div>
+ <div class="col-xs-3">
+ <h5>
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Short by <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="#">By Date</a></li>
+ <li><a href="#">By Activity</a></li>
+ <li><a href="#">By Answer</a></li>
+ <li><a href="#">By Votes</a></li>
+ </ul>
+ </h5>
+ </div>
+ </div>
+ <ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
+ <li class="active"><a href="#all" data-toggle="tab">ALL</a></li>
+ <li><a href="#unanswerd" data-toggle="tab">Unanswerd</a></li>
+ </ul>
+
+ <ul class="media-list">
+ <li t-foreach="question_ids" t-as="question" class="media">
+ <t t-call="website_forum.question_list"/>
+ </li>
+ </ul>
+ </div>
+ </t>
+</template>
+
+
+<template id="404">
+ <t t-call="website.layout">
+ <div id="wrap">
+ <div class="oe_structure oe_empty">
+ <div class="container">
+ <h1 class="mt32">Question not found!</h1>
+ <p>Sorry, the requested question is not available anymore.</p>
+ <p><a t-attf-href="/question/">Return to the question list.</a></p>
+ </div>
+ </div>
+ </div>
+ </t>
+</template>
+
+<template id="user_detail">
+ <div class="col-xs-7 col-xs-offset-5 col-sm-3 col-sm-offset-9 col-md-4 col-md-offset-8 col-lg-4 col-lg-offset-8 text-right">
+ <div class="panel panel-primary ">
+ <p class="text-center -heading">
+ <small>asked Sep 12'13</small>
+ </p>
+ <div class="row">
+ <div class="col-xs-3">
+ <div class="row">
+ <div class="col-xs-12">
+ <img src="images/profile_picture/png/user_1.png" class="user-profile-image" alt="" />
+ </div>
+ </div>
+ </div>
+ <div class="col-xs-9">
+ <div class="row">
+ <div class="col-xs-12">
+ <div class="text-left">
+ <a href="">Than N.</a>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12">
+ <div style="font-size:10px" class="text-left">
+ <b style="color : green">11</b>
+ <span class="glyphicon glyphicon-certificate badge-gold"></span>1
+ <span class="glyphicon glyphicon-certificate badge-silver"></span>10
+ <span class="glyphicon glyphicon-certificate badge-bronze"></span>5
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<template id="question_vote">
+ <div class="col-md-1 col-xs-1">
+ <div class="row">
+ <div class="col-xs-12 custom-arrow-height">
+ <span class="glyphicon glyphicon-chevron-up"/>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12 custom-vote-height">
+ <h4><span>0</span></h4>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12 custom-arrow-height">
+ <span class="glyphicon glyphicon-chevron-down"/>
+ </div>
+ </div>
+ </div>
+</template>
+
+<template id="question_links">
+ <div class="row">
+ <div class="col-xs-12 text-right">
+ <a class="action-links" href="" ><span class="glyphicon glyphicon-pencil"></span></a>
+ <a class="action-links" href=""><span class="glyphicon glyphicon-flag"></span></a>
+ <a class="action-links" href=""><span class="glyphicon glyphicon-trash"></span></a>
+ <a class="action-links" href="" ><span class="glyphicon glyphicon-link"></span></a>
+ </div>
+ </div>
+</template>
+
+
+<template id="question_description_full">
+ <t t-call="website.layout">
+ <t t-call="website_forum.question_search"/>
+ <div class="container MainBody">
+ <div class="row">
+ <t t-call="website_forum.question_vote"/>
+
+ <div class="col-md-9 col-xs-11">
+ <div class="row">
+ <div class="col-xs-12">
+ <h4><div itemprop="name" t-field="question.name"></div></h4>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12">
+ <span class="badge">openerp-7</span>
+ <span class="badge">pos</span>
+ <span class="badge">receipt</span>
+ <span class="badge">cash</span>
+ </div>
+ </div>
+
+ <hr/>
+ <div class="row">
+ <div class="col-xs-12">
+ <span>
+ <h6>
+ How to send some signal to cash drawer to open it after click print receipt or something similar? I don't know whether this depends on cash drawer's driver or not ?
+ </h6>
+ </span>
+ </div>
+ </div>
+ <div class="row">
+ <t t-call="website_forum.user_detail"/>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12 page-header">
+ <span class="badge">2 Answers</span>
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Short by <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="#">Oldest</a></li>
+ <li><a href="#">Newest</a></li>
+ <li><a href="#">Most Viewd</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="row">
+ <t t-call="website_forum.question_vote"/>
+ <div class="col-md-9 col-xs-10">
+ <div class="row">
+ <div class="col-xs-12">
+ <span>
+ <h6>
+ There should be a call to the cash drawers API. Read the technical manual of the hardware you are using. Thanks.
+ </h6>
+ </span>
+ </div>
+ </div>
+ <div class="row">
+ <t t-call="website_forum.user_detail"/>
+ </div>
+ <t t-call="website_forum.question_links"/>
+ </div>
+ </div>
+ <hr/>
+
+ <div class="row">
+ <t t-call="website_forum.question_vote"/>
+ </div>
+
+ <div class="col-md-9 col-xs-10">
+ <div class="row">
+ <div class="col-xs-12">
+ <span>
+ <h6>
+ Usually the cash drawer behaves like a printer in the sense that it has a RS232 or USB port. However the cash drawer is dummy and only uses the port to receive a signal (positive voltage) which causes it to open.
+ So you only need send any signal to the RS232 or USB port (like for insance print the ascii character "a" to the rs232 port) and it will open!. I the old days you could test it from hyperterminal, I guess nowadays you will have to make a javascript app that sends a character to the rs232 port.
+ </h6>
+ </span>
+ </div>
+ </div>
+ <div class="row">
+ <t t-call="website_forum.user_detail"/>
+ </div>
+ <t t-call="website_forum.question_links"/>
+ </div>
+ </div>
+ </t>
+</template>
+
+</data>
+</openerp>