SlideShare ist ein Scribd-Unternehmen logo
1 von 20
www.cybrosys.com
Many2many fields and Its widgets in Odoo
• Odoo is an open source business software that support wide range of
business domains.
• Many2many widget is a datatype in python that helps to build odoo
• In this presentation we will talk about the widgets that support the
many2many field
• This helps odoo developers to set their preferred view for a
many2many field.
INTRODUCTION
There are some many2many widgets in odoo as follows:
- many2many widget (default)
- many2many_tags widget
- many2many_checkboxes widget
- many2many_kanban widget
- many2many_binary widget
- x2many_counter widget
1. many2many Widget (default)
• This widget is used in default cases
• Many2many widget generates a list view of the related model and the objects in the model
Example Code :
.py - field_name =fields.Many2many('res.partner',string="many2many_default")
.xml - <field name="field_name" />
Here is the view for this :
We can add options like :
.xml - <field name="field_name" options="{'no_create': True}"/>
no_create : This will remove “Create” button . That is to model is we map the
objects from the model but creation of data not possible
2. many2many_tags widget
This widget allows multiple selection of items. This method is implemented in project
module for adding “tags”.
Example Code :
.py - field_name = fields.Many2many('res.partner', string="many2many_tags")
.xml - <field name="field_name" widget="many2many_tags"/>
Here is the view for this :
We can add options like :
.xml - <field name="field_name"
widget="many2many_tags"
options="{'no_create_edit': True}"/>
no_create_edit : Removes the “Create “agro” ” option.
no_quick_create : Removes the “Create and Edit” option.
3. many2many_checkboxes widget
• This type of widget display a list of checkboxes
• Many2many_checkboxes display single checkbox for each record existing in the model
depending on the relation and domain.
• Checked records will be added to the field.
Example Code :
.py - field_name = fields.Many2many('res.partner',
string="many2many_checkboxes")
.xml - <field name="field_name" widget="many2many_checkboxes"/>
Here is the view for this :
4. many2many_kanban widget
• In many2many_kanban widget related objects are viewed in Kanban View
• Depending on the Kanban view defined , look and impact of the widget
changes accordingly
• This is more comfortable because it can vary its look based on customer
requirement by changing Kanban view definition.
Here is the view for this :
5. many2many_binary widget
• Many2many_binary is used for attachment purpose
• Attach a file in email are examples of this
• User can upload as many files and attach this to a model
• This widget works exclusively on many2many fields associated with
the ir.attachment model
Here is the view for this :
6. x2many_counter widge
• A simple, read only widget displaying a link with an information about the number of related
items.
• The link’s target view can be configured with the views option.
• Also useful with one2many fields.
• The views to display in the act window action must be a list of tuple whose first element is
the id of the view to display (or False to take the default one) and the second element is the
type of the view.
• Defaults to [[false, "tree"], [false, "form"]].
Example Code :
.xml - <field name="field_name" widget="x2many_counter">
Thank You !
https://www.cybrosys.com/blog/many2many-fields-and-its-widgets-odoo

Weitere ähnliche Inhalte

Mehr von Celine George

Mehr von Celine George (20)

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales AppHow to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales App
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
How to Manage Engineering to Order in Odoo 17
How to Manage Engineering to Order in Odoo 17How to Manage Engineering to Order in Odoo 17
How to Manage Engineering to Order in Odoo 17
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 

Kürzlich hochgeladen

Challenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
Challenges and Opportunities: A Qualitative Study on Tax Compliance in PakistanChallenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
Challenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
vineshkumarsajnani12
 

Kürzlich hochgeladen (20)

PARK STREET 💋 Call Girl 9827461493 Call Girls in Escort service book now
PARK STREET 💋 Call Girl 9827461493 Call Girls in  Escort service book nowPARK STREET 💋 Call Girl 9827461493 Call Girls in  Escort service book now
PARK STREET 💋 Call Girl 9827461493 Call Girls in Escort service book now
 
Chennai Call Gril 80022//12248 Only For Sex And High Profile Best Gril Sex Av...
Chennai Call Gril 80022//12248 Only For Sex And High Profile Best Gril Sex Av...Chennai Call Gril 80022//12248 Only For Sex And High Profile Best Gril Sex Av...
Chennai Call Gril 80022//12248 Only For Sex And High Profile Best Gril Sex Av...
 
CROSS CULTURAL NEGOTIATION BY PANMISEM NS
CROSS CULTURAL NEGOTIATION BY PANMISEM NSCROSS CULTURAL NEGOTIATION BY PANMISEM NS
CROSS CULTURAL NEGOTIATION BY PANMISEM NS
 
Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024
 
Challenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
Challenges and Opportunities: A Qualitative Study on Tax Compliance in PakistanChallenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
Challenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
 
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGParadip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
 
PHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation FinalPHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation Final
 
Arti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdfArti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdf
 
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
 
Falcon Invoice Discounting: Unlock Your Business Potential
Falcon Invoice Discounting: Unlock Your Business PotentialFalcon Invoice Discounting: Unlock Your Business Potential
Falcon Invoice Discounting: Unlock Your Business Potential
 
QSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptx
QSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptxQSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptx
QSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptx
 
New 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck TemplateNew 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck Template
 
UAE Bur Dubai Call Girls ☏ 0564401582 Call Girl in Bur Dubai
UAE Bur Dubai Call Girls ☏ 0564401582 Call Girl in Bur DubaiUAE Bur Dubai Call Girls ☏ 0564401582 Call Girl in Bur Dubai
UAE Bur Dubai Call Girls ☏ 0564401582 Call Girl in Bur Dubai
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
 
Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...
Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...
Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1
 
Berhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Berhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGBerhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Berhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
 
Falcon Invoice Discounting: The best investment platform in india for investors
Falcon Invoice Discounting: The best investment platform in india for investorsFalcon Invoice Discounting: The best investment platform in india for investors
Falcon Invoice Discounting: The best investment platform in india for investors
 
Berhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Berhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGBerhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Berhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
 
WheelTug Short Pitch Deck 2024 | Byond Insights
WheelTug Short Pitch Deck 2024 | Byond InsightsWheelTug Short Pitch Deck 2024 | Byond Insights
WheelTug Short Pitch Deck 2024 | Byond Insights
 

Many2many fields and Its widgets in Odoo

  • 2. • Odoo is an open source business software that support wide range of business domains. • Many2many widget is a datatype in python that helps to build odoo • In this presentation we will talk about the widgets that support the many2many field • This helps odoo developers to set their preferred view for a many2many field. INTRODUCTION
  • 3. There are some many2many widgets in odoo as follows: - many2many widget (default) - many2many_tags widget - many2many_checkboxes widget - many2many_kanban widget - many2many_binary widget - x2many_counter widget
  • 4. 1. many2many Widget (default) • This widget is used in default cases • Many2many widget generates a list view of the related model and the objects in the model Example Code : .py - field_name =fields.Many2many('res.partner',string="many2many_default") .xml - <field name="field_name" />
  • 5. Here is the view for this :
  • 6. We can add options like : .xml - <field name="field_name" options="{'no_create': True}"/> no_create : This will remove “Create” button . That is to model is we map the objects from the model but creation of data not possible
  • 7. 2. many2many_tags widget This widget allows multiple selection of items. This method is implemented in project module for adding “tags”. Example Code : .py - field_name = fields.Many2many('res.partner', string="many2many_tags") .xml - <field name="field_name" widget="many2many_tags"/>
  • 8. Here is the view for this :
  • 9. We can add options like : .xml - <field name="field_name" widget="many2many_tags" options="{'no_create_edit': True}"/> no_create_edit : Removes the “Create “agro” ” option. no_quick_create : Removes the “Create and Edit” option.
  • 10. 3. many2many_checkboxes widget • This type of widget display a list of checkboxes • Many2many_checkboxes display single checkbox for each record existing in the model depending on the relation and domain. • Checked records will be added to the field. Example Code : .py - field_name = fields.Many2many('res.partner', string="many2many_checkboxes") .xml - <field name="field_name" widget="many2many_checkboxes"/>
  • 11. Here is the view for this :
  • 12. 4. many2many_kanban widget • In many2many_kanban widget related objects are viewed in Kanban View • Depending on the Kanban view defined , look and impact of the widget changes accordingly • This is more comfortable because it can vary its look based on customer requirement by changing Kanban view definition.
  • 13.
  • 14. Here is the view for this :
  • 15. 5. many2many_binary widget • Many2many_binary is used for attachment purpose • Attach a file in email are examples of this • User can upload as many files and attach this to a model • This widget works exclusively on many2many fields associated with the ir.attachment model
  • 16.
  • 17. Here is the view for this :
  • 18. 6. x2many_counter widge • A simple, read only widget displaying a link with an information about the number of related items. • The link’s target view can be configured with the views option. • Also useful with one2many fields. • The views to display in the act window action must be a list of tuple whose first element is the id of the view to display (or False to take the default one) and the second element is the type of the view. • Defaults to [[false, "tree"], [false, "form"]].
  • 19. Example Code : .xml - <field name="field_name" widget="x2many_counter">