From bf4add6b78f1a652d37f1f484a810a49bd2fbf74 Mon Sep 17 00:00:00 2001 From: guanhuan Date: Wed, 7 May 2025 16:02:39 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E9=87=87=E8=B4=AD=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_purchase_request/i18n/zh_CN.po | 2 +- .../wizard/purchase_request_line_make_purchase_order.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/jikimo_purchase_request/i18n/zh_CN.po b/jikimo_purchase_request/i18n/zh_CN.po index 6483fba9..5a43c3a2 100644 --- a/jikimo_purchase_request/i18n/zh_CN.po +++ b/jikimo_purchase_request/i18n/zh_CN.po @@ -1043,7 +1043,7 @@ msgstr "询价单" #. module: purchase_request #: model:ir.model.fields,field_description:purchase_request.field_purchase_request_line__purchased_qty msgid "RFQ/PO Qty" -msgstr "" +msgstr "已订购数" #. module: purchase_request #. odoo-python diff --git a/jikimo_purchase_request/wizard/purchase_request_line_make_purchase_order.py b/jikimo_purchase_request/wizard/purchase_request_line_make_purchase_order.py index 81722ec5..c1b79724 100644 --- a/jikimo_purchase_request/wizard/purchase_request_line_make_purchase_order.py +++ b/jikimo_purchase_request/wizard/purchase_request_line_make_purchase_order.py @@ -119,3 +119,10 @@ class PurchaseRequestLineMakePurchaseOrderItem(models.TransientModel): _inherit = "purchase.request.line.make.purchase.order.item" supply_method = fields.Selection(related='line_id.supply_method', string='供货方式') + + wiz_id = fields.Many2one( + comodel_name="purchase.request.line.make.purchase.order", + string="Wizard", + ondelete="cascade", + readonly=True, + ) From 95716c2e3e98a990d027960aec26c9ab53c791ff Mon Sep 17 00:00:00 2001 From: guanhuan Date: Wed, 7 May 2025 16:44:48 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E9=87=87=E8=B4=AD=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wizard/purchase_request_line_make_purchase_order.py | 1 + 1 file changed, 1 insertion(+) diff --git a/jikimo_purchase_request/wizard/purchase_request_line_make_purchase_order.py b/jikimo_purchase_request/wizard/purchase_request_line_make_purchase_order.py index c1b79724..9317ac33 100644 --- a/jikimo_purchase_request/wizard/purchase_request_line_make_purchase_order.py +++ b/jikimo_purchase_request/wizard/purchase_request_line_make_purchase_order.py @@ -123,6 +123,7 @@ class PurchaseRequestLineMakePurchaseOrderItem(models.TransientModel): wiz_id = fields.Many2one( comodel_name="purchase.request.line.make.purchase.order", string="Wizard", + required=False, ondelete="cascade", readonly=True, ) From 99237445ac78bead4caa681e0662edae7ebd8521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 8 May 2025 15:17:01 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=A8=E6=A3=80?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_quality/models/quality.py | 24 ++++++++++++++++++++++ sf_quality/views/quality_check_view.xml | 27 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/sf_quality/models/quality.py b/sf_quality/models/quality.py index 9d762e4e..8e2f388f 100644 --- a/sf_quality/models/quality.py +++ b/sf_quality/models/quality.py @@ -132,3 +132,27 @@ class QualityCheck(models.Model): return "零件特采发送成功" else: raise ValidationError("零件特采发送失败") + + + + @api.model_create_multi + def create(self, vals_list): + for val in vals_list: + if 'point_id' in val and 'measure_on' not in val: + # 如果没有控制方式字段,则从检查点读取质量方式 + point_id = self.env['quality.point'].browse(val['point_id']) + val.update({'measure_on': point_id.measure_on}) + return super(QualityCheck, self).create(vals_list) + + + @api.depends('move_line_id.qty_done', 'workorder_id.qty_produced') + def _compute_qty_line(self): + super(QualityCheck, self)._compute_qty_line() + for qc in self: + if not qc.move_line_id and qc.workorder_id: + qc.qty_line = qc.workorder_id.production_id.product_qty + + qty_line = fields.Float(store=True) + qty_test_failed = fields.Float('不合格数') + qty_to_test = fields.Float('应检', store=True) + qty_tested = fields.Float('已检') \ No newline at end of file diff --git a/sf_quality/views/quality_check_view.xml b/sf_quality/views/quality_check_view.xml index cadedc8e..6deb8eb9 100644 --- a/sf_quality/views/quality_check_view.xml +++ b/sf_quality/views/quality_check_view.xml @@ -88,6 +88,33 @@ + + + + \ No newline at end of file From aea158de4154eb87880d31f443b79603f08068c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 8 May 2025 20:32:59 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E8=B4=A8=E6=A3=80=E5=8D=95=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E7=BA=A6=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_quality/models/quality.py | 30 ++++++++++++++++++++++++- sf_quality/views/quality_check_view.xml | 4 +++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/sf_quality/models/quality.py b/sf_quality/models/quality.py index 8ef2e3a9..d05d2eaa 100644 --- a/sf_quality/models/quality.py +++ b/sf_quality/models/quality.py @@ -155,4 +155,32 @@ class QualityCheck(models.Model): qty_line = fields.Float('数量', store=True) qty_test_failed = fields.Float('不合格数') qty_to_test = fields.Float('应检', store=True) - qty_tested = fields.Float('已检') \ No newline at end of file + qty_tested = fields.Float('已检') + + @api.onchange('qty_line', 'qty_test_failed', 'qty_to_test', 'qty_tested') + def _onchage_qty(self): + for record in self: + if record.qty_line and record.qty_to_test and record.qty_to_test > record.qty_line: + record.qty_to_test = record.qty_line + return { + 'warning': { + 'title': '警告', + 'message': '待检数量不能超过总数量' + } + } + if record.qty_to_test and record.qty_tested and record.qty_tested > record.qty_to_test: + record.qty_tested = record.qty_to_test + return { + 'warning': { + 'title': '警告', + 'message': '已检数量不能超过待检数量' + } + } + if record.qty_tested and record.qty_test_failed and record.qty_test_failed > record.qty_tested: + record.qty_test_failed = record.qty_tested + return { + 'warning': { + 'title': '警告', + 'message': '不合格数量不能超过已检数量' + } + } \ No newline at end of file diff --git a/sf_quality/views/quality_check_view.xml b/sf_quality/views/quality_check_view.xml index 6deb8eb9..655cc498 100644 --- a/sf_quality/views/quality_check_view.xml +++ b/sf_quality/views/quality_check_view.xml @@ -96,6 +96,7 @@ 0 + 1 {'invisible': ['|', '&', ('move_line_id', '=', False), ('workorder_id', '=', False), '|', ('measure_on', '!=', 'move_line'), ('is_lot_tested_fractionally', '=', False)]} @@ -105,13 +106,14 @@ 0 + 1 From e5b730b2efcd82968858a46288a054bc3c5c1c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 8 May 2025 21:21:51 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E7=BA=BF=E4=B8=8B?= =?UTF-8?q?=E8=BF=94=E5=B7=A5=E5=9C=A8=E4=B8=8D=E9=80=89=E6=8B=A9=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=BC=96=E7=A8=8B=E6=97=B6=E5=A4=8D=E5=88=B6=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=E5=9B=BE=E7=BA=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_purchase_request/views/stock_picking_views.xml | 2 +- sf_manufacturing/wizard/rework_wizard.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/jikimo_purchase_request/views/stock_picking_views.xml b/jikimo_purchase_request/views/stock_picking_views.xml index 25c11a1b..b96aea0c 100644 --- a/jikimo_purchase_request/views/stock_picking_views.xml +++ b/jikimo_purchase_request/views/stock_picking_views.xml @@ -1,6 +1,6 @@ - + stock.pikcing.inherited.form.jikimo.purchase.request stock.picking diff --git a/sf_manufacturing/wizard/rework_wizard.py b/sf_manufacturing/wizard/rework_wizard.py index b6b657c1..cc3f5fb2 100644 --- a/sf_manufacturing/wizard/rework_wizard.py +++ b/sf_manufacturing/wizard/rework_wizard.py @@ -268,6 +268,8 @@ class ReworkWizard(models.TransientModel): 'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program( cnc_work.processing_panel, ret), 'cnc_worksheet': old_cnc_rework.cnc_worksheet}) + # 复制装夹图纸 + new_cnc_workorder.processing_drawing = old_cnc_rework.processing_drawing # ========== 处理装夹预调 【装夹图纸】 数据 ================ for new_pre_work in new_pre_workorder_ids: pre_rework = max(self.production_id.workorder_ids.filtered( From bacddd2ad86c21637391e263ff11d39f75b44f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Fri, 9 May 2025 08:47:33 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quality_control/wizard/quality_check_wizard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quality_control/wizard/quality_check_wizard.py b/quality_control/wizard/quality_check_wizard.py index f4297f47..4da51f4b 100644 --- a/quality_control/wizard/quality_check_wizard.py +++ b/quality_control/wizard/quality_check_wizard.py @@ -23,8 +23,8 @@ class QualityCheckWizard(models.TransientModel): lot_name = fields.Char(related='current_check_id.lot_name') lot_line_id = fields.Many2one(related='current_check_id.lot_line_id') qty_line = fields.Float(related='current_check_id.qty_line') - qty_to_test = fields.Float(related='current_check_id.qty_to_test') - qty_tested = fields.Float(related='current_check_id.qty_tested', readonly=False) + qty_to_test = fields.Float(related='current_check_id.qty_to_test', string='待检') + qty_tested = fields.Float(related='current_check_id.qty_tested', string='已检', readonly=False) measure = fields.Float(related='current_check_id.measure', readonly=False) measure_on = fields.Selection(related='current_check_id.measure_on') quality_state = fields.Selection(related='current_check_id.quality_state') From 18ae46207a272097d3523d22469440df5ccb084a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Fri, 9 May 2025 10:34:23 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=B4=A8=E6=A3=80?= =?UTF-8?q?=E5=8D=95=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quality_control/models/quality.py | 6 +-- sf_quality/models/quality.py | 49 +++++++++++++++------- sf_quality/views/quality_check_view.xml | 55 ++++++++++++++----------- 3 files changed, 67 insertions(+), 43 deletions(-) diff --git a/quality_control/models/quality.py b/quality_control/models/quality.py index 1ab0e862..dbf4f0b4 100644 --- a/quality_control/models/quality.py +++ b/quality_control/models/quality.py @@ -141,7 +141,7 @@ class QualityCheck(models.Model): # # 出厂检验报告编号 # report_number = fields.Char('出厂检验报告编号', compute='_compute_report_number', readonly=True) # 总数量,值为调拨单_产品明细_数量 - total_qty = fields.Char('总数量', compute='_compute_total_qty') + total_qty = fields.Char('总数量', compute='_compute_total_qty', store=True) column_nums = fields.Integer('测量值列数', default=1) @@ -153,9 +153,9 @@ class QualityCheck(models.Model): for move in record.picking_id.move_ids_without_package: if move.product_id == record.product_id: total_qty = int(move.product_uom_qty) - record.total_qty = total_qty if total_qty > 0 else '' + record.total_qty = total_qty if total_qty > 0 else 0 else: - record.total_qty = '' + record.total_qty = 0 # 检验数 check_qty = fields.Integer('检验数', default=lambda self: self._get_default_check_qty()) diff --git a/sf_quality/models/quality.py b/sf_quality/models/quality.py index d05d2eaa..19c845b3 100644 --- a/sf_quality/models/quality.py +++ b/sf_quality/models/quality.py @@ -5,6 +5,7 @@ from odoo import fields, models, api from odoo.exceptions import ValidationError from datetime import datetime from odoo.addons.sf_base.commons.common import Common +from odoo.tools import float_round class QualityCheck(models.Model): @@ -145,39 +146,55 @@ class QualityCheck(models.Model): return super(QualityCheck, self).create(vals_list) - @api.depends('move_line_id.qty_done', 'workorder_id.qty_produced') - def _compute_qty_line(self): - super(QualityCheck, self)._compute_qty_line() + @api.depends('total_qty','testing_percentage_within_lot', 'is_lot_tested_fractionally') + def _compute_workorder_qty_to_test(self): + for qc in self: + if qc.is_lot_tested_fractionally: + rounding = qc.product_id.uom_id.rounding if qc.product_id.uom_id else 0.01 + qc.workorder_qty_to_test = float_round(float(qc.total_qty) * qc.testing_percentage_within_lot / 100, + precision_rounding=rounding, rounding_method="UP") + else: + qc.workorder_qty_to_test = qc.total_qty + + @api.depends('picking_id', 'workorder_id') + def _compute_total_qty(self): + super(QualityCheck, self)._compute_total_qty() for qc in self: - if not qc.move_line_id and qc.workorder_id: - qc.qty_line = qc.workorder_id.production_id.product_qty + if not qc.picking_id and qc.workorder_id: + qc.total_qty = qc.workorder_id.production_id.product_qty - qty_line = fields.Float('数量', store=True) - qty_test_failed = fields.Float('不合格数') - qty_to_test = fields.Float('应检', store=True) - qty_tested = fields.Float('已检') + @api.depends('workorder_qty_to_test') + def _compute_workorder_qty_tested(self): + for qc in self: + qc.workorder_qty_tested = qc.workorder_qty_to_test - @api.onchange('qty_line', 'qty_test_failed', 'qty_to_test', 'qty_tested') + + workorder_qty_to_test = fields.Float('应检', compute='_compute_workorder_qty_to_test', store=True) + workorder_qty_tested = fields.Float('已检', compute='_compute_workorder_qty_tested', store=True) + workorder_qty_test_failed = fields.Float('不合格数') + + + @api.onchange('total_qty', 'workorder_qty_test_failed', 'workorder_qty_to_test', 'workorder_qty_tested') def _onchage_qty(self): for record in self: - if record.qty_line and record.qty_to_test and record.qty_to_test > record.qty_line: - record.qty_to_test = record.qty_line + if record.total_qty and record.workorder_qty_to_test and record.workorder_qty_to_test > float(record.total_qty): + record.workorder_qty_to_test = float(record.total_qty) return { 'warning': { 'title': '警告', 'message': '待检数量不能超过总数量' } } - if record.qty_to_test and record.qty_tested and record.qty_tested > record.qty_to_test: - record.qty_tested = record.qty_to_test + if record.workorder_qty_to_test and record.workorder_qty_tested and record.workorder_qty_tested > record.workorder_qty_to_test: + record.workorder_qty_tested = record.workorder_qty_to_test return { 'warning': { 'title': '警告', 'message': '已检数量不能超过待检数量' } } - if record.qty_tested and record.qty_test_failed and record.qty_test_failed > record.qty_tested: - record.qty_test_failed = record.qty_tested + if record.workorder_qty_tested and record.workorder_qty_test_failed and record.workorder_qty_test_failed > record.workorder_qty_tested: + record.workorder_qty_test_failed = record.workorder_qty_tested return { 'warning': { 'title': '警告', diff --git a/sf_quality/views/quality_check_view.xml b/sf_quality/views/quality_check_view.xml index 655cc498..69e1875f 100644 --- a/sf_quality/views/quality_check_view.xml +++ b/sf_quality/views/quality_check_view.xml @@ -88,34 +88,41 @@