diff --git a/sf_demand_plan/static/src/js/print_demand.js b/sf_demand_plan/static/src/js/print_demand.js index 5df0d02f..a05638a7 100644 --- a/sf_demand_plan/static/src/js/print_demand.js +++ b/sf_demand_plan/static/src/js/print_demand.js @@ -25,7 +25,11 @@ odoo.define('sf_demand.print_demand', function (require) { ); } + if(!$('.denmand_set').length) { + + const checked = self.getParent().radioCheck || 'all' + self.$el.prepend(`
更多设置: @@ -33,21 +37,25 @@ odoo.define('sf_demand.print_demand', function (require) { - +
`) - self.$el.prepend(` - - `); - } + setTimeout(() => { + $(`input[name=set][value=${checked}]`).prop('checked', true) + $('.denmand_set').trigger('click') + }, 100); + self.$el.prepend(` + + `); + } }); }, start: function() { @@ -106,7 +114,7 @@ odoo.define('sf_demand.print_demand', function (require) { } }, getSelectedIds: function() { - return this.state.data.map(_ => { + return this.state.data.filter(_ => !_.hide).map(_ => { return _.data.id }) }, @@ -129,16 +137,24 @@ odoo.define('sf_demand.print_demand', function (require) { // self.do_warn("打印失败", error.data.message || "未知错误"); }).finally(e => { this.getParent().reload() - }) }, _onDenmandChange(e) { const isChecked = $(e.currentTarget).find('input:checked').val() + this.getParent().radioCheck = isChecked this.$el.find('tbody').find('.o_data_row').show() - if(!isChecked) return - this.$el.find('tbody').children().each(function() { + + this.state.data.forEach(_ => { + _.hide = false + }) + const self = this + if(!isChecked || isChecked == 'all') return + this.$el.find('tbody').children('.o_data_row').each(function() { if($(this).find('td[name=type]').text() != isChecked) { + const i = $(this).index() + + self.state.data[i].hide = true $(this).hide() } }) diff --git a/sf_quality/data/insepection_report_template.xml b/sf_quality/data/insepection_report_template.xml index 14a42065..06ce9214 100644 --- a/sf_quality/data/insepection_report_template.xml +++ b/sf_quality/data/insepection_report_template.xml @@ -275,7 +275,7 @@ - +