diff options
Diffstat (limited to 'addons/website_forum_doc/models/forum_post.py')
| -rw-r--r-- | addons/website_forum_doc/models/forum_post.py | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/addons/website_forum_doc/models/forum_post.py b/addons/website_forum_doc/models/forum_post.py index 6973754a4f6..19eec377f15 100644 --- a/addons/website_forum_doc/models/forum_post.py +++ b/addons/website_forum_doc/models/forum_post.py @@ -1,30 +1,19 @@ # -*- coding: utf-8 -*- -from openerp.osv import osv, fields +from odoo import api, fields, models -class Post(osv.Model): +class Post(models.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, - } + documentation_toc_id = fields.Many2one('forum.documentation.toc', string='Documentation ToC', ondelete='set null') + documentation_stage_id = fields.Many2one('forum.documentation.stage', string='Documentation Stage', + default=lambda self: self.env['forum.documentation.stage'].search([], limit=1)) + color = fields.Integer(string='Color Index') - 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, {} + @api.multi + def _read_group_stage_ids(self, domain, read_group_order=None, access_rights_uid=None): + return self.env['forum.documentation.stage'].search([]).name_get(), {} _group_by_full = { 'documentation_stage_id': _read_group_stage_ids, |
