diff --git a/estate/views/estate_property_tag_views.xml b/estate/views/estate_property_tag_views.xml index d53a4ba0f..92380518e 100644 --- a/estate/views/estate_property_tag_views.xml +++ b/estate/views/estate_property_tag_views.xml @@ -15,6 +15,37 @@ + + + estate.property.tag.form + estate.property.tag + +
+ +

我是From01

+ + + + +
+
+
+
+ + estate.property.tag.form + estate.property.tag + +
+ +

我是From02

+ + + + +
+
+
+
estate.property.tag.search diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 9099ccfad..c2ed2b67b 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -15,7 +15,7 @@ - + diff --git a/many2many_quick_preview/__init__.py b/many2many_quick_preview/__init__.py new file mode 100644 index 000000000..f5ba686bc --- /dev/null +++ b/many2many_quick_preview/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models \ No newline at end of file diff --git a/many2many_quick_preview/__manifest__.py b/many2many_quick_preview/__manifest__.py new file mode 100644 index 000000000..a105ed354 --- /dev/null +++ b/many2many_quick_preview/__manifest__.py @@ -0,0 +1,21 @@ +{ + "name": "Many2Many Quick Preview", + "author": "Odoo Hub", + "category": "Tools", + "summary": "Many2Many快速预览", + "description": "Many2Many快速预览", + "maintainer": "Odoo Hub", + "website": "#", + "version": "17.0.0.1", + "depends": ["base", "web"], + "assets": { + "web.assets_backend": [ + "many2many_quick_preview/static/src/js/many2many_tags_field.js", + ], + }, + "images": ["static/description/banner.png"], + "installable": True, + "application": True, + "auto_install": False, + "license": "LGPL-3", +} diff --git a/many2many_quick_preview/models/__init__.py b/many2many_quick_preview/models/__init__.py new file mode 100644 index 000000000..81f52e3bf --- /dev/null +++ b/many2many_quick_preview/models/__init__.py @@ -0,0 +1 @@ +from . import ir_ui_view diff --git a/many2many_quick_preview/models/ir_ui_view.py b/many2many_quick_preview/models/ir_ui_view.py new file mode 100644 index 000000000..35a34aa7c --- /dev/null +++ b/many2many_quick_preview/models/ir_ui_view.py @@ -0,0 +1,17 @@ +from odoo import models, fields, api + + +class IrUiView(models.Model): + _inherit = "ir.ui.view" + + @api.model + def get_view_id_from_xmlid(self, xmlid): + """根据 xmlid 返回 ir.ui.view 的 id""" + if not xmlid or "." not in xmlid: + return False + try: + record = self.env.ref(xmlid) + return record.id if record and record._name == "ir.ui.view" else False + except ValueError: + # xmlid 不存在时 env.ref 会抛异常 + return False diff --git a/many2many_quick_preview/static/description/banner.gif b/many2many_quick_preview/static/description/banner.gif new file mode 100644 index 000000000..cca028d47 Binary files /dev/null and b/many2many_quick_preview/static/description/banner.gif differ diff --git a/many2many_quick_preview/static/description/banner.png b/many2many_quick_preview/static/description/banner.png new file mode 100644 index 000000000..e56b73a1c Binary files /dev/null and b/many2many_quick_preview/static/description/banner.png differ diff --git a/many2many_quick_preview/static/description/icon.png b/many2many_quick_preview/static/description/icon.png new file mode 100644 index 000000000..31e7c7703 Binary files /dev/null and b/many2many_quick_preview/static/description/icon.png differ diff --git a/many2many_quick_preview/static/description/index.html b/many2many_quick_preview/static/description/index.html new file mode 100644 index 000000000..350df3809 --- /dev/null +++ b/many2many_quick_preview/static/description/index.html @@ -0,0 +1,221 @@ + + + + + + + + + +
+
+
+

App Overview

+ +

+ The Many2Many Quick Preview app enhances your Odoo experience by allowing users to instantly preview + related records + from many2many fields directly within the many2many tags. This app streamlines navigation and boosts + productivity + by providing quick access to related records, eliminating the need to open them individually. +

+ +
+
+

Key Features:

+
    +
  • + + Instantly preview related records in many2many fields without opening them +
  • +
  • + + Quick access to detailed record information directly from the many2many tags +
  • +
  • + + Boost productivity by reducing time spent switching between records +
  • +
  • + + Improves user experience with faster, more efficient navigation +
  • +
  • + + Seamlessly integrates into existing Odoo many2many fields and views +
  • +
