From b188c8adfeaf5e4f46a0f50bc7d898a6bb418853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Wed, 11 Sep 2024 09:14:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=82=E5=B8=B8=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wizard/workpiece_delivery_wizard.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sf_manufacturing/wizard/workpiece_delivery_wizard.py b/sf_manufacturing/wizard/workpiece_delivery_wizard.py index a84612ff..4ee0928c 100644 --- a/sf_manufacturing/wizard/workpiece_delivery_wizard.py +++ b/sf_manufacturing/wizard/workpiece_delivery_wizard.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- # Part of YiZuo. See LICENSE file for full copyright and licensing details. -import json import logging -from odoo.exceptions import UserError, ValidationError from datetime import datetime, date +from odoo.exceptions import UserError from odoo import models, api, fields @@ -79,12 +78,13 @@ class WorkpieceDeliveryWizard(models.TransientModel): 'tag': 'display_notification', 'target': 'new', 'params': { - 'message': '任务下发成功!AGV任务调度编号为【%s】' % scheduling['name'], + 'message': f'任务下发成功!AGV任务调度编号为【{scheduling["name"]}】', 'type': 'success', 'sticky': False, 'next': {'type': 'ir.actions.act_window_close'}, } } + def confirm(self): try: if not self.workorder_ids: @@ -123,15 +123,15 @@ class WorkpieceDeliveryWizard(models.TransientModel): 'tag': 'display_notification', 'target': 'new', 'params': { - 'message': '任务下发成功!AGV任务调度编号为【%s】' % scheduling.name, + 'message': f'任务下发成功!AGV任务调度编号为【{scheduling.name}】', 'type': 'success', 'sticky': False, 'next': {'type': 'ir.actions.act_window_close'}, } } except Exception as e: - logging.info('%s任务下发失败:%s' % (self.delivery_type, e)) - raise UserError('%s任务下发失败:%s' % (self.delivery_type, e)) + logging.info('%s任务下发失败:%s', self.delivery_type, e) + raise UserError(f'{self.delivery_type}任务下发失败:{e}') from e # def recognize_production(self): # # production_ids = [] @@ -208,7 +208,7 @@ class WorkpieceDeliveryWizard(models.TransientModel): if workorder: if (len(self.production_ids) > 0 and workorder.production_line_id.id != self.production_ids[0].production_line_id.id): - raise UserError('该rfid对应的制造订单号为%s的目的生产线不一致' % workorder.production_id.name) + raise UserError(f'该rfid对应的制造订单号为{workorder.production_id.name}的目的生产线不一致') # 将对象添加到对应的同模型且是多对多类型里 self.production_ids |= workorder.production_id @@ -220,7 +220,7 @@ class WorkpieceDeliveryWizard(models.TransientModel): self.feeder_station_start_id = down_product_agv_scheduling.end_site_id.id else: if self.feeder_station_start_id.id != down_product_agv_scheduling.end_site_id.id: - raise UserError('该rfid不在%s接驳站内', self.feeder_station_start_id.name) + raise UserError(f'该rfid不在{self.feeder_station_start_id.name}接驳站内') else: raise UserError('该rfid码对应的工单不存在')