[REF] document_page: refactored the module, towards using it in website_blog Main modifications: - document.page is now blog.post - category is now a blog.category object, instead of a document.page with type='category' - added blog.tag model, to be able to tag posts, and a m2m relationship between blog.post and blog.tag - cleaned document.page, removing type and unnecessary features - added chatter on blog.post, blog.category - added subtypes to enable direct follow of posts when following a category - updated document.page.history (now blog.post.history) - commented menu creation, because this does not seem to be necessary anymore considering the new website - updated wizard.document.page.history.show_diff, now blog.post.history.show_diff - updated all views accordingly, as well as demo data - removed the use of document_user group, simplified rules on blog.post - misc cleaning [REF] website_mail refactoring; document_page, website_blog: merge of the two modules. document_page is now contained inside website_blog, last part of the refactoring before cleaning and improving the blog feature. Usefull files have been transfered. Translations have been discarded, they will have to be re-translated again. Document_page module is now dead. Long live website_blog! The module is now called website_blog, and not based on mail.group anymore. It uses document_page module, previously renamed blog.post (see previous commits). Refactored controllers and views to work with the new model. [ADD] Added website_mail module, that holds mail-related stuff necessary for the website. This is an auto-install module. Also added templates, js and css to have a generic follow button. Based on the same principle as publish, there is now a generic button to follow or unfollow objects in openerp. This should replace all custom instance of subscription in other addons. [FIX] website: - [FIX] call write with a list of ids because I can't be arsed to handle the other case - [FIX] turns out a new mandatory positional argument blows things up a bit bzr revid: tde@openerp.com-20130923155917-ak0gwah9bh3em6ab
44 lines
1.9 KiB
Python
44 lines
1.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
##############################################################################
|
|
#
|
|
# OpenERP, Open Source Management Solution
|
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
|
#
|
|
# 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
|
|
|
|
|
|
class mail_message(osv.osv):
|
|
_inherit = "mail.message"
|
|
_columns = {
|
|
'website_published': fields.boolean('Publish', help="Publish on the website as a blog"),
|
|
}
|
|
|
|
|
|
class mail_group(osv.Model):
|
|
_inherit = 'mail.group'
|
|
|
|
def get_domain_public_blog(self, cr, uid, context=None):
|
|
mail_group_ids = self.search(cr, uid, [('public', '=', 'public')], context=context)
|
|
return [ ("type", "in", ['comment']),
|
|
("parent_id", "=", False),
|
|
("model", "=", 'mail.group'), ("res_id", "in", mail_group_ids)]
|
|
|
|
def get_public_message_ids(self, cr, uid, domain=None, order="create_date desc", limit=None, offset=0, context=None):
|
|
domain += self.get_domain_public_blog(cr, uid, context=context)
|
|
return self.pool.get('mail.message').search(cr, uid, domain, order=order, limit=limit, offset=offset, context=context)
|