Accept Merge Request #1973: (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/1973
This commit is contained in:
@@ -421,3 +421,4 @@ class EmbryoRedundancy(models.Model):
|
||||
width = fields.Float('宽度(mm)', required=True)
|
||||
height = fields.Float('高度(mm)', required=True)
|
||||
active = fields.Boolean('有效', default=True)
|
||||
remark = fields.Char('描述')
|
||||
|
||||
@@ -645,6 +645,7 @@
|
||||
<field name="long"/>
|
||||
<field name="width"/>
|
||||
<field name="height"/>
|
||||
<field name="remark"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -777,33 +777,11 @@ class ResProductMo(models.Model):
|
||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||
machining_drawings = fields.Binary('2D加工图纸', readonly=True)
|
||||
quality_standard = fields.Binary('质检标准', readonly=True)
|
||||
part_name = fields.Char(string='零件名称', compute='_compute_related_product', readonly=True, store=True)
|
||||
part_number = fields.Char(string='零件图号', compute='_compute_related_product', readonly=True, store=True)
|
||||
part_name = fields.Char(string='零件名称', readonly=True)
|
||||
part_number = fields.Char(string='零件图号', readonly=True)
|
||||
machining_drawings_name = fields.Char(string='零件图号名称', readonly=True)
|
||||
machining_drawings_mimetype = fields.Char(string='零件图号类型', readonly=True)
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_related_product(self):
|
||||
for record in self:
|
||||
if record.categ_id.name == '坯料':
|
||||
product_name = ''
|
||||
match = re.search(r'(S\d{5}-\d)', record.name)
|
||||
# 如果匹配成功,提取结果
|
||||
if match:
|
||||
product_name = match.group(0)
|
||||
sale_order_name = ''
|
||||
match_sale = re.search(r'S(\d+)', record.name)
|
||||
if match_sale:
|
||||
sale_order_name = match_sale.group(0)
|
||||
sale_order = self.env['sale.order'].sudo().search(
|
||||
[('name', '=', sale_order_name)])
|
||||
if sale_order:
|
||||
filtered_order_line = sale_order.order_line.filtered(
|
||||
lambda order_line: re.search(f'{product_name}$', order_line.product_id.name)
|
||||
)
|
||||
record.part_number = filtered_order_line.product_id.part_number if filtered_order_line else None
|
||||
record.part_name = filtered_order_line.product_id.part_name if filtered_order_line else None
|
||||
|
||||
@api.constrains('tool_length')
|
||||
def _check_tool_length_size(self):
|
||||
if self.tool_length > 1000000:
|
||||
|
||||
@@ -562,6 +562,18 @@ class StockPicking(models.Model):
|
||||
sale_order_id = fields.Many2one('sale.order', '销售单号', compute='_compute_move_ids', store=True)
|
||||
picking_type_sequence_code = fields.Char(related='picking_type_id.sequence_code')
|
||||
|
||||
part_numbers = fields.Char(string="零件图号", compute='_compute_part_info', store=True, index=True)
|
||||
part_names = fields.Char(string="零件名称", compute='_compute_part_info', store=True, index=True)
|
||||
|
||||
@api.depends('move_ids_without_package.part_number', 'move_ids_without_package.part_name')
|
||||
def _compute_part_info(self):
|
||||
for picking in self:
|
||||
# 聚合所有关联行的 part_number 和 part_name
|
||||
part_numbers = picking.move_ids_without_package.mapped('part_number')
|
||||
part_names = picking.move_ids_without_package.mapped('part_name')
|
||||
picking.part_numbers = ','.join(filter(None, part_numbers))
|
||||
picking.part_names = ','.join(filter(None, part_names))
|
||||
|
||||
@api.depends('move_ids', 'move_ids.product_id')
|
||||
def _compute_move_ids(self):
|
||||
for item in self:
|
||||
|
||||
@@ -68,14 +68,8 @@
|
||||
context="{'group_by': 'retrospect_ref'}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='picking_type_id']" position="after">
|
||||
<field name="product_id"
|
||||
string="零件图号"
|
||||
filter_domain="[('product_id.part_number', 'ilike', self)]"
|
||||
/>
|
||||
<field name="product_id"
|
||||
string="零件名称"
|
||||
filter_domain="[('product_id.part_name', 'ilike', self)]"
|
||||
/>
|
||||
<field name="part_numbers" string="零件图号" filter_domain="[('part_numbers', 'ilike', self)]"/>
|
||||
<field name="part_names" string="零件名称" filter_domain="[('part_names', 'ilike', self)]"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -97,7 +91,8 @@
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//form//button[@name='action_assign_serial_show_details']" position="after">
|
||||
<button name="button_update_the_sequence_number" type="object" class="btn-link" data-hotkey="k" title="Assign Serial Numbers">
|
||||
<button name="button_update_the_sequence_number" type="object" class="btn-link" data-hotkey="k"
|
||||
title="Assign Serial Numbers">
|
||||
<span>更新序列号</span>
|
||||
</button>
|
||||
</xpath>
|
||||
|
||||
@@ -3214,6 +3214,7 @@ class EmbryoRedundancySync(models.Model):
|
||||
embryo_redundancy.width = item['width']
|
||||
embryo_redundancy.height = item['height']
|
||||
embryo_redundancy.active = item['active']
|
||||
embryo_redundancy.remark = item['remark']
|
||||
else:
|
||||
self.env['sf.embryo.redundancy'].sudo().create({
|
||||
"name": item['name'],
|
||||
@@ -3222,4 +3223,5 @@ class EmbryoRedundancySync(models.Model):
|
||||
"width": item['width'],
|
||||
"height": item['height'],
|
||||
"active": item['active'],
|
||||
"remark": item['remark'],
|
||||
})
|
||||
Reference in New Issue
Block a user