修改需求计划模块需求与bug

This commit is contained in:
hyyy
2025-06-18 14:18:37 +08:00
parent 749f44d6df
commit 1456d4303b
3 changed files with 55 additions and 17 deletions

View File

@@ -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 {

View File

@@ -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,6 +23,20 @@ odoo.define('sf_demand.print_demand', function (require) {
<iframe class="table-image-preview-container" src=""/>
</div>`
);
}
if(!$('.denmand_set').length) {
self.$el.prepend(`
<form class="denmand_set">
<span>更多设置:</span>
<input type="radio" id="male" name="set" value="图纸">
<label for="male">图纸</label>
<input type="radio" id="female" name="set" value="程序单">
<label for="female">程序单</label>
<input type="radio" id="other" name="set" value="" checked>
<label for="other">图纸/程序单</label>
</form>
`)
self.$el.prepend(`
<div class="print-button-container" style="margin-bottom:10px;">
<button class="btn btn-primary o_print_custom">
@@ -38,13 +53,15 @@ odoo.define('sf_demand.print_demand', function (require) {
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) {

View File

@@ -64,3 +64,21 @@
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;
}
}