Skip to Content
Menu
This question has been flagged
3 Replies
5375 Views

Hi everyone, I'm implementing Odoo 13 community in my business and I want to make a few changes in the database structure.

I want that the categories of products to have attributes, for example: 

category      attribute 

switch        fiber_ports_quantity

switch        isadministrable

switch        isPOE

So I want to create a table: category_attributes

Finally other table: product_attributes, so I can match all the attributes values to one specific product, for example:

product id    category     attribute                     value

product1       switch          fiber_ports_quantity     '5'
product1       switch          isAdministrable            'true'

product1       switch          isPOE                            'false'

I dont think that I can do this without making any changes in the database, so my question is:

If I make these changes(create some tables and add columns to existing tables), will i be able to update to a newer version without conflicts? 

If yes, should I do this directly from the database or the Odoo API is a better choice?

Thank you!


Avatar
Discard
Best Answer

Hi German:

Yes. If you stick with the naming convention of custom fields starting with a x_ you will be able to update Odoo to newer releases without any issue. Do not make changes directly in the database. You can add new fields to a model through the UI or through Python code and either option is okay. Adding them through the UI is pretty straight forward for simple requirements like the one you have. Odoo will automatically tag them as a "Custom Field" when you make the changes through the UI by going to Settings > Technical > Database Structure > Models after activating developer mode. It also allows you to define new models and the underlying table structures are automatically managed by the ORM used by Odoo.

Avatar
Discard

To add to what Paresh has advised, you could try to do this in Enterprise Edition (trial or demo database) using Odoo Studio. That will show you how Odoo handles this type of customization (new models, fields, views), and you can do it in a similar way.

https://odootricks.tips/about/odoo-studio/

Best Answer

You may also have a look at the following module in Odoo's app store: https://www.odoo.com/apps/modules/13.0/website_product_attribute_category/

Avatar
Discard