From 102eaa7037066cfa289dca486367de6a59bb6253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Mon, 19 Jan 2026 14:32:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_official/models/yuthon_file_processing.py | 4 ++-- yuthon_official/models/yuthon_official.py | 5 ++--- yuthon_official/models/yuthon_official_labor.py | 4 ++-- yuthon_official/models/yuthon_official_party.py | 7 ++----- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/yuthon_official/models/yuthon_file_processing.py b/yuthon_official/models/yuthon_file_processing.py index 15d1435fb..4f0173119 100644 --- a/yuthon_official/models/yuthon_file_processing.py +++ b/yuthon_official/models/yuthon_file_processing.py @@ -99,7 +99,7 @@ class YuthonFileProcessing(models.Model): if not prefix: return # 构建查询条件:同公司 + 同一年份的文号 - year_str = f"【{current_year}】" + year_str = f"〔{current_year}〕" domain = [ ('company_id', '=', self.company_id.id), ('reference_cold', 'like', f"{prefix}{year_str}%") @@ -117,7 +117,7 @@ class YuthonFileProcessing(models.Model): next_seq = 1 else: next_seq = 1 - seq_str = f"{next_seq:03d}" + seq_str = f"{next_seq}" self.reference_cold = f"{prefix}{year_str}{seq_str}号" @api.onchange('is_issues') diff --git a/yuthon_official/models/yuthon_official.py b/yuthon_official/models/yuthon_official.py index af76bdfd7..9c72cb626 100644 --- a/yuthon_official/models/yuthon_official.py +++ b/yuthon_official/models/yuthon_official.py @@ -143,8 +143,7 @@ class YuthonOfficial(models.Model): prefix = prefix_map.get(company_name) if not prefix: return - # 构建查询条件:同公司 + 同一年份的文号 - year_str = f"【{current_year}】" + year_str = f"〔{current_year}〕" domain = [ ('company_id', '=', self.company_id1.id), ('reference_cold', 'like', f"{prefix}{year_str}%") @@ -162,7 +161,7 @@ class YuthonOfficial(models.Model): next_seq = 1 else: next_seq = 1 - seq_str = f"{next_seq:03d}" + seq_str = f"{next_seq}" self.reference_cold = f"{prefix}{year_str}{seq_str}号" def supervising_button(self): diff --git a/yuthon_official/models/yuthon_official_labor.py b/yuthon_official/models/yuthon_official_labor.py index 965b3fd1d..2ca609ffb 100644 --- a/yuthon_official/models/yuthon_official_labor.py +++ b/yuthon_official/models/yuthon_official_labor.py @@ -80,7 +80,7 @@ class YuthonOfficialLabor(models.Model): if not prefix: return # 构建查询条件:同公司 + 同一年份的文号 - year_str = f"【{current_year}】" + year_str = f"〔{current_year}〕" domain = [ ('company_id', '=', self.company_id.id), ('reference_cold', 'like', f"{prefix}{year_str}%") @@ -98,7 +98,7 @@ class YuthonOfficialLabor(models.Model): next_seq = 1 else: next_seq = 1 - seq_str = f"{next_seq:03d}" + seq_str = f"{next_seq}" self.reference_cold = f"{prefix}{year_str}{seq_str}号" @api.onchange('is_meet') diff --git a/yuthon_official/models/yuthon_official_party.py b/yuthon_official/models/yuthon_official_party.py index 8ad58c910..7fc49b0ba 100644 --- a/yuthon_official/models/yuthon_official_party.py +++ b/yuthon_official/models/yuthon_official_party.py @@ -83,17 +83,14 @@ class YuthonOfficialParty(models.Model): if not prefix: return # 构建查询条件:同公司 + 同一年份的文号 - year_str = f"【{current_year}】" + year_str = f"〔{current_year}〕" domain = [ ('company_id', '=', self.company_id.id), ('reference_cold', 'like', f"{prefix}{year_str}%") ] last_record = self.search(domain, order='reference_cold desc', limit=1) - # 计算下一个序号(格式化为3位数字:001、002...) if last_record and last_record.reference_cold: - # 从现有文号中提取数字部分(如从"穗天物【2025】003号"提取"003") try: - # 截取序号部分(假设格式固定为"前缀【年份】序号号") seq_str = last_record.reference_cold.split(year_str)[1].rsplit('号', 1)[0] last_seq = int(seq_str) next_seq = last_seq + 1 @@ -101,7 +98,7 @@ class YuthonOfficialParty(models.Model): next_seq = 1 else: next_seq = 1 - seq_str = f"{next_seq:03d}" + seq_str = f"{next_seq}" self.reference_cold = f"{prefix}{year_str}{seq_str}号" @api.onchange('is_meet')