python odoo 电子书设计
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class book(models.Model):
_name = 'myblog.book'
_description = '书名'
name = fields.Char()
book_tags = fields.Integer()
value2 = fields.Float(compute="_value_pc", store=True)
description = fields.Text()
class Book_mulu(models.Model):
_name = 'myblog.book_mulu'
_description = '图书目录'
name = fields.Char('目录名称', default="伤寒论")
parent_id = fields.Many2one(
'myblog.book_mulu',
string='上级分类',
ondelete='restrict',
index=True)
child_ids = fields.One2many(
'myblog.book_mulu', 'parent_id',
string='下级细分类')
fena =