们有不同类型的小部件用于不同的目的,帮助我们简化操作。小部件用于使代码变得简单且用户友好,这将有助于软件的编码和编程方面。在 Odoo 14 开发中,我们可以利用不同的小部件,这些小部件可用于编程操作的某些特定方面。这些简化工具将为简化编程操作铺平道路。
在这篇文章中,我们将讨论可以在 Odoo 领域应用的不同小部件。
所有可在 Odoo 中使用的 Widget 工具均与其相关的索引一起定义。在本博客中,我们总共介绍了 Odoo 中使用的 30 种小部件工具。此外,还定义了 Odoo 平台中各个小部件操作的字段类型以及各个小部件操作的插画截图,以便更清晰地了解操作。
现在让我们继续一一了解每个小部件。
1.badge
Field Type: Many2one, Selection
<field name="state_id" widget="badge" />
2.remaining_days
Field Type: Datetime
<field name="expiration_date" widget="remaining_days"/>
- color_picker
Field Type: Integer
<field name="color" widget="color_picker"/>
- char_emojis / text_emojis
Field Type: Char, Text
<field name="subject" string="Subject" widget="char_emojis"/>
- forecast_widget
Field Type: Float
<field name="forecast_availability" string="Reserved" widget="forecast_widget"/>
- many2one_avatar_employee
Field Type: Many2one
<field name="employee_id" widget="many2one_avatar_employee"/>
- many2one_avatar_employee
Field Type: Many2one
<field name="user_id" widget="many2one_avatar_user"/>
- priority
Field Type: Selection
priority = fields.Selection([('0', 'Normal'),('1', 'Good'),('2', 'Very Good'),('3', 'Excellent')], "Appreciation", default='0')
<field name="priority" widget="priority"/>
- product_discount
Field Type: Float
<field name="discount" string="Disc.%" widget="product_discount"/>
- list_activity
Field Type: One2many
<field name="activity_ids" widget="list_activity"/>
- kanban_activity
Field Type: One2many
<field name="activity_ids" widget="kanban_activity"/>
- account_resequence_widget
Field Type: Text
<field name="preview_moves" widget="account_resequence_widget"/>
- stock_rescheduling_popover
Field Type: Char
<field string=" " name="json_popover" widget="stock_rescheduling_popover"/>
- mrp_should_consume
Field Type: Float
<field name="product_uom_qty" widget="mrp_should_consume" string="To Consume" width="1"/>
- mrp_workorder_popover
Field Type: Char
<field name="json_popover" widget="mrp_workorder_popover" string=" " width="0.1" attrs="{'invisible': [('show_json_popover', '=', False)]}"/>
- popover_widget
Field Type: Char
<field name="json_lead_days_popover" optional="show" nolabel="1" string="Forecast Description" width="10px" widget="popover_widget"/>
- kanban_vat_activity
Field Type: Boolean
<field name="json_activity_data" widget="kanban_vat_activity"/>
- many2one_barcode
Field Type: Many2one
<field name="product_id"context="{'partner_id': parent.partner_id}" widget="many2one_barcode"domain="[('purchase_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]"/>
- text
Field Type: Text, Char
<field name="description" widget="text"/>
- many2manyattendee
Field Type: Many2many
<field name="partner_ids" widget="many2manyattendee" placeholder="Select attendees..." context="{'force_email':True}" class="oe_inline"/>
- many2many_tags_avatar
Field Type: Many2many
<field name="partner_ids" widget="many2many_tags_avatar" placeholder="Select attendees..." context="{'force_email':True}" class="oe_inline"/>
- website_urls
Field Type: Char
<field name="regex_url" widget="website_urls" placeholder="e.g. /page"/>
- domain
- Fied Type: Char
<field name="filter_domain" widget="domain"/>
- boolean_favorite
Field Type: Boolean
<field name="is_favorite" widget="boolean_favorite" nolabel="1"/>
- account_hierarchy_selection
Field Type: Many2one
<field name="user_type_id" widget="account_hierarchy_selection"/>
- percentage
Field Type: Float
<field name="percentage" widget="percentage" />
- task_with_hours
Field Type: Many2one
<field name="task_id" widget="task_with_hours" domain="[('project_id', '=', project_id)]"/>
- timesheet_uom_no_toggle
Float Type: Float
<field name="planned_hours" widget="timesheet_uom_no_toggle" sum="Initially Planned Hours" optional="hide"/>
- CopyClipboardChar
Float Type: Char
<field name="link" readonly="1" widget="CopyClipboardChar"/>
- boolean_toggle
Float Type: Boolean
<field name="active" widget="boolean_toggle"/>
- sms_widget
Float Type: Char, Text
<field name="body" widget="sms_widget"/>
- selection_badge
Float Type: Selection
<field name="progression" widget="selection_badge"/>
- timesheet_uom_timer
Float Type: Float
<field name="unit_amount" string="Time Spent" widget="timesheet_uom_timer"/>
- daterange
Float Type: Datetime
<field name="date_end" widget="daterange" nolabel="1" class="oe_inline" options="{'related_start_date': 'date_begin'}"/>
timesheet_uom
Filed Type: timesheet_uom
<field name="unit_amount" widget="timesheet_uom"/>
- pad
Float Type: Char
<field name="description_pad" widget="pad" nolabel="1"/>
- tate_selection
Field Type: Selection
<field name="kanban_state" widget="state_selection"/>
- many2many_checkboxes
Float Type: Many2many
<field name="inbound_payment_method_ids" string="Methods" widget="many2many_checkboxes" attrs="{'invisible': [('type', 'not in', ['bank', 'cash'])]}"/>
- video_preview
Float Type: Char
<field name="embed_code" class="mt-2" widget="video_preview"/>
- res_partner_many2one
Field type: many2one
<field name="partner_id" widget="res_partner_many2one"context="{'default_name': contact_name,'default_title': title,'default_street': street,'default_street2': street2,'default_city': city,'default_state_id': state_id,'default_zip': zip,'default_country_id': country_id,'default_function': function,'default_phone': phone,'default_mobile': mobile,'default_email': email_from,'default_user_id': user_id,'default_team_id': team_id,'default_website': website,'show_vat': True}" />
这些是 Odoo 平台开发过程中使用的各种类型的小部件工具,通过简化开发和编程方面为平台引入高级操作功能。
总之,本文章中描述的所有 40 种小部件工具都将对平台的操作方面有所帮助。您可以阅读以下博客,以清楚地了解其他已使用且可在 Odoo 中使用的小部件工具: Odoo 中的小部件