Files
app-odoo/app_website_blog_editor/models/blog_blog.py
Ivan Office bac7284354 add editor
2023-09-24 01:21:24 +08:00

33 lines
943 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
from odoo import api, models, fields, _
from odoo.tools.safe_eval import safe_eval
class BlogBlog(models.Model):
_inherit = 'blog.blog'
_order = 'sequence, name'
seo_name = fields.Char(tracking=True)
# 排序
sequence = fields.Integer(string='Sequence', default=20, index=True, help="Determine the display order")
def action_view_blog_post(self):
self.ensure_one()
action = self.env.ref('website_blog.action_blog_post').read()[0]
action['domain'] = [('blog_id', '=', self.id)]
return action
# def unlink(self):
# # active的先不删除设置为 deactive
# to_deactive = self.filtered(lambda r: r.active)
# self = self - to_deactive
# to_deactive.write({
# 'active': False,
# })
# if self:
# return super(BlogBlog, self).unlink()
# else:
# return False