diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index c668d82e..6ffb824d 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -521,11 +521,6 @@ div:has(.o_required_modifier) > label::before { } } -// 设置表格横向滚动 -.o_list_renderer.o_renderer { - max-width: 100%; - overflow-x: auto; -} // 设置表单页面label文本不换行 .o_form_view .o_group .o_wrap_label .o_form_label { diff --git a/sf_demand_plan/static/src/js/print_demand.js b/sf_demand_plan/static/src/js/print_demand.js index 6dacc7b3..5df0d02f 100644 --- a/sf_demand_plan/static/src/js/print_demand.js +++ b/sf_demand_plan/static/src/js/print_demand.js @@ -13,6 +13,7 @@ odoo.define('sf_demand.print_demand', function (require) { this.getParent()?.$buttons.hide(); return this._super.apply(this, arguments).then(function () { + if(!self.state.data || !self.state.data.length) return // 添加图片预览容器到页面左侧 if (!$('.table-image-preview-container').length) { self.$el.parent().addClass('custom-table-image-container') @@ -22,29 +23,45 @@ odoo.define('sf_demand.print_demand', function (require) { ` ); + + } + if(!$('.denmand_set').length) { self.$el.prepend(` -
- `); + + `) + self.$el.prepend(` + + `); } }); }, start: function() { setTimeout(() => { this.$el.find('.o_data_row').eq(0).trigger('click') + this.getParent().$el?.find('.o_cp_top_right,.o_cp_bottom').hide() }, 500); return this._super(); }, events: _.extend({}, ListRenderer.prototype.events, { 'click .o_data_row': '_onCustomRowClick', 'click .o_print_custom': '_onPrintClick', - 'click .o_cancel_custom': '_onCancelClick' + 'click .o_cancel_custom': '_onCancelClick', + 'click .denmand_set': '_onDenmandChange', }), _onCancelClick() { this.getParent()?.getParent()?.dialogs.closeAll() @@ -95,8 +112,6 @@ odoo.define('sf_demand.print_demand', function (require) { }, _onPrintClick(e) { var print_ids = this.getSelectedIds(); - - this._rpc({ model: 'sf.demand.plan.print.wizard', method: 'demand_plan_print', @@ -118,6 +133,16 @@ odoo.define('sf_demand.print_demand', function (require) { }) }, + _onDenmandChange(e) { + const isChecked = $(e.currentTarget).find('input:checked').val() + this.$el.find('tbody').find('.o_data_row').show() + if(!isChecked) return + this.$el.find('tbody').children().each(function() { + if($(this).find('td[name=type]').text() != isChecked) { + $(this).hide() + } + }) + }, getFileUrl(attachment_type, data, key) { let fileUrl switch (attachment_type) { diff --git a/sf_demand_plan/static/src/scss/style.css b/sf_demand_plan/static/src/scss/style.css index 358156b5..9662a10a 100644 --- a/sf_demand_plan/static/src/scss/style.css +++ b/sf_demand_plan/static/src/scss/style.css @@ -63,4 +63,22 @@ .o_print_custom { right: 66px; } +} + +.denmand_set { + display: flex; + align-items: center; + height: 50px; + > span { + font-weight: bold; + } + input { + margin-left: 30px; + } + label { + margin-left: 5px; + } + input,label { + cursor: pointer; + } } \ No newline at end of file