Company-Dependent Fields in Odoo 18

March 25, 2025 by
admin


                                                                                                                 



Company-Dependent Fields in Odoo 18
Introduction
In Odoo, managing data across multiple companies can be challenging, especially when specific fields need to vary between companies. To simplify this, Odoo provides company-dependent fields, allowing certain field values to be tied to a specific company. This blog will guide you through the concepts, examples, and usage of company-dependent fields in Odoo 18.
What Are Company-Dependent Fields?
A company-dependent field ensures that a field’s value is stored uniquely for each company. For example, a product’s sales unit of measure (UoM) or a specific cost can vary between companies.
To define a company-dependent field in Odoo, you use the company_dependent attribute in the field definition. Let’s look at an example.
Defining a Company-Dependent Field

Here’s how you can define a company-dependent field:

         


company_dependent=True: Specifies that the sale_uom_id field will store unique values for each company.
Reading Values from Company-Dependent Fields
When working with company-dependent fields, it’s essential to ensure you’re retrieving the value for the correct company. Odoo provides the with_company method to handle this seamlessly.
Here’s an example of how to fetch a company-dependent field value:

with_company(record.company_id): Ensures the standard_price is fetched for the active company (record.company_id).



When to Use Company-Dependent Fields
  1. Varying Data Between Companies: For fields like pricing, sales UoM, or costs that differ across companies.
  2. Centralized Configuration: To maintain shared records while allowing certain field values to be company-specific.
  3. Simplified Multi-Company Logic: Reduces complexity by leveraging Odoo’s built-in mechanisms for handling company contexts.
Conclusion

Company-dependent fields in Odoo 18 provide a powerful way to handle company-specific data while leveraging Odoo’s multi-company features. By using company_dependent=True and the with_company method, you can manage such fields effectively, ensuring your application maintains both flexibility and accuracy. Whether you’re working with sales UoMs, costs, or other data, this feature simplifies operations across companies while preserving the integrity of your data.

If you are looking for an ERP implementation partner with diverse industry experience feel free to contact us. Zesty Beanz Technologies is headquartered in Trivandrum Kerala,  We have proven track record of successful implementations across the world in various sectors including Odoo for Manufacturing, Odoo for Trading, Odoo for FMCG, Odoo for Oil & Gas, Odoo for Diary, Odoo for Pharma, Odoo for Cosmetic Clinic, Odoo for Contracting Companies, Odoo for HVAC, Odoo for Logistics, Odoo for Automobile, Odoo for Laundry, Odoo for Field Service, Odoo for E-Commerce & many more

ZestyBeanz offers Developer / Consultant outsourcing programs, Chat with us in Whatsapp and Hire Odoo Developers, Mobile Application Developers, Consultants.
#OdooKerala #OdooKochi #OdooTrivandrum #OdooERP #ProjectManagement #OdooVansales #HireOdooDeveloper