Commit Graph
330 Commits
Author SHA1 Message Date
Dhwani Patelandjpr-odoo d69c49349b [IMP] website_forum: improve the flagging question UX
Now, once the question is flagged, we show two options for it: 'Validate' and
'Mark as Offensive'.
So, one can directly validate (or not) directly from the question page.

task-2167561

Part-of: odoo/odoo#45352
Co-authored-by: jpr-odoo <jpr@openerp.com>
2021-10-14 12:26:09 +00:00
Benoit Socias 7559626c54 [IMP] website, *: make a generic search bar snippet available
(*: website_blog, website_event, website_forum, website_sale,
website_slides)

Before this commit the search bar was specific to products.

After this commit a generic search bar is available as a general feature
of website which can be configured to inspect specific models.
The snippet is used to replace the old search bar in blog, courses,
event, forum, page and shop.
The search results of these pages and the autocomplete of the search bar
run through the same search mechanism.
A new hybrid results page has also been created as a target of a search
on "Everything".

In each involved module, `website._search_get_details()` is implemented
to return search metadata for every model related to the `search_type`
parameter.
Search metadata for a single model is returned by `_search_get_detail()`
on that specific model.

The autocomplete runs through the additional
`website._search_render_results()` pre-rendering step that prepares the
data to fit in the autocomplete template.

task-2379555
https://github.com/odoo/odoo/pull/65871

Part-of: odoo/odoo#65871
2021-09-03 06:59:33 +00:00
Martin Trigaux 15692f3948 [IMP] *: merge ir.model.data helpers
remove _get_id and _get_object_reference that were one liner to
_xmlid_lookup
2021-08-10 13:49:05 +02:00
Martin Trigaux c7bac3dee0 [IMP] *: make ir.model.data helper private
No reason to interfact with them directly in RPC
2021-08-10 13:49:04 +02:00
Jeremy Kersten 478068c829 [IMP] *: always use Odoo Response
This branch adds request.redirect on all requests.
In case of a front end request, we do an url_for to the location.

We removed redirect_with_hash that was only for retro compatibility

local_redirect has been renamed to redirect_query, and param keep_hash has been
removed and moved.

Default code for redirect is 303 now instead of 302.

Now redirect and redirect_query make local redirect by default, you need to
pass local=False to make external redirect.

All werkeug.utils.redirect has been replaced by request.redirect.

Http.redirect now use an http.Response type, and it become easy to add an
override like 'set_cookies' e.g.

Dispatch of a website.page return an http.response too, so we first need to
check if it is a cached version before to check if it is an Odoo Response.

Migrate your code:

http.redirect -> request.redirect(location, code, local)
http.local_redirect -> request.redirect_query(location, query, code, local)
http.redirect_with_hash -> request.redirect

Courtesy of odony for help and review ;)

closes odoo/odoo#72599

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-08 07:00:06 +00:00
Romain Derie f2583f3de4 [IMP] website(_*): prevent wrong multi website access during dispatch
Before this commit, routes were prevented to be accessed if the route model was
not accessible from the current website, eg you couldn't access blog1 which is
set to website2 from website 1.
That would raise a 404 even from admin/editor.

This commit introduce that behavior at a lowel level in a generic way, instead
of having to write it on every route.

Note that routes without a model converter won't benefit from this.

Closes #63499

closes odoo/odoo#64313

