Accept Merge Request #1717: (feature/报废优化 -> develop)
Merge Request: 报废解绑rfid Created By: @管欢 Reviewed By: @胡尧 Approved By: @胡尧 Accepted By: @管欢 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1717
This commit is contained in:
@@ -1189,7 +1189,8 @@ class MrpProduction(models.Model):
|
||||
'res_model': 'sf.production.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'default_mrp_production_id': self.id,
|
||||
'is_remanufacture_flag': True,
|
||||
'default_reprogramming_num': cloud_programming['reprogramming_num'],
|
||||
'default_programming_states': cloud_programming['programming_state'],
|
||||
'default_is_reprogramming': True if cloud_programming['programming_state'] in ['已下发'] else False
|
||||
@@ -1348,10 +1349,6 @@ class MrpProduction(models.Model):
|
||||
if self.is_scrap is True:
|
||||
procurement_requests = []
|
||||
sale_order = self.env['sale.order'].sudo().search([('name', '=', self.origin)])
|
||||
values = self.env['mrp.production'].create_production1_values(self)
|
||||
# productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(
|
||||
# self.company_id).create(
|
||||
# values)
|
||||
# 查询出库移动记录
|
||||
out_picking = self.env['stock.picking'].search(
|
||||
[('origin', '=', sale_order.name), ('name', 'ilike', 'WH/OUT/')])
|
||||
@@ -1375,31 +1372,14 @@ class MrpProduction(models.Model):
|
||||
productions = self.env['mrp.production'].sudo().search(
|
||||
[('origin', '=', self.origin)], order='id desc', limit=1)
|
||||
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
|
||||
move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc')
|
||||
for mo in move:
|
||||
domain = []
|
||||
if mo.location_id.barcode == 'WH-POSTPRODUCTION' and mo.rule_id.picking_type_id.barcode == 'PC':
|
||||
domain = [('barcode', '=', 'WH-PC'), ('sequence_code', '=', 'PC')]
|
||||
elif mo.location_id.barcode == 'PL' and mo.rule_id.picking_type_id.barcode == 'INT':
|
||||
domain = [('barcode', '=', 'WH-INTERNAL'), ('sequence_code', '=', 'INT')]
|
||||
if domain:
|
||||
picking_type = self.env['stock.picking.type'].search(domain)
|
||||
mo.write({'picking_type_id': picking_type.id})
|
||||
mo._assign_picking()
|
||||
else:
|
||||
if mo.reference != productions.name:
|
||||
mo.reference = productions.name
|
||||
if mo.production_id:
|
||||
if mo.production_id != productions:
|
||||
mo.production_id = False
|
||||
mo_move = self.env['stock.move'].search(
|
||||
[('origin', '=', sale_order.name), ('reference', 'ilike', 'WH/MO/')])
|
||||
if mo_move:
|
||||
sfp_move = self.env['stock.move'].search(
|
||||
[('origin', '=', sale_order.name), ('reference', 'ilike', 'WH/SFP/')], limit=1)
|
||||
mo_move.write({'reference': sfp_move.reference, 'partner_id': sfp_move.partner_id.id,
|
||||
'picking_id': sfp_move.picking_id.id, 'picking_type_id': sfp_move.picking_type_id.id,
|
||||
'production_id': False})
|
||||
# mo_move = self.env['stock.move'].search(
|
||||
# [('origin', '=', sale_order.name), ('reference', 'ilike', 'WH/MO/')])
|
||||
# if mo_move:
|
||||
# sfp_move = self.env['stock.move'].search(
|
||||
# [('origin', '=', sale_order.name), ('reference', 'ilike', 'WH/SFP/')], limit=1)
|
||||
# mo_move.write({'reference': sfp_move.reference, 'partner_id': sfp_move.partner_id.id,
|
||||
# 'picking_id': sfp_move.picking_id.id, 'picking_type_id': sfp_move.picking_type_id.id,
|
||||
# 'production_id': False})
|
||||
# productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
||||
# {'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
||||
stock_picking_remanufacture = self.env['stock.picking'].search([('origin', '=', productions.name)])
|
||||
@@ -1540,7 +1520,7 @@ class MrpProduction(models.Model):
|
||||
@api.depends('procurement_group_id', 'procurement_group_id.stock_move_ids.group_id')
|
||||
def _compute_picking_ids(self):
|
||||
for order in self:
|
||||
if order.product_id.product_tmpl_id.single_manufacturing == True:
|
||||
if order.product_id.product_tmpl_id.single_manufacturing == True and not order.is_remanufacture:
|
||||
first_order = self.env['mrp.production'].search(
|
||||
[('origin', '=', order.origin), ('product_id', '=', order.product_id.id)], limit=1, order='id asc')
|
||||
order.picking_ids = self.env['stock.picking'].search([
|
||||
|
||||
@@ -130,7 +130,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
Y10_axis = fields.Float(default=0)
|
||||
Z10_axis = fields.Float(default=0)
|
||||
X_deviation_angle = fields.Integer(string="X轴偏差度", default=0)
|
||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], default='合格',
|
||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格',
|
||||
string="检测结果", tracking=True)
|
||||
cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工程序")
|
||||
cmm_ids = fields.One2many("sf.cmm.program", 'workorder_id', string="CMM程序")
|
||||
|
||||
@@ -1031,12 +1031,7 @@ class ReStockMove(models.Model):
|
||||
"""
|
||||
res = super(ReStockMove, self)._get_new_picking_values()
|
||||
## 制造订单报废生成的新制造订单不走合并
|
||||
production_remanufacture = None
|
||||
if 'origin' in res:
|
||||
if self.picking_type_id.name in ['生产发料', '内部调拨']:
|
||||
production_remanufacture = self.env['mrp.production'].search(
|
||||
[('name', '=', res['origin']), ('is_remanufacture', '=', True)])
|
||||
if not production_remanufacture:
|
||||
if not self.env.context.get('is_remanufacture_flag'):
|
||||
if self[0].origin and self.picking_type_id.name in ['生产发料', '内部调拨']:
|
||||
production = self.env['mrp.production'].search([('name', '=', self[0].origin)], limit=1, order='id asc')
|
||||
productions = self.env['mrp.production'].search(
|
||||
|
||||
Reference in New Issue
Block a user