From 71cbd7ac36f953cbfe141051439f5cd698786692 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Mon, 17 Feb 2025 17:15:30 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E7=94=B1=E8=B4=A8?= =?UTF-8?q?=E6=A3=80=E8=BF=94=E5=B7=A5=E7=94=9F=E6=88=90=E7=9A=84=E5=88=B6?= =?UTF-8?q?=E9=80=A0=E8=AE=A2=E5=8D=95=E6=A3=80=E6=B5=8B=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=85=A8=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9B2=E3=80=81=20=E5=8F=91=E7=A5=A8=E8=B4=A6=E5=8D=95?= =?UTF-8?q?=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5=E5=8F=8A=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_account_process/__manifest__.py | 2 +- jikimo_account_process/models/account_move.py | 10 +++++++++- sf_quality/models/quality.py | 11 +++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/jikimo_account_process/__manifest__.py b/jikimo_account_process/__manifest__.py index 0c1b521c..637e74b0 100644 --- a/jikimo_account_process/__manifest__.py +++ b/jikimo_account_process/__manifest__.py @@ -20,7 +20,7 @@ 'version': '0.1', # any module necessary for this one to work correctly - 'depends': ['base', 'account'], + 'depends': ['base', 'account', 'l10n_cn'], # always loaded 'data': [ diff --git a/jikimo_account_process/models/account_move.py b/jikimo_account_process/models/account_move.py index e85d4e16..94242570 100644 --- a/jikimo_account_process/models/account_move.py +++ b/jikimo_account_process/models/account_move.py @@ -1,4 +1,4 @@ -from odoo import models, fields, api +from odoo import models, fields, api, _ from odoo.exceptions import ValidationError @@ -7,6 +7,14 @@ class CustomAccountMoveLine(models.Model): _inherit = 'account.move' _description = "account move line" + fapiao = fields.Char(string='发票号', size=20, copy=False, tracking=True, required=True) + + @api.constrains('fapiao') + def _check_fapiao(self): + for record in self: + if record.fapiao and (len(record.fapiao) != 20 or not record.fapiao.isdecimal()): + raise ValidationError(_("Fapiao number is an 20-digit number. Please enter a correct one.")) + @api.model_create_multi def create(self, vals): for val in vals: diff --git a/sf_quality/models/quality.py b/sf_quality/models/quality.py index 80fe2f46..272a3e8a 100644 --- a/sf_quality/models/quality.py +++ b/sf_quality/models/quality.py @@ -86,15 +86,14 @@ class QualityCheck(models.Model): raise ValidationError('请重新选择【判定结果】-【检测结果】') if self.workorder_id.routing_type != 'CNC加工' and self.workorder_id.individuation_page_PTD is False: self.workorder_id.production_id.write({'detection_result_ids': [(0, 0, { - 'rework_reason': self.workorder_id.reason, - 'detailed_reason': self.workorder_id.detailed_reason, + 'rework_reason': self.reason, + 'detailed_reason': self.detailed_reason, 'processing_panel': self.workorder_id.processing_panel, 'routing_type': self.workorder_id.routing_type, - 'handle_result': '待处理' if (self.workorder_id.test_results in ['返工', '报废'] - or self.workorder_id.is_rework is True) else '', - 'test_results': self.workorder_id.test_results, + 'handle_result': '待处理', + 'test_results': self.test_results, 'test_report': self.workorder_id.detection_report})], - 'is_scrap': True if self.workorder_id.test_results == '报废' else False + 'is_scrap': True if self.test_results == '报废' else False }) if self.workorder_id.state not in ['done']: self.workorder_id.write(