diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index bb63a423..51ccc07a 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -81,7 +81,10 @@ class WebsiteForum(http.Controller): @http.route(['/forum'], type='http', auth="public", website=True) def forum(self, **kwargs): - forums = request.env['forum.forum'].search([]) + domain = [] + if not request.env.user.has_group('website.group_website_designer'): + domain += [('website_ids', '!=', False), ('website_ids', 'in', request.website.id)] + forums = request.env['forum.forum'].search(domain) return request.render("website_forum.forum_all", {'forums': forums}) @http.route('/forum/new', type='json', auth="user", methods=['POST'], website=True) @@ -117,7 +120,7 @@ class WebsiteForum(http.Controller): def questions(self, forum, tag=None, page=1, filters='all', sorting=None, search='', post_type=None, **post): Post = request.env['forum.post'] - domain = [('forum_id', '=', forum.id), ('parent_id', '=', False), ('state', '=', 'active')] + domain = [('forum_id', '=', forum.id), ('parent_id', '=', False), ('state', '=', 'active'), ('website_id', '=', request.website.id)] if search: domain += ['|', ('name', 'ilike', search), ('content', 'ilike', search)] if tag: @@ -408,6 +411,7 @@ class WebsiteForum(http.Controller): 'name': kwargs.get('post_name'), 'content': kwargs.get('content'), 'content_link': kwargs.get('content_link'), + 'website_id': request.website.id, } post.write(vals) question = post.parent_id if post.parent_id else post @@ -551,9 +555,9 @@ class WebsiteForum(http.Controller): def users(self, forum, page=1, **searches): User = request.env['res.users'] step = 30 - tag_count = User.sudo().search_count([('karma', '>', 1), ('website_published', '=', True)]) + tag_count = User.sudo().search_count([('karma', '>', 1), ('website_published', '=', True), (('website_ids', '!=', False), ('website_ids', 'in', request.website.id))]) pager = request.website.pager(url="/forum/%s/users" % slug(forum), total=tag_count, page=page, step=step, scope=30) - user_obj = User.sudo().search([('karma', '>', 1), ('website_published', '=', True)], limit=step, offset=pager['offset'], order='karma DESC') + user_obj = User.sudo().search([('karma', '>', 1), ('website_published', '=', True), (('website_ids', '!=', False), ('website_ids', 'in', request.website.id))], limit=step, offset=pager['offset'], order='karma DESC') # put the users in block of 3 to display them as a table users = [[] for i in range(len(user_obj) // 3 + 1)] for index, user in enumerate(user_obj): @@ -723,7 +727,10 @@ class WebsiteForum(http.Controller): values['image'] = base64.b64encode(image) if request.uid == user.id: # the controller allows to edit only its own privacy settings; use partner management for other cases - values['website_published'] = kwargs.get('website_published') == 'True' + if kwargs.get('website_published') == 'True': + values['website_ids'] = [(4, request.website.id)] + else: + values['website_ids'] = [(3, request.website.id)] user.write(values) return werkzeug.utils.redirect("/forum/%s/user/%d" % (slug(forum), user.id)) diff --git a/addons/website_forum/data/forum_demo.xml b/addons/website_forum/data/forum_demo.xml index 47529bdc..3ed5aba0 100644 --- a/addons/website_forum/data/forum_demo.xml +++ b/addons/website_forum/data/forum_demo.xml @@ -28,6 +28,7 @@ How to configure alerts for employee contract expiration + question 3 @@ -35,6 +36,7 @@ CMS replacement for ERP and eCommerce + 8 I use Wordpress as a CMS and eCommerce platform. The developing in Wordpress is quite easy and solid but it missing ERP feature (there is single plugin to integrate with Frontaccounting) so I wonder: @@ -49,6 +51,7 @@ In simple words does Flectra became CMS+ERP platform?

]]>
+ Just for posterity so other can see. Here are the steps to set automatic alerts on any contract.. i.e. HR Employee, or Fleet for example. I will use fleet as an example.

  • Step 1. As a user who has access rights to Technical Features, go to Settings --> Automated Actions. Create A new Automated Action. For the Related Document Model choose.. Contract information on a vehicle (you can also type in the actual model name.. fleet.vehicle.log.contract ) . Set the trigger date to ... Contract Expiration Date. The Next Field (Delay After Trigger Date) is a bit ridiculous. Who wants to be reminded of a contract expiration AFTER the fact? The field should say Days Before Date to Fire Action and the number should be converted to a negative. IMHO. Any way... to get a workable solution you must enter in the number in the negative. So for instance like me if you want to be warned 35 days BEFORE the expiration... put in Delay After Trigger Date.. the number -35 But the sake of testing, right now just put in -1 for 1 day before. Save the Action. @@ -61,6 +64,7 @@ In simple words does Flectra became CMS+ERP platform?

    ]]> + Flectra v8 (next release) provides a web module and an e-commerce module: www.flectra.com/page/website-builder The CMS editor in Flectra web is nice but I prefer Drupal for customization and there is a Drupal module for Flectra. I think WP is better than Flectra web too. @@ -73,6 +77,7 @@ The CMS editor in Flectra web is nice but I prefer Drupal for customization and https://www.flectra.com Discover Flectra, an open source ERP. + link 6 @@ -82,6 +87,7 @@ The CMS editor in Flectra web is nice but I prefer Drupal for customization and How to setup a regular PostgreSQL database backup + I'm not familiar with PostgreSQL database administration , so I figured I might ask for help from someone more knowledgeable on the subject. What would you recommend in order to setup a regular (daily) OpenERP database backup? @@ -98,6 +104,7 @@ Are there any automation scripts available I might use? + I use the following setup:

    1. Backup-Script
    2. diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index 0a7e8e70..4d885ca5 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -25,7 +25,7 @@ class KarmaError(Forbidden): class Forum(models.Model): _name = 'forum.forum' _description = 'Forum' - _inherit = ['mail.thread', 'website.seo.metadata'] + _inherit = ['mail.thread', 'website.seo.metadata', 'website.published.mixin'] @api.model_cr def init(self): @@ -128,6 +128,11 @@ class Forum(models.Model): karma_user_bio = fields.Integer(string='Display detailed user biography', default=750) karma_post = fields.Integer(string='Ask questions without validation', default=100) karma_moderate = fields.Integer(string='Moderate posts', default=1000) + website_ids = fields.Many2many('website', 'website_forum_pub_rel', + 'website_id', 'forum_id', + string='Websites', copy=False, + help='List of websites in which ' + 'Forum is published.') @api.one @api.constrains('allow_question', 'allow_discussion', 'allow_link', 'default_post_type') @@ -272,6 +277,8 @@ class Post(models.Model): can_flag = fields.Boolean('Can Flag', compute='_get_post_karma_rights') can_moderate = fields.Boolean('Can Moderate', compute='_get_post_karma_rights') + website_id = fields.Many2one('website', string="Website") + def _search_can_view(self, operator, value): if operator not in ('=', '!=', '<>'): raise ValueError('Invalid operator: %s' % (operator,)) diff --git a/addons/website_forum/views/forum.xml b/addons/website_forum/views/forum.xml index 8e3075ce..6bafeee8 100644 --- a/addons/website_forum/views/forum.xml +++ b/addons/website_forum/views/forum.xml @@ -41,6 +41,7 @@ + @@ -162,6 +163,7 @@ +