0% found this document useful (0 votes)
3 views28 pages

Types of Fields:: Chatgpt 4O Mini

The document provides an overview of Odoo models and fields, specifically detailing the 'Product' model which includes fields for product name, price, and stock quantity. It explains various field types such as Char, Integer, Float, Boolean, and relationships between models like Many2one and One2many. This serves as a foundational guide for understanding how to structure data in Odoo applications.

Uploaded by

dmjs2608
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views28 pages

Types of Fields:: Chatgpt 4O Mini

The document provides an overview of Odoo models and fields, specifically detailing the 'Product' model which includes fields for product name, price, and stock quantity. It explains various field types such as Char, Integer, Float, Boolean, and relationships between models like Many2one and One2many. This serves as a foundational guide for understanding how to structure data in Odoo applications.

Uploaded by

dmjs2608
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

28/01/2025, 14:38 Odoo Models and Fields

ChatGPT 4o mini Log in


python
Copy

from odoo import models, fields

class Product(models.Model):
_name = 'product.product' # Model name (table in DB)
_description = 'Product Information'

name = fields.Char('Product Name') # Field for product name


price = fields.Float('Price') # Field for product price
stock = fields.Integer('Stock Quantity') # Field for stock quantity

In this example:

Product is the class representing the product model.

_name = 'product.product' defines the model name.

name , price , and stock are fields that store data related to a product.

Types of Fields:
1. Char: Used for text fields (e.g., name, address).

2. Integer: Used for whole numbers (e.g., quantity).

3. Float: Used for decimal numbers (e.g., price).

4. Boolean: Used for true/false values (e.g., active/inactive).

5. Datetime: Used for date and time fields.

6. Many2one, One2many, Many2many: Relationships between models (similar to


foreign keys in relational databases).

Relationships Between Models:


Many2one: This creates a many-to-one relationship (e.g., many products can
belong to one category).

One2many: This creates a one-to-many relationship (e g one sale order can have
Message ChatGPT

ChatGPT can make mistakes. Check important info. ?

https://chatgpt.com 1/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 2/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 3/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 4/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 5/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 6/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 7/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 8/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 9/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 10/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 11/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 12/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 13/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 14/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 15/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 16/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 17/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 18/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 19/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 20/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 21/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 22/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 23/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 24/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 25/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 26/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 27/28
28/01/2025, 14:38 Odoo Models and Fields

https://chatgpt.com 28/28

You might also like