odoo_dev 开发培训作业:图书管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
555B

  1. from odoo import api, fields, models
  2. class BookCategory(models.Model):
  3. _name = 'library.book.category'
  4. _description = 'Book Category'
  5. _parent_store = True
  6. name = fields.Char(translate=True, required=True)
  7. # Hierarchy fields
  8. parent_id = fields.Many2one(
  9. 'library.book.category',
  10. 'Parent Category',
  11. ondelete='restrict')
  12. parent_path = fields.Char(index=True)
  13. # Optional but good to have:
  14. child_ids = fields.One2many(
  15. 'library.book.category',
  16. 'parent_id',
  17. 'Subcategories')
上海开阖软件有限公司 沪ICP备12045867号-1