[MOV] website_forum_doc: split Documentation.py file

This commit is contained in:
Srushti Patel
2016-04-08 13:54:06 +02:00
committed by David Monjoie
parent 4083f54600
commit b88060e5ba
4 changed files with 33 additions and 31 deletions
-2
View File
@@ -5,7 +5,6 @@
'name': 'Documentation',
'category': 'Website',
'summary': 'Forum, Documentation',
'version': '1.0',
'description': """
Documentation based on question and pertinent answers of Forum
""",
@@ -21,5 +20,4 @@ Documentation based on question and pertinent answers of Forum
'demo': [
'data/doc_demo.xml',
],
'installable': True,
}
+2 -1
View File
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import documentation
import forum_documentation_toc
import forum_post
@@ -56,31 +56,3 @@ class DocumentationStage(osv.Model):
'sequence': fields.integer('Sequence'),
'name': fields.char('Stage Name', required=True, translate=True),
}
class Post(osv.Model):
_inherit = 'forum.post'
_columns = {
'documentation_toc_id': fields.many2one('forum.documentation.toc', 'Documentation ToC', ondelete='set null'),
'documentation_stage_id': fields.many2one('forum.documentation.stage', 'Documentation Stage'),
'color': fields.integer('Color Index')
}
def _get_default_stage_id(self, cr, uid, context=None):
stage_ids = self.pool["forum.documentation.stage"].search(cr, uid, [], limit=1, context=context)
return stage_ids and stage_ids[0] or False
_defaults = {
'documentation_stage_id': _get_default_stage_id,
}
def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):
stage_obj = self.pool.get('forum.documentation.stage')
stage_ids = stage_obj.search(cr, uid, [], context=context)
result = stage_obj.name_get(cr, uid, stage_ids, context=context)
return result, {}
_group_by_full = {
'documentation_stage_id': _read_group_stage_ids,
}
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from openerp.osv import osv, fields
class Post(osv.Model):
_inherit = 'forum.post'
_columns = {
'documentation_toc_id': fields.many2one('forum.documentation.toc', 'Documentation ToC', ondelete='set null'),
'documentation_stage_id': fields.many2one('forum.documentation.stage', 'Documentation Stage'),
'color': fields.integer('Color Index')
}
def _get_default_stage_id(self, cr, uid, context=None):
stage_ids = self.pool["forum.documentation.stage"].search(cr, uid, [], limit=1, context=context)
return stage_ids and stage_ids[0] or False
_defaults = {
'documentation_stage_id': _get_default_stage_id,
}
def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):
stage_obj = self.pool.get('forum.documentation.stage')
stage_ids = stage_obj.search(cr, uid, [], context=context)
result = stage_obj.name_get(cr, uid, stage_ids, context=context)
return result, {}
_group_by_full = {
'documentation_stage_id': _read_group_stage_ids,
}