Related: odoo/enterprise#15688
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-01-25 11:01:13 +00:00
Simran Gajsinghani 6f9a2ca2fb [IMP] website: show searched pages count on website pages
in this commit, when activated 'Show # found' option in Customize menu,
the count of searched records for the manage your pages, event, and form page
displayed on the search button(#found).

task-2115526

closes odoo/odoo#40121

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-12-17 10:25:28 +00:00
Benjamin Vray 641e967652 [FIX] website_forum: preserve user filters in URL
Before this commit, the parameter for user filters was not kept in the
url when navigating with the pager.

Closes https://github.com/odoo/odoo/issues/56248

closes odoo/odoo#61093

X-original-commit: c6a8be30c2b43d6462e365da6f3ec5aad32d1c08
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-10-30 18:24:07 +00:00
Jeremy Kersten 6538e20bb6 [FIX] tools.sql, website_*: increment counter with skip lock
*blog, forum, slides

Based on https://github.com/odoo/odoo/pull/48552#discussion_r440061218 suggestion

Add a new method 'increment_skip_lock' in tools.sql to allow to easily
increment a specific field of 1 if the record is not locked.

The method return boolean if at least 1 record has been incremented.

closes odoo/odoo#58765

X-original-commit: d92e61e89f468c2db2fbd68b2f0d6b36c77f1065
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-09-29 08:48:59 +00:00
Jeremy Kersten 41bac94162 [FIX] website_[blog, forum]: fix loop in retro compatible routes
Purpose of the retro-compatibility route was to redirect the old to the new.
And not redirect to themself and create a loop

closes odoo/odoo#58672

X-original-commit: b5e1bafeb42e94b587c245e9e7aa844770a129c6
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-09-28 12:20:39 +00:00
Jeremy Kersten 9577dcbc3a [IMP] website_[blog/shop/forum]: rename routes to remove 'useless' part
Retro-compatibility routes
2020-07-22 06:53:37 +00:00
Jeremy Kersten 01c17707bd [IMP] website_[blog/shop/forum]: rename routes to remove 'useless' part
Url for a product become:
/shop/productname-id instead of /shop/product/productname-id

Url for a blog post become:
/blog/blogname-1/blogpost-1 instead of /blog/blogname-1/post/blogpost-1

Url for a question on forum become:
/forum/forumname-1/title-1 instead of /forum/forumname-1/question/title-1

task-2295016
2020-07-22 06:53:37 +00:00
Jeremy Kersten 52a0406a2c [IMP] website_forum: delay the set_viewed
Try to make the update the latest possible, to minimize risk of concurrent
update.

Since it is not critical to loose a view, add the old value in where clause, to
try to decrease the risk to alter at the same time a same row.
2020-06-08 07:43:06 +00:00
Jeremy Kersten 84ff744eb0 [IMP] website_forum: perf - use the stored field instead to recompute it 2020-06-08 07:43:06 +00:00
Okan SUMER (osu) 645056554e [IMP] website_forum: frontend improvements and corrections
This commit adds new features and corrects some others in the frontend
of website_forum app.
- In the "about" section of a forum, use the s_accordion instead
  of a custom one for the first 3 elements, the last one is on a
  new page accessible from a link below the accordion
- Cut the description after a specific amount of characters in the
  page where all forum are listed
- In that same view, create options that show the number of post
  and the last post a forum has. Create an option to render forums
  in list view
- Allow the user to cancel his vote (down or up)
- Hide the answer box in the post view. Make it appear when the user
  click on the "answer" button
- Use a JS public widget to validate a Post form (new, save, comment)
- Enable the modification of a forum's image from the frontend
- Hide Solved/Unsolved categories in "Discussion" forums
- Disable the possibility to add snippets to an answer
- Corrections of tours that broke after these modifications

Part of https://github.com/odoo/odoo/pull/46634

task-2201708
2020-05-14 18:27:00 +00:00
fja-odoo c54824dfee [IMP] website_forum: hide negative karma posts
Currently posts are hidden at the post level only (by giving a 404).
The posts are still visible in the list of posts on the main forum page.

Now we hide the posts of users with negative amount of karma.

task-2093636

closes odoo/odoo#46194

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-02-25 09:05:02 +00:00
Sébastien Mottet (oms) e3b5b20b39 [IMP] website_[profile|forum]: show filtering forum on user profile page
- A tag has been added next to the title of each tab in the profile when the user come from a specific forum. The goal is to indicate to the user that the displayed content is specific to a given forum. The tag can be clicked by the user to remove the applied filter.
- Change label in edit profile page from "real name" to "name"
Task Id: 2214425

closes odoo/odoo#48665

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-08 07:21:48 +00:00
jvm-odoo 15227170cb [FIX] website_forum: fix answer name disappear after edit
Issue

	- Install Forums
	- Create a post (name = test)
	- Add an answer
	- Check your profile > answers

	You have an answer named "Re: test"

	- Edit the answer
	- Check again

	"Re: test" disappeared, it's a blank line now

Cause

	When editing the answer, we do not pass a name
	So if we do name = kwargs.get('name') => None

Solution

	Pass the name to the vals if it exists

OPW-2227418

closes odoo/odoo#48970

X-original-commit: c53f1c6a58b4c8c9e9b3c87f27281c9bfd65a0e1
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-04-03 11:58:56 +00:00
jbm-odoo 49d64a8fb1 [IMP] website_forum: Add privacy
Add privacy on forum: public or private. If private, we must select
one group that has access.

For forum linked to eLearning course: the privacy of forum is the same
as the course. If the course is not yet published, the forum will be
invisible (unless we have the group group_website_slides_officer).

If a forum linked to a course is unlinked or removed, the forum will
become private and his group will be set to group_website_slides_officer.

All posts and tags have the same access rules as their linked forum.

closes odoo/odoo#43486

Taskid: 2169965
Related: odoo/upgrade#758
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-28 08:58:43 +00:00
jvm-odoo 12fa83bb44 [IMP] website_forum: improving forum header UX
Issue

	- Install Forums
	- Have at least 2 forums
	- Go in one of them
	- Go in a topic
	- Click the button "All Forums" to go back
	- You go back to the forum's app homepage

	This is bad for UX, I should have been redirected
	to the forum's topic list.

Cause

	This behavior is not handled by Odoo.

Solution

	Move All Forums in the navbar
	Creating a smart "back" button based on browser history.

OPW-2198011

closes odoo/odoo#46454

X-original-commit: 307e6cd5b44b8f619a35056557f72aae241943b3
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-02-27 13:51:53 +00:00
Romain Derie 6898fec5a6 [FIX] website_forum: set website_id when created from frontend
Every records created from frontend should have the website_id set to the
current website.
Most was done with 066cfc9598, but forum was missing it.

Fixes #45749

closes odoo/odoo#46126

X-original-commit: 08540d7853d497e326182e822b359cd6fcb05d59
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-02-24 14:44:58 +00:00
Romain Derie b997684b06 [IMP] website, website_*: improvement of 7dd70438e1
* website_blog, website_event_track, website_forum, website_mail_channel

7dd70438e1 was introduced in stable as a fix, which obviously had some stable
policy preventing some changes.
This commit improves that commit in master.

task-2119086

closes odoo/odoo#45622

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-02-18 16:04:11 +00:00
Thibault Delavallée e2b33f460d [REF] mail, various: rename subtype parameter of message_post to subtype_xmlid
PURPOSE

Clean posting process and improve mail.message definition and comprehension.

SPECIFICATIONS

In order to be more explicit subtype parameter is renamed to subtype_xmlid.
It therefore clearly indicates it should be a valid subtype Xml ID. Support
of ill formatted Xml IDs is removed because there is no reason to try to
add some random prefix. Give something that exists or go to hell, punk !

LINKS

Task ID 2071556
PR #38692
2019-12-02 15:18:44 +00:00
Goffin Simon 8588649c12 [FIX] website_forum: Empty question error
Steps to reproduce the bug:

- Ask a question in the forum with a title but with no content

Bug:

A traceback was raised.

opw:2093665

closes odoo/odoo#39675

X-original-commit: 51f660c9a66f2e6aecb51e476d815b2f083f843d
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-10-31 16:38:08 +00:00
Jeremy Kersten e19227d3ba [IMP] website*: clean sitemap
From now, you need to explicitely add sitemap=True if you want your controller
into the sitemap.

It's the default value, but if you forgot it, it will raise a Warning on runbot.
It will avoid wrong controller in sitemap and duplicate (empty) content.

From now, if your model contains a field website_id, the modelConverter for
sitemap will automatically add the domain:
   "[('website_id', 'in', (False, current_website_id))]"

It avoid redundant declaration and ugly url in redirect/rewrite view.

Migration: need to remove it from url_from in website.rewrite

task-2065018

closes odoo/odoo#39427

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-10-28 10:36:56 +00:00
Romain Derie 9b38bcec12 [IMP] website, website_*: improve edit in backend feature
*base, website_blog, website_event, website_forum, website_slides

With this commit:
1. It is now possible to add the 'Edit in backend' entry in the frontend navbar
   for any desired model, not only the ones which have the published mixin.
   It will simply redirect to the main_object form view.
   This commit add it to Forum and Blog.
2. When clicking on 'Edit in backend', it is now possible to land on another
   module than Website.
   That's especially useful for events and slides which are not directly
   related to the website module as they have their own module.
3. Remove the custom Edit in backend from the forum homepage (fa-cog).
   Opportunity was also taken to remove the 'edit welcome message'.
   It will now be editable through the editor (welcome message will appear in
   edit mode). Thus we got rid of the custom edit welcome message controller
   and views.

Closes #36325
2019-10-02 07:13:26 +00:00
c8c8eb3d56 [IMP] website_forum, *: revamp design
* web_editor, website_profile

Part of https://github.com/odoo/odoo/pull/35749
task-2024197

Co-authored-by: Jérémy Kersten <jke@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
Co-authored-by: fja-odoo <fja@odoo.com>
2019-10-01 16:52:20 +00:00
fja-odooandqsm-odoo 83284a962c [IMP] website_forum: make the user auto-follow the posts he favorites
Part of https://github.com/odoo/odoo/pull/35749
task-2024197

Co-authored-by: qsm-odoo <qsm@odoo.com>
2019-10-01 16:52:20 +00:00
Andrea Ulliana f9c2716b3e [IMP] website_forum: bring forum modes
It is now possible to specify the forum mode : Questions and Answers or
Discussions. In Q&A mode, a user can only reply once while there is no
limit in Discussions mode.

task-2008910

closes odoo/odoo#34097

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-02 16:32:29 +00:00
fja-odoo e26d23cb97 [FIX] website_forum: remove unused close notif event
This code was not used properly and was triggering useless rpc.
This code was used in the deprecated badge system and we forgot to
remove it.

Commit where the code should have been removed:
ec212de5c7

Commit where a quick fix was made:
1e1ea00e66
2019-06-28 08:53:53 +00:00
Sébastien Theys 9bdecc7b61 [IMP] product, *: remove deprecated fields and methods
* = mrp, sale, website_forum, website_sale, website_sale_comparison

closes odoo/odoo#34121

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-14 12:17:35 +00:00
Toufik Ben Jaa ea92ce6018 [FIX] website_forum: access right issue on validation queue
- If you are a portal user when trying to access the validation queue
an access right error can be triggered when trying to read the post's
user name if the record rules don't let you read on this specific
user.

closes odoo/odoo#33626

Signed-off-by: Nicolas Seinlet (nse) <nse@odoo.com>
2019-05-23 15:03:17 +00:00
David Beguin fb40c6bf60 [IMP] website(_profile,_forum,_slides): move validation email to profile and use in forum and elearning
Email validation was necessary on the forum to be able to begin to use the forum
(ask or answer questions, vote, etc..)

As the new elearning also uses karma since 705376a982,
the email validation is now also necessary in the eLearning platform.

This is why this commit is moving the email validation process to website_profile
and extend website_slides (eLearning) and website_forum to use this feature.

In function of where the user asked to send him the validation email,
the user is redirected on the forum or on the elearning when he clicks on
'Validate my account' in the received 'email validation' email.

Task ID : 1943788
PR #31321
2019-03-15 14:58:28 +00:00
David Beguin 2c01452d4b [IMP] website(_profile,_forum,_survey) : redesign website all_users page
As the eLearning (website_slides) is also using website_profile users,
the All Users page is moved from website_forum to website_profile, to be
useable in both forum and eLearning.

This page displays also the number of karma point, badges and certificates
of each user.

The users are sorted by their karma points and the first 3 users are
promoted on a podium.

Use span instead of b tag in profile page

Task ID : 1922159
PR #31109
2019-02-18 15:15:06 +00:00
jem-odoo ec212de5c7 [IMP] gamification,forum: remove deprecated alert when sending badge
Since 56645335b7, when a user get a badge,
an email is sent. The subtype is not used anymore, so the alert
mecanism in forum to display a message to the user to show him
his new badges can not work.
This commit removes this dead code.
Task-1922159
2019-02-14 09:24:10 +00:00
David Beguin 336a90e530 [REF] website_forum : use website_profile templates and adds forum specific information
Adds forum specific information into the website_profile template page.
Removes everything linked to profile that is already in website_profile module to avoid duplicates.

As there can be more than one forum, the profile page shows everything linked to every forum,
except if the forum id is given in url arguments.
The old route (forum/forum-1/user/user_id) have been kept for backward compatibility reasons.

Adds the 'Go to forum' button in the 'new rank reached' mail to encourage the users to continue
to be active on the forum as well, to gain more karma point and improve there rank.

Image rpc calls have been reviewed for profile page part to use only the standard way to get image
-> web/image/model_name/id/image_size

Task ID : 1922159
PR #30988
2019-02-14 08:30:29 +00:00
Swapnesh Shah 1971557fdd [IMP] website_forum: make method private
Model methods should be private by default unless they need to be
exposed via RPC on purpose (e.g. for the web client).

The `send_forum_validation_email()` method is only called by a
controller and has no reason to be exposed via RPC, hence the conversion
to private.

Closes #30669
2019-01-30 22:59:08 +01:00
Jeremy Kersten 1e1ea00e66 [FIX] website_forum: avoid traceback on ack notif
Before this commit, notification_read raise a traceback on some button click.
Eg: Flag/unglaG

It was hidden in the console, but we can just avoid it too

closes odoo/odoo#30524
2019-01-23 17:03:04 +00:00
Jeremy Kersten 7805c55b0c [FIX] website_forum: small ui fix
Force image to stay in their container (img_fluid could be removed by end user)
Stop to use row_users
    now that we use bs4,
    allow to be more responsive,
    force height to be the same for each card.
Small imp replacing multiple if by elif
Decrease big margin between questions
Place tag on the top (if you have many tag, or very long, the ui is broken)
2019-01-23 17:03:04 +00:00
7d85ab1eac [REF] base, *: refactor binary_content
*: tools, web, website, website_forum, mail, im_livechat

This commit refactors ir_http to make it more readable
and flexible.

Move the resize function of web/image to odoo.tools

Co-authored-by: XavierDo <xdo@odoo.com>
Co-authored-by: Antony Lesuisse <al@openerp.com>

closes: #28563
task: #1908896
2018-12-06 19:09:33 +00:00
Jeremy Kersten 1c5ffe1737 [REF] website_forum: mass moderation, modern UI bs4 and clean type
Now forum only allow to post message of type 'question'.
New 'modern' UI with Bootstrap 4
New moderation modal for bulk spam

Co-authored-by: qha <qha@odoo.com>
Co-authored-by: qsm <qsm@odoo.com>
Co-authored-by: jke <jke@odoo.com>

Thanks to @qha-odoo for UI
Thanks to @qsm-odoo for reviewSsss

closes odoo/odoo#29235
2018-12-06 20:49:42 +00:00
Romain Derie 47406d6e5d [FIX] website_hr(_recruitment): make website specific
As commit 066cfc9598 did for other website_module, this commit make theses
2 modules multi-website compatible.

Mostly by:
  - Adding website_id in form/list views
  - Preventing routes from being accessed by wrong website (only needed for
    admin as portal users will get a 403)
  - Adapt search([]) with multi website domain
  - Add domain in model converter in routes for URL autocomplete (eg menu URL)
    Note that it is not needed for sitemap.xml

closes odoo/odoo#27528
2018-10-11 17:08:20 +00:00
Romain Derie 4daceeddb2 [IMP] website(_*): add kwargs in routes where necessary
task-32836
2018-09-25 19:16:10 +02:00
Romain Derie 17573f4094 [FIX] website_blog, website_forum: missing template name
This commit adds various fixes to blog and forum:
  - Some templates were mising a name, resulting in ugly page title
    (eg: forum_all)
  - Latest Blogs page was checking seo keywords to display tags, maybe it was
    coming from an old tag implementation that used seo keywords?
  - If only one forum, land on it directly when accessing /forum, like blog
    does
  - ..
2018-09-25 16:51:31 +02:00
Jeremy KerstenandDerie Romain 066cfc9598 [IMP] website_[blog|event|forum|sale|slide]: make website specific
Set up env & tools for module website multiwebsite (blog, event, sale..)
website_id in modelConverter and ir_rule

add _compute_domain_keys to have a different cache per website
  or rules would not be correctly website_dependant
  eg: blog 1 on website 1, blog 2 on website 2
      access blog 1 from website 1 => can access -> normal
      access blog 1 from website 2 => can access -> should crash because (ir rule)

split mixing website.published.mixin and website.published.multi.mixin to have
website_id only on last one.
 multi mixing will:
     - override website_published compute to take current_website into account (not in backend)
     - force website when clicking on published in backend

- website blog, website_sale, website_event, website_forum, website_slides are now multi website

Co-authored-by: Derie Romain <rde@odoo.com>
Co-authored-by: Kersten Jérémy <jke@odoo.com>
2018-08-13 20:16:34 +02:00
Raphael Collet 960360afe4 [REF] *: use native date/datetime for Date/Datetime fields
From this commit onwards, Date fields will return datetime.date objects and Datetime fields will return datetime.datetime objects, this implies a number of things that are clearly explained both in the ORM API for master.

This commit also introduces a number of helper functions for dates and datetimes that are exposed in tools.date_utils and fields.Date[time], explained in the documentation as well.

Task-ID: 47189
2018-08-06 14:37:19 +02:00
Hiral Bhavsar 5cafed7fab [IMP] website_forum: better management of archived forum
Before this commit, badge, user,... was available when a forum is archived.

Now we display a msg to explain to the user that the forum has been archived.

Related to task-33955
2018-04-09 21:57:43 +02:00
Jeremy Kersten 665496fc5c [FIX] website_forum: fix 'submit a link' feature
The pooling of the title was wrong since P3 refactoring.
2018-02-15 16:01:45 +01:00
Christophe Simonis 10128fa7e8 [MERGE] forward port branch saas-16 up to dc2a6c6cd2 2017-10-20 19:27:04 +02:00
Christophe Simonis 868e718e09 [MERGE] forward port branch saas-15 up to 8d0942380b 2017-10-17 15:14:47 +02:00