Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/表面工艺外协修复

# Conflicts:
#	sf_sale/views/sale_order_view.xml
This commit is contained in:
jinling.yang
2024-05-17 11:00:58 +08:00
22 changed files with 254 additions and 66 deletions

View File

@@ -999,7 +999,6 @@ class CNCprocessing(models.Model):
def cnc_processing_create(self, cnc_workorder, ret, program_path, program_path_tmp):
cnc_processing = None
for obj in ret['programming_list']:
# 暂时不注释,批次插入不需要单个workorder
workorder = self.env['mrp.workorder'].search(
[('production_id.name', '=', cnc_workorder.name),
('processing_panel', '=', obj['processing_panel']),
@@ -1008,7 +1007,7 @@ class CNCprocessing(models.Model):
if obj['program_name'] in program_path:
logging.info('obj:%s' % obj['program_name'])
cnc_processing = self.env['sf.cnc.processing'].create({
# 'workorder_id': workorder.id,
'workorder_id': workorder.id,
'sequence_number': obj['sequence_number'],
'program_name': obj['program_name'],
'cutting_tool_name': obj['cutting_tool_name'],
@@ -1024,6 +1023,7 @@ class CNCprocessing(models.Model):
'program_path': program_path.replace('/tmp', '/home/ftp/ftp_root/NC')
})
cnc_processing.get_cnc_processing_file(program_path_tmp, cnc_processing, program_path)
cnc_workorder.write({'programming_state': '已编程', 'work_state': '已编程'})
return cnc_processing
def _json_cnc_processing(self, obj):

View File

@@ -471,6 +471,18 @@ class ProductionLot(models.Model):
# 'target': 'self',
# }
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get('rfid'):
lots = self.env['stock.lot'].search([('rfid', '=', vals['rfid'])])
if lots:
for lot in lots:
raise ValidationError('Rfid【%s】已被序列号为【%s】的【%s】产品占用!' % (
lot.rfid, lot.name, lot.product_id.name))
records = super(ProductionLot, self).create(vals_list)
return records
class StockPicking(models.Model):
_inherit = 'stock.picking'