+
+
+ +
+
+
+ + +
+
+
+

Watch Demo

+ +

+ Check out our video for a detailed demonstration of how our Odoo apps work and how they can help you optimize your business. +

+ +
+ +
+ +
+
+
+ + +
+
+
+

Screenshots

+ +

+ Explore how our app looks and functions! Here are some screenshots to give you a quick view of the + features. +

+ +
+
+
+
Quick Preview
+
+ Screenshot 1 +
+
+
+
+
+
+
+ + +
+
+
+

Our Services

+ +

+ We offer a range of essential services designed to enhance your Odoo experience, including + customization, migration, and troubleshooting. Our goal is to ensure smooth integration and optimal + performance for your business. +

+ +
+
+
+
+
+ +
+

Customization

+

+ Tailor Odoo to meet your specific business needs with custom modules, workflows, and UI + adjustments. + We ensure that Odoo fits perfectly into your operations. +

+
+
+
+ +
+
+
+
+ +
+

Migration

+

+ Upgrade your Odoo plugins from older versions to newer versions. + We ensure a smooth transition, preserving functionality and minimizing downtime. +

+
+
+
+ +
+
+
+
+ +
+

Troubleshooting

+

+ Encountering issues with your Odoo setup? Our troubleshooting service quickly identifies + and fixes + problems, ensuring minimal downtime and maximum productivity. +

+
+
+
+
+ +
+
+
+ + +
+
+
+

Explore More Apps

+ +

+ Looking for more powerful tools to enhance your Odoo experience? Check out our complete collection of + apps + designed to help you get the most out of your Odoo environment. +

+ + + +
+
+
+ + +
+
+
+

Help & Support

+ +

+ Having issues with the app? We offer free support to help with installation, + configuration, or any bugs you may encounter. + If you need further customizations, We are here to provide tailored solutions for your + needs. +

+ + + +
+
+
+ + + diff --git a/many2many_quick_preview/static/description/many2many_quick_preview.gif b/many2many_quick_preview/static/description/many2many_quick_preview.gif new file mode 100644 index 000000000..4dbeaa6a3 Binary files /dev/null and b/many2many_quick_preview/static/description/many2many_quick_preview.gif differ diff --git a/many2many_quick_preview/static/src/js/many2many_tags_field.js b/many2many_quick_preview/static/src/js/many2many_tags_field.js new file mode 100644 index 000000000..6c8cd1fac --- /dev/null +++ b/many2many_quick_preview/static/src/js/many2many_tags_field.js @@ -0,0 +1,58 @@ +/** @odoo-module **/ + +import { Many2ManyTagsFieldColorEditable, Many2ManyTagsField } from "@web/views/fields/many2many_tags/many2many_tags_field"; +import { patch } from "@web/core/utils/patch"; + +patch(Many2ManyTagsFieldColorEditable.prototype, { + setup() { + super.setup(...arguments); + }, + onBadgeClick(ev, record) { + const onBadgeClick = super.onBadgeClick(ev, record); + var action = { + type: 'ir.actions.act_window', + res_model: record.resModel, + res_id: record.resId, + views: [[false, 'form']], + target: 'new', + }; + this.env.model.action.doAction(action); + return onBadgeClick; + }, +}); +patch(Many2ManyTagsField.prototype, { + getTagProps(record) { + const props = super.getTagProps(record); + // 绑定点击事件(注意要接收 ev) + props.onClick = (ev) => this.onTagClick(ev, record); + return props; + }, + + async onTagClick(ev, record) { + // 阻止默认的标签点击行为 + ev.stopPropagation(); + ev.preventDefault(); + const context = record.evalContext?.context || {}; + let viewId = false; + if (context.open_form_view) { + try { + viewId = await this.orm.call( + "ir.ui.view", + "get_view_id_from_xmlid", + [context.open_form_view] + ); + } catch (error) { + console.error("获取指定 XML ID 的视图 ID 失败:", context.open_form_view, error); + } + } + // 执行自定义动作 + this.env.services.action.doAction({ + type: "ir.actions.act_window", + name: record?.data?.display_name, + res_model: this.relation, + res_id: record.resId, + views: [[viewId, "form"]], + target: "new", + }); + }, +}); \ No newline at end of file