Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/整体式刀具能力参数补充

This commit is contained in:
yuxianghui
2023-09-08 10:23:01 +08:00
5 changed files with 63 additions and 2 deletions

View File

@@ -10,7 +10,7 @@
""", """,
'category': 'sf', 'category': 'sf',
'website': 'https://www.sf.jikimo.com', 'website': 'https://www.sf.jikimo.com',
'depends': ['account', 'base', 'mrp_workorder', 'sale'], 'depends': [],
'data': [ 'data': [
], ],
@@ -21,6 +21,7 @@
'web.assets_qweb': [ 'web.assets_qweb': [
], ],
'web.assets_backend': [ 'web.assets_backend': [
'jikimo_frontend/static/src/fields/custom_many2many_checkboxes/*',
'jikimo_frontend/static/src/scss/test.scss', 'jikimo_frontend/static/src/scss/test.scss',
], ],

View File

@@ -0,0 +1,6 @@
.zoomed {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(20);
}

View File

@@ -0,0 +1,26 @@
/** @odoo-module **/
import { Many2ManyCheckboxesField } from "@web/views/fields/many2many_checkboxes/many2many_checkboxes_field";
import { registry } from "@web/core/registry";
export class MyCustomWidget extends Many2ManyCheckboxesField {
// 你可以重写或者添加一些方法和属性
// 例如你可以重写setup方法来添加一些事件监听器或者初始化一些变量
setup() {
super.setup(); // 调用父类的setup方法
// 你自己的代码
}
onImageClick(event) {
// 放大图片逻辑
// 获取图片元素
const img = event.target;
// 实现放大图片逻辑
// 比如使用 CSS 放大
img.classList.add('zoomed');
}
}
MyCustomWidget.template = "sf_plan.MyCustomWidget"
// MyCustomWidget.supportedTypes = ['many2many'];
registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget);

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="sf_plan.MyCustomWidget" owl="1">
<div aria-atomic="true">
<t t-foreach="items" t-as="item" t-key="item[0]">
<div>
<CheckBox
value="isSelected(item)"
disabled="props.readonly"
onChange="(ev) => this.onChange(item[0], ev)"
>
<t t-esc="item[1]"/>
</CheckBox>
</div>
<div t-on-click="onImageClick">
<t>
<img t-att-src="item[2]" width="20" height="20"/>
</t>
</div>
</t>
</div>
</t>
</templates>

View File

@@ -6,7 +6,8 @@
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/> <field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//header" position="inside"> <xpath expr="//header" position="inside">
<button string="程序下载" name="cnc_file_download" type="object" class="oe_highlight"/> <button string="程序下载" name="cnc_file_download" type="object" class="oe_highlight" attrs='{"invisible": ["|",
("user_permissions","=",False),("routing_type","!=","CNC加工")]}'/>
</xpath> </xpath>
<xpath expr="//page//field[@name='cnc_ids']" position="before"> <xpath expr="//page//field[@name='cnc_ids']" position="before">
<group> <group>