Accept Merge Request #1935: (feature/制造功能优化 -> develop)
Merge Request: 修改取消列表,修改出厂检验报告 Created By: @黄焱 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1935
This commit is contained in:
@@ -119,12 +119,10 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||
this.listherHeaderBodyNum()
|
||||
})
|
||||
const treeModifiers = this.getFieldModifiers(this.props.archInfo.__rawArch);
|
||||
// console.log('treeModifiers', treeModifiers);
|
||||
if(treeModifiers) {
|
||||
this.props.merge_key = treeModifiers.merge_key;
|
||||
this.props.merge_fields = treeModifiers.merge_fields.split(',');
|
||||
const data = this.setColumns(this.props.merge_key);
|
||||
console.log('data', data);
|
||||
owl.onMounted(() => {
|
||||
this.mergeColumns(this.props.merge_fields, data)
|
||||
})
|
||||
@@ -176,19 +174,28 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||
}
|
||||
},
|
||||
setColumns( merge_key) {
|
||||
merge_key = merge_key.split(',')
|
||||
const data = this.props.list.records
|
||||
let sourceIndex = 0;
|
||||
let sourceValue = ''
|
||||
let sourceValue = merge_key.reduce((acc, key) => {
|
||||
acc[key] = '';
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
data.forEach((item, index) => {
|
||||
if(!item.colspan) {
|
||||
item.colspan = 1;
|
||||
}
|
||||
if(item.data[merge_key] === sourceValue) {
|
||||
const itemValue = merge_key.reduce((acc, key) => {
|
||||
acc[key] = item.data[key];
|
||||
return acc;
|
||||
}, {});
|
||||
if(JSON.stringify(itemValue) == JSON.stringify(sourceValue)) {
|
||||
data[sourceIndex].colspan ++ ;
|
||||
item.colspan = 0;
|
||||
} else {
|
||||
sourceIndex = index;
|
||||
sourceValue = item.data[merge_key];
|
||||
sourceValue = itemValue;
|
||||
}
|
||||
})
|
||||
return data
|
||||
@@ -211,14 +218,25 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||
const dom = this.tableRef.el
|
||||
const thead = $(dom).children('thead')
|
||||
const tbody = $(dom).children('tbody')
|
||||
let row_no = 0
|
||||
tbody.children('tr.o_data_row').each(function () {
|
||||
const tr = $(this)
|
||||
const td = tr.children('td')
|
||||
const index = $(this).index()
|
||||
const col = data[index].colspan
|
||||
row_no ++
|
||||
if(col == 0) {
|
||||
row_no --
|
||||
}
|
||||
td.eq(0).text(row_no).attr('rowspan', col)
|
||||
|
||||
if(col == 0) {
|
||||
td.eq(0).remove()
|
||||
}
|
||||
td.each(function () {
|
||||
if(merge_fields.indexOf($(this).attr('name')) >= 0) {
|
||||
$(this).attr('rowspan', data[index].colspan)
|
||||
if(data[index].colspan == 0) {
|
||||
$(this).attr('rowspan', col)
|
||||
if(col == 0) {
|
||||
$(this).remove()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,8 @@ class QualityCheck(models.Model):
|
||||
if record.picking_id:
|
||||
total_qty = 0
|
||||
for move in record.picking_id.move_ids_without_package:
|
||||
total_qty += int(move.product_uom_qty)
|
||||
if move.product_id == record.product_id:
|
||||
total_qty = int(move.product_uom_qty)
|
||||
record.total_qty = total_qty if total_qty > 0 else ''
|
||||
else:
|
||||
record.total_qty = ''
|
||||
|
||||
@@ -4,3 +4,11 @@
|
||||
min-height: 250px;
|
||||
}
|
||||
}
|
||||
|
||||
.measureTableSequence {
|
||||
width: 58px;
|
||||
}
|
||||
|
||||
.measureTable .o_list_table_ungrouped {
|
||||
min-width: auto;
|
||||
}
|
||||
@@ -4,8 +4,8 @@
|
||||
<field name="name">quality.check.measure.line.tree</field>
|
||||
<field name="model">quality.check.measure.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="sequence"/>
|
||||
<tree editable="bottom" class="measureTable">
|
||||
<field name="sequence" class="measureTableSequence"/>
|
||||
<!-- <field name="column_nums"/> -->
|
||||
<field name="measure_item"/>
|
||||
<field name="measure_value1" attrs="{ 'column_invisible': [('parent.column_nums', '<', 1)] }"/>
|
||||
|
||||
@@ -208,6 +208,16 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
||||
'processing': '加工中',
|
||||
'finished': '已完成',
|
||||
'cancel': '已取消'}
|
||||
|
||||
purchase_request_map_dict = {
|
||||
'draft': '草稿',
|
||||
'to_approve': '待批准',
|
||||
'approved': '已批准',
|
||||
'done': '已完成',
|
||||
'cancel': '已取消',
|
||||
'rejected': '已驳回',
|
||||
'in_progress': '处理中'
|
||||
}
|
||||
|
||||
module_name_dict = {
|
||||
'purchase': '采购',
|
||||
@@ -471,12 +481,12 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
||||
'wizard_id': wizard_id,
|
||||
'sequence': sequence,
|
||||
'category': module_name_dict[purchase_request_line._original_module],
|
||||
'doc_name': purchase_request_line._description,
|
||||
'doc_name': purchase_request_line.request_id._description,
|
||||
'doc_number': purchase_request_line.request_id.name,
|
||||
'line_number': prl_count,
|
||||
'product_name': f'[{purchase_request_line.product_id.default_code}] {purchase_request_line.product_id.name}',
|
||||
'quantity': purchase_request_line.product_qty,
|
||||
'doc_state': map_dict.get(purchase_request_line.request_state, purchase_request_line.request_state),
|
||||
'doc_state': purchase_request_map_dict.get(purchase_request_line.request_state, purchase_request_line.request_state),
|
||||
'cancel_reason': '已有异动' if purchase_request_line.request_state not in ['draft', 'cancel'] else ''
|
||||
}
|
||||
lines.append(self.create(vals))
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<field name="display_message" readonly="1" nolabel="1"/>
|
||||
</div>
|
||||
<field name="related_docs" >
|
||||
<tree string="下游单据" create="false" edit="false" delete="false" attrs="{'merge_fields': 'category,doc_name,operation_type,doc_number,doc_state, cancel_reason', 'merge_key': 'doc_number'}">
|
||||
<tree string="下游单据" create="false" edit="false" delete="false" attrs="{'merge_fields': 'category,doc_name,operation_type,doc_number,doc_state,cancel_reason','merge_key': 'doc_number,category'}">
|
||||
<!-- <field name="sequence" string="序号"/> -->
|
||||
<field name="category" string="大类"/>
|
||||
<field name="doc_name" string="单据名称"/>
|
||||
|
||||
Reference in New Issue
Block a user