Accept Merge Request #1663: (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/1663
This commit is contained in:
@@ -159,6 +159,34 @@ class QualityCheck(models.Model):
|
||||
is_lot_tested_fractionally = fields.Boolean(related='point_id.is_lot_tested_fractionally')
|
||||
testing_percentage_within_lot = fields.Float(related="point_id.testing_percentage_within_lot")
|
||||
product_tracking = fields.Selection(related='product_id.tracking')
|
||||
quality_check_type = fields.Selection([
|
||||
('采购入库检', '采购入库检'),
|
||||
('客供料入库检', '客供料入库检'),
|
||||
('退货入库检', '退货入库检'),
|
||||
('生产入库检', '生产入库检'),
|
||||
('外协入库检', '外协入库检'),
|
||||
('成品发货检', '成品发货检'),
|
||||
('工序外协发货检', '工序外协发货检'),
|
||||
('委外坯料发货检', '委外坯料发货检')], string='类型', compute='_compute_quality_check_type', store=True)
|
||||
|
||||
@api.depends('picking_id')
|
||||
def _compute_quality_check_type(self):
|
||||
for check in self:
|
||||
if check.picking_id:
|
||||
picking_type = check.picking_id.picking_type_id.sequence_code
|
||||
type_mapping = {
|
||||
'IN': '采购入库检',
|
||||
'DL': '客供料入库检',
|
||||
'RET': '退货入库检',
|
||||
'SFP': '生产入库检',
|
||||
'OCIN': '外协入库检',
|
||||
'OUT': '成品发货检',
|
||||
'OCOUT': '工序外协发货检',
|
||||
'RES': '委外坯料发货检',
|
||||
}
|
||||
check.quality_check_type = type_mapping.get(picking_type, False)
|
||||
else:
|
||||
check.quality_check_type = False
|
||||
|
||||
@api.depends('measure_success')
|
||||
def _compute_warning_message(self):
|
||||
@@ -301,6 +329,19 @@ class QualityAlert(models.Model):
|
||||
_inherit = "quality.alert"
|
||||
|
||||
title = fields.Char('Title')
|
||||
part_number = fields.Char(string='零件图号', compute='_compute_part_info', store=True)
|
||||
part_name = fields.Char(string='零件名称', compute='_compute_part_info', store=True)
|
||||
|
||||
@api.depends('product_id', 'picking_id')
|
||||
def _compute_part_info(self):
|
||||
for alert in self:
|
||||
if alert.product_tmpl_id.categ_id.name == '成品':
|
||||
alert.part_number = alert.product_id.part_number
|
||||
alert.part_name = alert.product_id.part_name
|
||||
elif alert.product_id.categ_id.name == '坯料':
|
||||
if alert.picking_id.move_ids_without_package:
|
||||
alert.part_number = alert.picking_id.move_ids_without_package[0].part_number
|
||||
alert.part_name = alert.picking_id.move_ids_without_package[0].part_name
|
||||
|
||||
def action_see_check(self):
|
||||
return {
|
||||
|
||||
@@ -90,6 +90,8 @@
|
||||
<field name="lot_id" context="{'default_product_id': product_id}"
|
||||
groups="stock.group_production_lot"/>
|
||||
<field name="picking_id"/>
|
||||
<field name="part_name"/>
|
||||
<field name="part_number"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="team_id"/>
|
||||
@@ -150,6 +152,10 @@
|
||||
<field name="date_assign" position="after">
|
||||
<field name="company_id" groups="base.main_company"/>
|
||||
</field>
|
||||
<field name="product_tmpl_id" position="after">
|
||||
<field name="part_name" optional="show"/>
|
||||
<field name="part_number" optional="show"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -448,6 +454,10 @@
|
||||
<filter string="Control Point" name="groupby_point_id" context="{'group_by': 'point_id'}"/>
|
||||
<filter string="Team" name="groupby_team_id" context="{'group_by': 'team_id'}"/>
|
||||
</group>
|
||||
<searchpanel>
|
||||
<field name="quality_check_type" icon="fa-filter" enable_counters="1"/>
|
||||
<field name="quality_state" icon="fa-filter" enable_counters="1"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
# 只有它被屏蔽了
|
||||
# 'views/SfWorkOrderBarcodes.xml',
|
||||
'views/WorkCenterBarcodes.xml',
|
||||
'views/Stock_picking_Barcodes.xml',
|
||||
# 'views/Stock_picking_Barcodes.xml',
|
||||
'views/machine_monitor.xml',
|
||||
'views/machine_info_present.xml',
|
||||
'views/delivery_record.xml',
|
||||
|
||||
@@ -588,40 +588,33 @@ class StockPicking(models.Model):
|
||||
address_of_delivery = fields.Char('联系地址', compute='_compute_move_ids', store=True)
|
||||
|
||||
retrospect_ref = fields.Char('追溯参考', compute='_compute_move_ids', store=True)
|
||||
|
||||
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')
|
||||
|
||||
@api.depends('move_ids', 'move_ids.product_id')
|
||||
def _compute_move_ids(self):
|
||||
for item in self:
|
||||
if item.move_ids:
|
||||
if item.picking_type_id.sequence_code == 'DL':
|
||||
sale_name = item.move_ids[0].product_id.name.split('-')[1]
|
||||
if 'S' in sale_name:
|
||||
sale_id = self.env['sale.order'].sudo().search([('name', '=', sale_name)])
|
||||
item.person_of_delivery = sale_id.person_of_delivery
|
||||
item.telephone_of_delivery = sale_id.telephone_of_delivery
|
||||
item.address_of_delivery = sale_id.address_of_delivery
|
||||
product_id = item.move_ids[0].product_id
|
||||
if product_id:
|
||||
sale_info = None
|
||||
if product_id.categ_id.type == '坯料' and product_id.name.startswith('R-S'):
|
||||
parts = product_id.name.split('-')
|
||||
if len(parts) >= 3:
|
||||
sale_name = parts[1]
|
||||
sale_info = self.env['sale.order'].sudo().search(
|
||||
[('name', '=', sale_name)])
|
||||
else:
|
||||
raise ValidationError('坯料名称格式错误,正确格式为[R-S???-?]!!!')
|
||||
move_ids = []
|
||||
for move_id in item.move_ids:
|
||||
move_ids.append(move_id.product_id.id)
|
||||
boms = self.env['mrp.bom'].sudo().search([('bom_line_ids.product_id', 'in', move_ids)])
|
||||
if boms:
|
||||
codes_list = []
|
||||
for bom in boms:
|
||||
if bom.product_tmpl_id.default_code:
|
||||
code_list = bom.product_tmpl_id.default_code.split('-')
|
||||
if len(code_list) >= 4:
|
||||
code = '-'.join(code_list[:4])
|
||||
if code not in codes_list:
|
||||
codes_list.append(code)
|
||||
else:
|
||||
raise ValidationError('坯料成品的内部参考值格式错误')
|
||||
item.retrospect_ref = ','.join(codes_list)
|
||||
elif item.picking_type_id.sequence_code in ['INT', 'PC']:
|
||||
pass
|
||||
production_list = self.env['mrp.production'].sudo().search(
|
||||
[('product_id', '=', product_id.id)])
|
||||
if production_list:
|
||||
sale_info = production_list[0].sale_order_id
|
||||
if sale_info:
|
||||
item.sale_order_id = sale_info.id
|
||||
if item.picking_type_id.sequence_code == 'DL':
|
||||
item.person_of_delivery = sale_info.person_of_delivery
|
||||
item.telephone_of_delivery = sale_info.telephone_of_delivery
|
||||
item.address_of_delivery = sale_info.address_of_delivery
|
||||
|
||||
# 设置外协出入单的名称
|
||||
def _get_name_Res(self, rescode):
|
||||
@@ -733,6 +726,34 @@ class ReStockMove(models.Model):
|
||||
materiel_length = fields.Float(string='物料长度', digits=(16, 4))
|
||||
materiel_width = fields.Float(string='物料宽度', digits=(16, 4))
|
||||
materiel_height = fields.Float(string='物料高度', digits=(16, 4))
|
||||
part_number = fields.Char(string='零件图号', compute='_compute_part_info', store=True)
|
||||
part_name = fields.Char(string='零件名称', compute='_compute_part_info', store=True)
|
||||
|
||||
@api.depends('product_id')
|
||||
def _compute_part_info(self):
|
||||
for move in self:
|
||||
if move.product_id.categ_id.type == '成品':
|
||||
move.part_number = move.product_id.part_number
|
||||
move.part_name = move.product_id.part_name
|
||||
elif move.product_id.categ_id.type == '坯料':
|
||||
if move.origin:
|
||||
origin = move.origin.split(',')[0] if ',' in move.origin else move.origin
|
||||
mrp_productio_info = self.env['mrp.production'].sudo().search(
|
||||
[('name', '=', origin)])
|
||||
if mrp_productio_info:
|
||||
move.part_number = mrp_productio_info.part_number
|
||||
move.part_name = mrp_productio_info.part_name
|
||||
else:
|
||||
purchase_order_info = self.env['purchase.order'].sudo().search(
|
||||
[('name', '=', origin)])
|
||||
if purchase_order_info:
|
||||
mrp_production_ids = purchase_order_info._get_mrp_productions().ids
|
||||
if mrp_production_ids:
|
||||
mrp_productio_info = self.env['mrp.production'].sudo().search(
|
||||
[('id', '=', mrp_production_ids[0])])
|
||||
if mrp_productio_info:
|
||||
move.part_number = mrp_productio_info.part_number
|
||||
move.part_name = mrp_productio_info.part_name
|
||||
|
||||
def _get_stock_move_values_Res(self, item, picking_type_id, group_id, move_dest_ids=False):
|
||||
route_id = self.env.ref('sf_manufacturing.route_surface_technology_outsourcing').id
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='origin']" position="after">
|
||||
<field name="sale_order_id"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='user_id']" position="after">
|
||||
<field name="picking_type_sequence_code" invisible="1"/>
|
||||
<field name="retrospect_ref"
|
||||
@@ -26,6 +29,10 @@
|
||||
attrs="{'invisible':[('picking_type_sequence_code','!=','DL')]}"/>
|
||||
<field name="address_of_delivery" attrs="{'invisible':[('picking_type_sequence_code','!=','DL')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='product_id']" position="after">
|
||||
<field name="part_number" optional="show"/>
|
||||
<field name="part_name" optional="show"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -34,6 +41,9 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.vpicktree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='origin']" position="before">
|
||||
<field name="sale_order_id" string="销售单号"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='origin']" position="after">
|
||||
<field name="retrospect_ref"/>
|
||||
</xpath>
|
||||
@@ -45,8 +55,13 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_internal_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='name']" position="replace">
|
||||
<field name="name"/>
|
||||
<field name="retrospect_ref"/>
|
||||
<field name="sale_order_id" string="销售单号"/>
|
||||
</xpath>
|
||||
<xpath expr="//filter[@name='picking_type']" position="after">
|
||||
<filter string="追溯参考" name="retrospect_ref" domain="[]"
|
||||
<filter string="追溯参考" name="retrospect" domain="[]"
|
||||
context="{'group_by': 'retrospect_ref'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -1122,7 +1122,7 @@ class SfPickingType(models.Model):
|
||||
if not self.env.user.has_group('base.group_system'):
|
||||
action['context']['create'] = False
|
||||
if self.sequence_code in ['DL', 'INT', 'PC']:
|
||||
action['context']['search_default_retrospect_ref'] = 1
|
||||
action['context']['search_default_retrospect'] = 1
|
||||
return action
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user