diff options
| author | Srushti Patel <shp@odoo.com> | 2015-09-09 17:38:50 +0530 |
|---|---|---|
| committer | David Monjoie <dmo@odoo.com> | 2016-04-08 13:54:07 +0200 |
| commit | 1e9b6b4cb4914159d9b18ec00a861da3542bd3e5 (patch) | |
| tree | 9c480f530174efd2db090ca40123cf4659a11ac1 /addons/website_forum_doc/models/forum_post.py | |
| parent | b88060e5bae0d239a2b7879b9661d015ec9df3b9 (diff) | |
[MIG] website_forum_doc: migrated to new api
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, |
