Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How to change the contact company_type base field?

Naroči se

Get notified when there's activity on this post

This question has been flagged
fieldsContactsStudio
4 Odgovori
4547 Prikazi
Avatar
Severin Caplazi

I want to add new selection but every time I tried to change this message pop up Properties of base fields cannot be altered in this manner! Please modify them through Python code, preferably through a custom add-on!' unfortunately i have no idea how to use Python.


best regards 


0
Avatar
Opusti
Severin Caplazi
Avtor

Hello Nikhil Nakrani

How do i get acces to the odoo Xml? do i need full admin rights?

Thanks and Best Regards


Globalist Technology

Guys, as Ray Carnes already explained is really not recommended to chage this logic (note: is possible indeed, is just not recommended). 

If you do it you need to think that you may face several issue, not only to implementing it, but also at mantaining cause many other modules rely on this logic.

Personally I don't like the way it has been implemented, as extending this it's usually a common request. But it is what it is...

Avatar
Ray Carnes (ray)
Best Answer

We don't recommend doing this.

1. This cannot be done without modifying the Odoo source code via your own module which inherits and overrides the Odoo module where this is defined. This is only something a developer can do.

2. This is a very fundamental part of Odoo and many other parts of the system rely on only having two options in this field. To implement another option would require a very advanced understanding of how the Odoo framework uses this field and a comprehensive search of the codebase to also modify every other place this field is referenced.

You should find another way to implement what you need - like using your own field or using tags.

1
Avatar
Opusti
Avatar
DM
Best Answer

thanks but

  company_type = fields.Selection(string='Company Type',

         selection=[('person', 'Individual'), ('company', 'Company'),('external', 'Foreign')],

         compute='_compute_company_type', inverse='_write_company_type')

After adding the new value, if I select it it returns me to person

I think it's because of the method

_compute_company_type


Do you know how to prevent that from happening? I'm with odoo15

1
Avatar
Opusti
Avatar
Imad
Best Answer

this is my workaround for this, I added  new a field is_organisme :

    company_type = fields.Selection(string='Company Type',
        selection=[('person', 'Individual'), ('company', 'Company'),('organisme', 'Organisme')],default='company',
        compute='_compute_company_type', inverse='_write_company_type')
    is_organisme = fields.Boolean(string='Organisme', default=False,
        help="Check if the contact is an Organism, otherwise it is a company or a persone")

    @api.depends('is_company')

    def _compute_company_type(self):

        for partner in self:

            if partner.is_organisme and not partner.is_company:

                partner.company_type = 'organisme'

            elif partner.is_company and not partner.is_organisme:

                partner.company_type = 'company'

            else:

                partner.company_type = 'person'

    def _write_company_type(self):

        for partner in self:

            if self.company_type == 'company':

                self.is_company = True

                self.is_organisme = False

            if self.company_type == 'person':

                self.is_company = False

                self.is_organisme = False

            if self.company_type == 'organisme':

                self.is_company = False

                self.is_organisme = True

    @api.onchange('company_type')

    def onchange_company_type(self):

  if self.company_type == 'company':

            self.is_company = True

            self.is_organisme = False

        if self.company_type == 'person':

            self.is_company = False

            self.is_organisme = False

        if self.company_type == 'organisme':

            self.is_company = False

            self.is_organisme = True

      

0
Avatar
Opusti
Avatar
Nikhil Nakrani
Best Answer

Hi Severin Caplazi,

  1. First in your odoo addons find this field.

   2. create your custom_module in odoo and inside model.

   3. inherit res.partner model like this way,

  4. Then add below you modify field like this way.

here i add one (key, value) new as (test, Testing) you can add multiple here.

 5. Add this file in your init.py 

Thanks.

0
Avatar
Opusti
Severin Caplazi
Avtor

Hello Nikhil Nakrani

How do i get acces to the odoo Xml? do i need full admin rights?

Thanks and Best Regards

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Migrating Odoo Studio fields to a custom module Solved
fields Studio
Avatar
Avatar
1
sep. 25
938
Studio: Add related field that does not update after initial record creation Solved
fields Studio
Avatar
Avatar
2
okt. 23
4779
Increasing Field Odoo Studio
fields Studio
Avatar
0
jun. 22
23
Simple Computed Field help Solved
fields compute Studio
Avatar
Avatar
Avatar
3
sep. 24
2070
Change quantity in order lines based on modification another value
fields Studio Automation
Avatar
0
nov. 23
2023
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now