Merge branch 'develop' into feature/commercially_launched
This commit is contained in:
@@ -118,6 +118,17 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
|||||||
owl.onPatched(() => {
|
owl.onPatched(() => {
|
||||||
this.listherHeaderBodyNum()
|
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)
|
||||||
|
})
|
||||||
|
}
|
||||||
return this._super(...arguments);
|
return this._super(...arguments);
|
||||||
},
|
},
|
||||||
setRequired() {
|
setRequired() {
|
||||||
@@ -163,7 +174,58 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setColumns( merge_key) {
|
||||||
|
const data = this.props.list.records
|
||||||
|
let sourceIndex = 0;
|
||||||
|
let sourceValue = ''
|
||||||
|
data.forEach((item, index) => {
|
||||||
|
if(!item.colspan) {
|
||||||
|
item.colspan = 1;
|
||||||
|
}
|
||||||
|
if(item.data[merge_key] === sourceValue) {
|
||||||
|
data[sourceIndex].colspan ++ ;
|
||||||
|
item.colspan = 0;
|
||||||
|
} else {
|
||||||
|
sourceIndex = index;
|
||||||
|
sourceValue = item.data[merge_key];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return data
|
||||||
|
},
|
||||||
|
getFieldModifiers(xmlString) {
|
||||||
|
const parser = new DOMParser();
|
||||||
|
const xmlDoc = parser.parseFromString(xmlString, "text/xml");
|
||||||
|
|
||||||
|
// 提取 <tree> 的 modifiers
|
||||||
|
const treeElement = xmlDoc.querySelector("tree");
|
||||||
|
const treeModifiers = treeElement.getAttribute("modifiers");
|
||||||
|
if (treeModifiers) {
|
||||||
|
const parsedTreeModifiers = JSON.parse(treeModifiers);
|
||||||
|
console.log("Tree Modifiers:", parsedTreeModifiers);
|
||||||
|
return parsedTreeModifiers;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
mergeColumns(merge_fields, data) {
|
||||||
|
const dom = this.tableRef.el
|
||||||
|
const thead = $(dom).children('thead')
|
||||||
|
const tbody = $(dom).children('tbody')
|
||||||
|
tbody.children('tr.o_data_row').each(function () {
|
||||||
|
const tr = $(this)
|
||||||
|
const td = tr.children('td')
|
||||||
|
const index = $(this).index()
|
||||||
|
td.each(function () {
|
||||||
|
if(merge_fields.indexOf($(this).attr('name')) >= 0) {
|
||||||
|
$(this).attr('rowspan', data[index].colspan)
|
||||||
|
if(data[index].colspan == 0) {
|
||||||
|
$(this).remove()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
patch(FormLabel.prototype, 'jikimo_frontend.FormLabel', {
|
patch(FormLabel.prototype, 'jikimo_frontend.FormLabel', {
|
||||||
get className() {
|
get className() {
|
||||||
@@ -176,7 +238,6 @@ patch(FormLabel.prototype, 'jikimo_frontend.FormLabel', {
|
|||||||
);
|
);
|
||||||
const classes = this.props.className ? [this.props.className] : [];
|
const classes = this.props.className ? [this.props.className] : [];
|
||||||
const otherRequired = filedRequiredList[this.props.fieldName]
|
const otherRequired = filedRequiredList[this.props.fieldName]
|
||||||
|
|
||||||
if(this.props.fieldInfo?.rawAttrs?.class?.indexOf('custom_required') >= 0 || otherRequired) {
|
if(this.props.fieldInfo?.rawAttrs?.class?.indexOf('custom_required') >= 0 || otherRequired) {
|
||||||
classes.push('custom_required_add')
|
classes.push('custom_required_add')
|
||||||
}
|
}
|
||||||
@@ -193,35 +254,6 @@ patch(FormLabel.prototype, 'jikimo_frontend.FormLabel', {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 根据进度条设置水印
|
|
||||||
// const statusbar_params = {
|
|
||||||
// '已完工': 'bg-primary',
|
|
||||||
// '完成': 'bg-primary',
|
|
||||||
// '采购订单': 'bg-primary',
|
|
||||||
// '作废': 'bg-danger',
|
|
||||||
// '封存(报废)': 'bg-danger',
|
|
||||||
// }
|
|
||||||
// patch(StatusBarField.prototype, 'jikimo_frontend.StatusBarField', {
|
|
||||||
// setup() {
|
|
||||||
// owl.onMounted(this.ribbons);
|
|
||||||
// return this._super(...arguments);
|
|
||||||
// },
|
|
||||||
// ribbons() {
|
|
||||||
// try {
|
|
||||||
// const dom = $('.o_form_sheet.position-relative')
|
|
||||||
// const status = statusbar_params[this.currentName]
|
|
||||||
// if(status && dom.length) {
|
|
||||||
// dom.prepend(`<div class="o_widget o_widget_web_ribbon">
|
|
||||||
// <div class="ribbon ribbon-top-right">
|
|
||||||
// <span class="bg-opacity-75 ${status}" title="">${this.currentName}</span>
|
|
||||||
// </div>
|
|
||||||
// </div>`)
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// console.log(e)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ class QualityCheck(models.Model):
|
|||||||
# doubly linked chain for tablet view navigation
|
# doubly linked chain for tablet view navigation
|
||||||
next_check_id = fields.Many2one('quality.check')
|
next_check_id = fields.Many2one('quality.check')
|
||||||
previous_check_id = fields.Many2one('quality.check')
|
previous_check_id = fields.Many2one('quality.check')
|
||||||
# is_produced = fields.Boolean(string="Has Been Produced")
|
|
||||||
|
|
||||||
# For components registration
|
# For components registration
|
||||||
move_id = fields.Many2one(
|
move_id = fields.Many2one(
|
||||||
|
|||||||
@@ -108,15 +108,11 @@ class StockPicking(models.Model):
|
|||||||
|
|
||||||
def action_open_quality_check_picking(self):
|
def action_open_quality_check_picking(self):
|
||||||
action = self.env["ir.actions.actions"]._for_xml_id("quality_control.quality_check_action_picking")
|
action = self.env["ir.actions.actions"]._for_xml_id("quality_control.quality_check_action_picking")
|
||||||
action['context'] = self.env.context.copy()
|
action['context'] = {
|
||||||
keys_to_remove = [key for key in action['context'] if key.startswith('default_')]
|
|
||||||
for key in keys_to_remove:
|
|
||||||
del action['context'][key]
|
|
||||||
action['context'].update({
|
|
||||||
'search_default_picking_id': [self.id],
|
'search_default_picking_id': [self.id],
|
||||||
'default_picking_id': self.id,
|
'default_picking_id': self.id,
|
||||||
'show_lots_text': self.show_lots_text,
|
'show_lots_text': self.show_lots_text,
|
||||||
})
|
}
|
||||||
return action
|
return action
|
||||||
|
|
||||||
def button_quality_alert(self):
|
def button_quality_alert(self):
|
||||||
|
|||||||
@@ -117,6 +117,8 @@ class PurchaseOrderLine(models.Model):
|
|||||||
@api.depends('product_id')
|
@api.depends('product_id')
|
||||||
def _compute_related_product(self):
|
def _compute_related_product(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
|
if record.part_number or record.part_name:
|
||||||
|
continue
|
||||||
if record.product_id.categ_id.name == '坯料':
|
if record.product_id.categ_id.name == '坯料':
|
||||||
product_name = ''
|
product_name = ''
|
||||||
match = re.search(r'(S\d{5}-\d)', record.product_id.name)
|
match = re.search(r'(S\d{5}-\d)', record.product_id.name)
|
||||||
|
|||||||
@@ -12,18 +12,18 @@
|
|||||||
<div class="alert alert-warning" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
<field name="display_message" readonly="1" nolabel="1"/>
|
<field name="display_message" readonly="1" nolabel="1"/>
|
||||||
</div>
|
</div>
|
||||||
<field name="related_docs">
|
<field name="related_docs" >
|
||||||
<tree string="下游单据" create="false" edit="false" delete="false">
|
<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'}">
|
||||||
<!-- <field name="sequence" string="序号"/> -->
|
<!-- <field name="sequence" string="序号"/> -->
|
||||||
<field name="category" string="大类"/>
|
<field name="category" string="大类"/>
|
||||||
<field name="doc_name" string="单据名称"/>
|
<field name="doc_name" string="单据名称"/>
|
||||||
<field name="operation_type" string="作业类型"/>
|
<field name="operation_type" string="作业类型"/>
|
||||||
<field name="doc_number" string="单据编号"/>
|
<field name="doc_number" string="单据编号"/>
|
||||||
|
<field name="doc_state" string="单据状态"/>
|
||||||
|
<field name="cancel_reason" string="禁止取消原因"/>
|
||||||
<field name="line_number" string="行号"/>
|
<field name="line_number" string="行号"/>
|
||||||
<field name="product_name" string="产品名称"/>
|
<field name="product_name" string="产品名称"/>
|
||||||
<field name="quantity_str" string="数量"/>
|
<field name="quantity_str" string="数量"/>
|
||||||
<field name="doc_state" string="单据状态"/>
|
|
||||||
<field name="cancel_reason" string="禁止取消原因"/>
|
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
<footer>
|
<footer>
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ class StockPicking(models.Model):
|
|||||||
fail_check_text = ''
|
fail_check_text = ''
|
||||||
for product_id in product_list:
|
for product_id in product_list:
|
||||||
check_ids = quality_check_ids.filtered(lambda qc: qc.product_id == product_id)
|
check_ids = quality_check_ids.filtered(lambda qc: qc.product_id == product_id)
|
||||||
number = sum(check_ids.mapped('qty_line'))
|
if all(check_id.measure_on == 'move_line' for check_id in check_ids):
|
||||||
if number != 0:
|
number = sum(check_ids.mapped('qty_line'))
|
||||||
fail_check_text = (f'{fail_check_text}、{product_id.name} {number}件'
|
|
||||||
if fail_check_text != '' else f'{product_id.name} {number}件')
|
|
||||||
else:
|
else:
|
||||||
fail_check_text = (f'{fail_check_text}、{product_id.name}'
|
number = sum(self.move_ids_without_package.filtered(
|
||||||
if fail_check_text != '' else f'{product_id.name}')
|
lambda ml: ml.product_id == product_id).mapped('quantity_done'))
|
||||||
|
fail_check_text = (f'{fail_check_text}、{product_id.name} {number}件'
|
||||||
|
if fail_check_text != '' else f'{product_id.name} {number}件')
|
||||||
return {
|
return {
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
'res_model': 'picking.validate.check.wizard',
|
'res_model': 'picking.validate.check.wizard',
|
||||||
|
|||||||
@@ -382,6 +382,8 @@ class RePurchaseOrder(models.Model):
|
|||||||
'product_qty': 1,
|
'product_qty': 1,
|
||||||
'product_uom': server_template.uom_id.id,
|
'product_uom': server_template.uom_id.id,
|
||||||
'related_product': production.product_id.id,
|
'related_product': production.product_id.id,
|
||||||
|
'part_number': pp.part_number,
|
||||||
|
'part_name': pp.part_name,
|
||||||
}))
|
}))
|
||||||
# 获取服务商品最后一个供应商的采购员
|
# 获取服务商品最后一个供应商的采购员
|
||||||
purchase_user_id = server_template.seller_ids[-1].partner_id.purchase_user_id
|
purchase_user_id = server_template.seller_ids[-1].partner_id.purchase_user_id
|
||||||
|
|||||||
Reference in New Issue
Block a user