odoo 16 从2022年10月16日发布至今,已经基本稳定。 从14开始,使用owl方式,新增不少widget。我们一直在熟悉新版的变化,并进行实施开发。如今odoo16完全可以在我们的项目中进行商用,也迁移升级了很多原有模块odoo16。
odoo16除了在业务流程逻辑上进行了不少优化(太不人道,开发的一堆要重写!!),在前端也基本完全重构。 前端的js经历了owl1到owl2,原来早期单文件拆成了 view = controller + render + model 的结构,更为规范(最不人道,不但要重写,还要难入门。。。。),owl用最新mvvm方式重构。性能的确大幅提升,界面更友好,操作更方便。
花了不少时间,基本把所有widget都试了下,光是odoo本身就已经有超过100个widget,少量是企业版的(自求多福),很多功能十分好,实现了很多想要的效果。 在此简单整理下,后续会更新些说明。
Widget清单由 Chatgpt编码取得,代码见最下。
至于 widget 怎么用,如果你能对widget感兴趣,应该具备一定能力了。 一句话,“odoo的源码就是大宝库”。这里放个 新widget, badge 和 label_selection 的截图,本来是要写一个类似的,结果找源码找到了,发现十分好用。常规的 listview 有decoration可以用不同色,但太不明显,用了这个,在不同状态可以有更明显的css样式,简单处理下也可以用在时间上。比如还有2天就到期,显示红色 danger,还有5天的就显示橙色 warning。 业务跟单是硬需求,十分好用!!
以下是 odoo 社区版和企业版的全部 widget了(如果你还找到别的,欢迎补充),第三方的有很多,比如我们的ztree树状视图,odoo 市场这里找
熟用 widget 会让你升级很快(当然第一是要熟悉odoo业务功能,路漫漫。。),毕竟官方的建议是能用 python就用python,没事儿不要写前端!!
odoo16 所有的widget, 共计 178 个
社区版 Widget,合计 140 个
企业版 Widget,合计 38 个
社区版Widget | 社区版Widget | 企业版使用的 Widget |
CopyClipboardChar | many2one | account-tax-totals-field-for-withhold |
CopyClipboardText | many2one_avatar | appraisal_skills_one2many |
CopyClipboardURL | many2one_avatar_employee | bank_rec_html |
account-tax-totals-field | many2one_avatar_user | bank_rec_widget_form_lines_widget |
account_resequence_widget | many2one_barcode | bank_rec_widget_form_reco_models_widget |
account_type_selection | mass_mailing_html | bank_rec_widget_view_switcher |
ace | mondialrelay_relay | bankrec_many2one_multi_id |
activity_exception | monetary | barcode_handler |
analytic_distribution | mrp_consumed | boolean_toggle_confirm |
applicant_char | mrp_production_components_x2many | call_queue_switch |
attachment_image | mrp_should_consume | consolidation_dashboard_field |
autosave_many2many_tags | mrp_timer | deprec_lines_reversed |
background_image | mrp_workorder_popover | documents_many2many_tags |
badge | name_with_subtask_count | field_many2one_iot_scale |
binary | one2many | followup_trust_widget |
boolean | open_move_widget | fsm_product_quantity |
boolean_favorite | page_url | helpdesk_sla_many2many_tags |
boolean_toggle | payment | hierarchy_kanban |
char | pdf_viewer | iot_picture |
char_emojis | percentage | kanban.many2many_avatar_employee |
chatbot_steps_one2many | percentpie | many2many_tags_avatar |
chatbot_triggering_answers_widget | phone | many2one_avatar_resource |
color | pol_product_many2one | marketing_activity_graph |
color_picker | portal_wizard_user_one2many | payslip_line_one2many |
counted_quantity_widget | priority | plm_upd_qty |
dashboard_graph | profiling_qweb_view | properties |
date | progressbar | quality_domain_field |
daterange | project_private_task | set_reserved_qty_button |
datetime | project_state_selection | signature |
domain | question_page_one2many | social_post_preview |
radio | task_confirm_date_end_with_warning | |
embed_viewer | reference | timer_start_field |
event_icon_selection | remaining_days | timesheet_uom_hour_toggle |
filterable_selection | replenishment_history_widget | timesheet_uom_timer |
float | res_partner_many2one | twitter_users_autocomplete |
float_time | resume_one2many | worked_days_line_one2many |
float_without_trailing_zeros | sale_order_many2one | youtube_upload |
forecast_widget | sales_team_progressbar | |
gauge | section_and_note_one2many | |
grouped_view_widget | section_and_note_text | |
handle | section_one2many | |
hr_holidays_radio_image | selection | |
hr_org_chart | selection_badge | |
html | skills_one2many | |
iframe | slide_category_one2many | |
iframe_wrapper | sms_widget | |
image | so_line_field | |
image_radio | sol_discount | |
image_url | sol_product_many2one | |
integer | stat_info | |
kanban_activity | state_selection | |
kanban_vat_activity | statinfo | |
label_selection | status_with_color | |
lead_days_widget | statusbar | |
line_open_move_widget | stock_move_one2many | |
list_activity | stock_rescheduling_popover | |
loyalty_one2many | survey_description_page | |
mail_activity | task_with_hours | |
mail_followers | text | |
mail_thread | text_emojis | |
mailing_filter | timesheet_uom | |
many2many | timesheet_uom_no_toggle | |
many2many_alt_pos | timezone_mismatch | |
many2many_avatar_employee | upgrade_boolean | |
many2many_avatar_user | url | |
many2many_binary | video_preview | |
many2many_checkboxes | website_publish_button | |
many2many_tags | website_redirect_button | |
many2many_tags_email | website_urls | |
many2manyattendee | work_permit_upload |
以上的Widget 清单,由 ChatGpt编码得出,简单微调,代码如下
# -*- coding: utf-8 -*-
import os
import xml.etree.ElementTree as ET
def find_widgets_in_xml(file_path):
widgets = set()
try:
tree = ET.parse(file_path)
root = tree.getroot()
for elem in root.iter():
widget_value = elem.attrib.get('widget')
if widget_value is not None:
widgets.add(widget_value)
except Exception as e:
print(f"Error parsing {file_path}: {e}")
return widgets
def main():
# 这里放odoo 目录
odoo_addons_dir = 'D:\\odoo16-x64\\source\odoo\\addons'
all_widgets = set()
for subdir, dirs, files in os.walk(odoo_addons_dir):
for file in files:
if file.endswith(".xml"):
file_path = os.path.join(subdir, file)
widgets_in_file = find_widgets_in_xml(file_path)
all_widgets.update(widgets_in_file)
print("All unique widgets found:")
for widget in sorted(all_widgets):
print(f"{widget}")
if __name__ == "__main__":
main()
常用Widget使用教程
|
|