diff --git a/jikimo_frontend/__manifest__.py b/jikimo_frontend/__manifest__.py index c3598323..b8b77eb1 100644 --- a/jikimo_frontend/__manifest__.py +++ b/jikimo_frontend/__manifest__.py @@ -21,8 +21,8 @@ 'web.assets_qweb': [ ], 'web.assets_backend': [ - 'jikimo_frontend/static/src/fields/custom_many2many_checkboxes/*', - 'jikimo_frontend/static/src/fields/Many2OneRadioField/*', + # 'jikimo_frontend/static/src/fields/custom_many2many_checkboxes/*', + # 'jikimo_frontend/static/src/fields/Many2OneRadioField/*', # 移除odoo相关标识 'jikimo_frontend/static/src/bye_odoo/*', 'jikimo_frontend/static/src/scss/custom_style.scss', diff --git a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.css b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.css deleted file mode 100644 index 72d877a0..00000000 --- a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.css +++ /dev/null @@ -1,3 +0,0 @@ -.many2one_radio_field { - display: inline-block; -} \ No newline at end of file diff --git a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js deleted file mode 100644 index 8c2be97f..00000000 --- a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js +++ /dev/null @@ -1,53 +0,0 @@ -/** @odoo-module **/ - -import { RadioField } from "@web/views/fields/radio/radio_field"; // 导入单选按钮组件 -import { registry } from "@web/core/registry"; - -export class Many2OneRadioField extends RadioField { - // 你可以重写或者添加一些方法和属性 - // 例如,你可以重写setup方法来添加一些事件监听器或者初始化一些变量 - setup() { - super.setup(); // 调用父类的setup方法 - // 你自己的代码 - } - - onImageClick(event) { - // 放大图片逻辑 - // 获取图片元素 - const img = event.target; - const close = img.nextSibling; - // 实现放大图片逻辑 - // 比如使用 CSS 放大 - img.parentElement.classList.add('zoomed'); - close.classList.add('img_close'); - } - - onCloseClick(event) { - const close = event.target; - const img = close.previousSibling; - img.parentElement.classList.remove('zoomed'); - close.classList.remove('img_close'); - } - - get items() { - return Many2OneRadioField.getItems(this.props.name, this.props.record); - } - - static getItems(fieldName, record) { - switch (record.fields[fieldName].type) { - case "selection": - return record.fields[fieldName].selection; - case "many2one": { - const value = record.preloadedData[fieldName] || []; - return value.map((item) => [item.id, item.display_name, item.image]); - } - default: - return []; - } - } -} - -Many2OneRadioField.template = "jikimo_frontend.Many2OneRadioField"; -// MyCustomWidget.supportedTypes = ['many2many']; - -registry.category("fields").add("many2one_radio", Many2OneRadioField); diff --git a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.xml b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.xml deleted file mode 100644 index 3d797eb0..00000000 --- a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - -
- -
- -
-
-
-
- -
diff --git a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css deleted file mode 100644 index 20cb4c7e..00000000 --- a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css +++ /dev/null @@ -1,100 +0,0 @@ - -.processing-capabilities-grid { - display: grid; - grid-template-columns: repeat(6, 1fr); - gap: 10px; - width: 100%; -} - -.grid-item { - display: flex; - align-items: center; -} - -.item-content { - display: flex; - flex-direction: column; - align-items: center; - text-align: center; -} -/*控制图片大小*/ -.item-icon { - width: 50px; - height: 50px; - margin-bottom: 5px; - margin-top: 15px; -} - -.item-label { - font-size: 12px; - word-break: break-word; -} - -@media (max-width: 1200px) { - .processing-capabilities-grid { - grid-template-columns: repeat(4, 1fr); - } -} - -@media (max-width: 768px) { - .processing-capabilities-grid { - grid-template-columns: repeat(3, 1fr); - } -} - -@media (max-width: 480px) { - .processing-capabilities-grid { - grid-template-columns: repeat(2, 1fr); - } -} -.image-preview-container { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.9); - display: flex; - justify-content: center; - align-items: center; - z-index: 1000; - opacity: 0; - transition: opacity 0.3s ease; -} - -.image-preview-container.show { - opacity: 1; -} - -.image-preview { - max-width: 90%; - max-height: 90%; - object-fit: contain; - box-shadow: 0 0 20px rgba(255, 255, 255, 0.2); - border-radius: 5px; - transform: scale(0.9); - transition: transform 0.3s ease; -} - -.image-preview-container.show .image-preview { - transform: scale(1); -} - -.image-preview-close { - position: absolute; - top: 20px; - right: 30px; - color: #fff; - font-size: 40px; - font-weight: bold; - transition: 0.3s; - cursor: pointer; - opacity: 0.7; -} - -.image-preview-close:hover, -.image-preview-close:focus { - opacity: 1; - text-decoration: none; - cursor: pointer; -} \ No newline at end of file diff --git a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js deleted file mode 100644 index dee78c5f..00000000 --- a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js +++ /dev/null @@ -1,60 +0,0 @@ -/** @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() { - super.setup(); - } - - onImageClick(event, src) { - event.preventDefault(); - event.stopPropagation(); - - // 创建预览框 - const previewContainer = document.createElement('div'); - previewContainer.className = 'image-preview-container'; - - const previewImg = document.createElement('img'); - previewImg.src = src; - previewImg.className = 'image-preview'; - // 设置放大的预览图片大小 - previewImg.style.width = '600px'; - previewImg.style.height = 'auto'; // 保持宽高比 - - const closeButton = document.createElement('span'); - closeButton.innerHTML = '×'; - closeButton.className = 'image-preview-close'; - - previewContainer.appendChild(previewImg); - previewContainer.appendChild(closeButton); - document.body.appendChild(previewContainer); - - // 添加关闭预览的事件监听器 - const closePreview = () => { - previewContainer.classList.remove('show'); - setTimeout(() => { - document.body.removeChild(previewContainer); - }, 300); - }; - - closeButton.addEventListener('click', closePreview); - - // 点击预览框外部也可以关闭 - previewContainer.addEventListener('click', (e) => { - if (e.target === previewContainer) { - closePreview(); - } - }); - - // 使用 setTimeout 来触发过渡效果 - setTimeout(() => { - previewContainer.classList.add('show'); - }, 10); - } -} - -MyCustomWidget.template = "jikimo_frontend.MyCustomWidget"; - -registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget); \ No newline at end of file diff --git a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.xml b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.xml deleted file mode 100644 index 9bb8797d..00000000 --- a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - -
- -
- -
- - -
-
-
-
-
-
- -
\ No newline at end of file diff --git a/sf_base/static/js/updateTable.js b/sf_base/static/js/updateTable.js index beec2c94..f76ff006 100644 --- a/sf_base/static/js/updateTable.js +++ b/sf_base/static/js/updateTable.js @@ -9,6 +9,7 @@ function getDomData() { table.hide() const thead = customTable.children('thead') const tbody = customTable.children('tbody') + const tfooter = customTable.children('tfoot') const tableData = [] const tbody_child = tbody.children() @@ -16,30 +17,29 @@ function getDomData() { for (let v = 0; v < tbody_child_len; v++) { // 将数据取出来到tableData里面 const data = tbody_child[v].innerText.split('\t') - // console.log('dom data',data) const [index, deep, name, Φ, value] = data - tableData.push({index, deep, name, Φ, value}) + tableData.push({ index, deep, name, Φ, value }) } - const ΦList = [...new Set(tableData.map(_ => _.name))] // ΦList去重 + const ΦList = [...new Set(tableData.map(_ => _.Φ))] // ΦList去重 const newTableData = {} tableData.forEach(_ => { - const key = _.deep + '|' + _.Φ - !newTableData[key] ? newTableData[key] = {i: _.index} : ''; + const key = _.deep + '|' + _.name + !newTableData[key] ? newTableData[key] = { i: _.index } : ''; if (_.Φ) { // 去除没有Φ的脏数据 newTableData[key]['Φ' + _.Φ] = _.value newTableData[key]['Φ' + _.Φ + 'i'] = _.index } }) - // console.log('qwdh',tableData, ΦList, newTableData); + // console.log(tableData, ΦList, newTableData); if (ΦList.filter(_ => _).length == 0) return; - handleThead(thead, ΦList) + handleThead(thead, ΦList, tfooter) - handleTbody(tbody, newTableData, ΦList, table) + handleTbody(tbody, newTableData, ΦList, table ) } // 重新设置表头、 -function handleThead(thead, ΦList) { +function handleThead(thead, ΦList, tfooter) { const dom = thead.children().eq(0).children() const len = dom.length dom.eq(0).attr('rowspan', 2) @@ -47,7 +47,11 @@ function handleThead(thead, ΦList) { len == 5 ? dom.eq(2).attr('rowspan', 2) : '' dom.eq(-2).attr('colspan', ΦList.length) dom.eq(-1).remove() - + if(tfooter && tfooter.length) { + tfooter.children().each(function () { + $(this).children().eq(-1).remove() + }) + } const tr = document.createElement('tr') for (let v = 0; v < ΦList.length; v++) { const th = document.createElement('th') @@ -68,7 +72,6 @@ function handleTbody(tbody, newTableData, ΦList, table) { // b = b.split('=')[1].split('%')[0] // return a - b // }) - // console.log('wqoqw ',ΦList) data.forEach(_ => { i++ const tr = $('') @@ -98,61 +101,6 @@ function handleTbody(tbody, newTableData, ΦList, table) { // // } tbody.append(tr) }) - // $(document).click(function (e) { - // if ($(e.target).attr('coustomTd')) { - // const orginV = $('[coustomInput=1]').children('input').val() - // $('[coustomInput=1]').parent().html(orginV) - // const v = $(e.target).attr('val') - // console.log($(e.target)); - // $(e.target).html('') - // const input = $('
') - // input.children('input').val(v) - // $(e.target).append(input) - // input.children('input').focus() - // input.children('input').select() - // } else if ($(e.target).attr('coustomInput')) { - // - // } else { - // const orginV = $('[coustomInput=1]').children('input').val() - // $('[coustomInput=1]').parent().html(orginV) - // const v = $(e.target).attr('val') - // } - // }) - // $(document).off('change') // 防止重复绑定 -// $(document).on('change', '[coustomInput] input', function () { -// $(this).parents('td').attr('val', $(this).val()); -// var eve1 = new Event('change'); -// var eve2 = new Event('input'); -// var eve3 = new Event('click'); -// const i = $(this).parents('td').attr('col'); -// let patchDom = table.find('tbody').children('tr').eq(i - 1); -// -// if (patchDom.length === 0) { -// console.error('No such row found'); -// return; -// } -// -// patchDom = patchDom.children().eq(-1); -// -// setTimeout(() => { -// if (patchDom.length === 0) { -// console.error('No such cell found'); -// return; -// } -// patchDom[0].dispatchEvent(eve3); // Simulate click event -// -// setTimeout(() => { -// patchDom = patchDom.find('input'); -// if (patchDom.length === 0) { -// console.error('No input found in the target cell'); -// return; -// } -// patchDom.val($(this).val()); -// patchDom[0].dispatchEvent(eve2); -// patchDom[0].dispatchEvent(eve1); -// }, 200); -// }, 500); -// }); } diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index b2d53392..e0679e55 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -177,12 +177,12 @@ - + + widget="custom_many2many_checkboxes" attrs="{'showExpand': True}"/> diff --git a/sf_manufacturing/views/sale_order_views.xml b/sf_manufacturing/views/sale_order_views.xml index 8e1d1061..ceaa09ab 100644 --- a/sf_manufacturing/views/sale_order_views.xml +++ b/sf_manufacturing/views/sale_order_views.xml @@ -19,7 +19,7 @@ - + diff --git a/sf_sale/static/src/css/purchase_list.css b/sf_sale/static/src/css/purchase_list.css index 2deacb9c..5e2aa86e 100644 --- a/sf_sale/static/src/css/purchase_list.css +++ b/sf_sale/static/src/css/purchase_list.css @@ -1,3 +1,9 @@ .purchase_order_list_name { min-width: 62px !important; +} + +.section_and_note_text span{ + white-space: wrap!important; + overflow: auto!important; + text-overflow: unset!important; } \ No newline at end of file diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml index 24e8f3ef..d408e807 100644 --- a/sf_sale/views/sale_order_view.xml +++ b/sf_sale/views/sale_order_view.xml @@ -102,7 +102,7 @@ + string="模型文件" attrs="{'readonly': [('state', 'in', ['draft'])], 'isInList': True}"/> @@ -112,6 +112,7 @@ {'no_create': True} {'is_sale_order_line': True } + section_and_note_text {'readonly': [('state', 'in', ['cancel','sale'])]} diff --git a/web_widget_model_viewer/static/src/js/3d_viewer.css b/web_widget_model_viewer/static/src/js/3d_viewer.css new file mode 100644 index 00000000..238f793d --- /dev/null +++ b/web_widget_model_viewer/static/src/js/3d_viewer.css @@ -0,0 +1,3 @@ +.model-viewer-in-list { + width: 150px; +} \ No newline at end of file diff --git a/web_widget_model_viewer/static/src/js/3d_viewer.js b/web_widget_model_viewer/static/src/js/3d_viewer.js index 4ed9dcc1..6e4b969c 100644 --- a/web_widget_model_viewer/static/src/js/3d_viewer.js +++ b/web_widget_model_viewer/static/src/js/3d_viewer.js @@ -63,11 +63,16 @@ StepViewer.supportedTypes = ["binary"]; StepViewer.props = { ...standardFieldProps, url: {type: String, optional: true}, + isInList: {type: Boolean, optional: true}, }; StepViewer.extractProps = ({attrs}) => { + const modifiedAttrs = JSON.parse(attrs.modifiers || '{}'); + + return { url: attrs.options.url, + isInList: modifiedAttrs.isInList, }; }; diff --git a/web_widget_model_viewer/static/src/js/3d_viewer.xml b/web_widget_model_viewer/static/src/js/3d_viewer.xml index 73f142c9..9053d184 100644 --- a/web_widget_model_viewer/static/src/js/3d_viewer.xml +++ b/web_widget_model_viewer/static/src/js/3d_viewer.xml @@ -5,6 +5,7 @@