Hey Cyllo community, how do I create a new model in Cyllo?
Welcome!
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.
This question has been flagged
That's a great question! In Odoo, the standard model type for persistent business objects is 'models.Model'. Here's how you'd define a 'product.category' model:
from odoo import api, fields, models
class ProductCategory(models.Model):
_name = 'product.category'
_description = 'Product Category'
_rec_name = 'name'
name = fields.Char(string='Category Name', required=True)
description = fields.Text(string='Description')
active = fields.Boolean(string='Active', default=True)
parent_id = fields.Many2one('product.category', string='Parent Category')
child_ids = fields.One2many('product.category', 'parent_id', string='Child Categories')