From 901f57382605ccb3498666d2c2120ef5143f438d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 20 Sep 2013 13:12:21 +0200 Subject: [REF] document_page: refactored the module, towards using it in website_blog Main modifications: - category is now a blog.catory object, instead of a document.page with type='category' - added blog.tag model, to be able to tag posts - cleaned document.page, now blog.post model, 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 (not done for new models) - misc cleaning Next step: merge with website_mail bzr revid: tde@openerp.com-20130920111221-qy3x5eoyih26axn8 --- addons/document_page/wizard/document_page_show_diff.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'addons/document_page/wizard/document_page_show_diff.py') diff --git a/addons/document_page/wizard/document_page_show_diff.py b/addons/document_page/wizard/document_page_show_diff.py index 0c20ee79c74..49056fd826b 100644 --- a/addons/document_page/wizard/document_page_show_diff.py +++ b/addons/document_page/wizard/document_page_show_diff.py @@ -21,17 +21,17 @@ from openerp.osv import fields, osv from openerp.tools.translate import _ -import base64 + class showdiff(osv.osv_memory): """ Disp[ay Difference for History """ - _name = 'wizard.document.page.history.show_diff' + _name = 'blog.post.history.show_diff' def get_diff(self, cr, uid, context=None): if context is None: context = {} - history = self.pool.get('document.page.history') + history = self.pool.get('blog.post.history') ids = context.get('active_ids', []) diff = "" @@ -43,7 +43,7 @@ class showdiff(osv.osv_memory): elif len(ids) == 1: old = history.browse(cr, uid, ids[0]) - nids = history.search(cr, uid, [('page_id', '=', old.page_id.id)]) + nids = history.search(cr, uid, [('post_id', '=', old.post_id.id)]) nids.sort() diff = history.getDiff(cr, uid, ids[0], nids[-1]) else: -- cgit v1.2.3 From 4f1cdefa8ddf4e1a295712e09e562418153f6ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 20 Sep 2013 16:27:01 +0200 Subject: [REF] 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! Misc: - some fixes in website_blog and wizard - commented some sections of yml tests because they should not apply anymore - added empty files for python unit tests in website_blog bzr revid: tde@openerp.com-20130920142701-4lp1my3ajga2puxl --- .../wizard/document_page_show_diff.py | 61 ---------------------- 1 file changed, 61 deletions(-) delete mode 100644 addons/document_page/wizard/document_page_show_diff.py (limited to 'addons/document_page/wizard/document_page_show_diff.py') diff --git a/addons/document_page/wizard/document_page_show_diff.py b/addons/document_page/wizard/document_page_show_diff.py deleted file mode 100644 index 49056fd826b..00000000000 --- a/addons/document_page/wizard/document_page_show_diff.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 . -# -############################################################################## - -from openerp.osv import fields, osv -from openerp.tools.translate import _ - - -class showdiff(osv.osv_memory): - """ Disp[ay Difference for History """ - - _name = 'blog.post.history.show_diff' - - def get_diff(self, cr, uid, context=None): - if context is None: - context = {} - history = self.pool.get('blog.post.history') - ids = context.get('active_ids', []) - - diff = "" - if len(ids) == 2: - if ids[0] > ids[1]: - diff = history.getDiff(cr, uid, ids[1], ids[0]) - else: - diff = history.getDiff(cr, uid, ids[0], ids[1]) - - elif len(ids) == 1: - old = history.browse(cr, uid, ids[0]) - nids = history.search(cr, uid, [('post_id', '=', old.post_id.id)]) - nids.sort() - diff = history.getDiff(cr, uid, ids[0], nids[-1]) - else: - raise osv.except_osv(_('Warning!'), _('You need to select minimum one or maximum two history revisions!')) - return diff - - _columns = { - 'diff': fields.text('Diff', readonly=True), - } - - _defaults = { - 'diff': get_diff - } - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: -- cgit v1.2.3