diff --git a/quality_control/models/quality.py b/quality_control/models/quality.py index ebe73384..f2444024 100644 --- a/quality_control/models/quality.py +++ b/quality_control/models/quality.py @@ -7,6 +7,7 @@ from datetime import datetime import random from odoo import api, models, fields, _ +from odoo.api import depends from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT, float_round from odoo.osv.expression import OR @@ -122,7 +123,13 @@ class QualityPoint(models.Model): class QualityCheck(models.Model): _inherit = "quality.check" - + part_name = fields.Char('零件名称', compute='_compute_part_name_number', readonly=True) + part_number = fields.Char('零件图号', compute='_compute_part_name_number', readonly=True) + @depends('product_id') + def _compute_part_name_number(self): + for record in self: + record.part_number = record.product_id.part_number + record.part_name = record.product_id.part_name failure_message = fields.Html(related='point_id.failure_message', readonly=True) measure = fields.Float('Measure', default=0.0, digits='Quality Tests', tracking=True) measure_success = fields.Selection([ diff --git a/quality_control/views/quality_views.xml b/quality_control/views/quality_views.xml index 8e5af75a..f4f05420 100644 --- a/quality_control/views/quality_views.xml +++ b/quality_control/views/quality_views.xml @@ -389,6 +389,8 @@ + + diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py index 1ffed728..607f64d1 100644 --- a/sf_manufacturing/models/purchase_order.py +++ b/sf_manufacturing/models/purchase_order.py @@ -31,3 +31,13 @@ class PurchaseOrder(models.Model): class PurchaseOrderLine(models.Model): _inherit = 'purchase.order.line' part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True) + related_product = fields.Many2one('product.product',compute='_compute_related_product', string='关联产品',help='经此产品工艺加工成的成品') + @api.depends('order_id.origin') + def _compute_related_product(self): + for record in self: + if record.product_id.detailed_type: + production_id = self.env['mrp.production'].search([('name', '=', record.order_id.origin)]) + record.related_product = production_id.product_id if production_id else False + else: + record.related_product = False + diff --git a/sf_manufacturing/models/sf_technology_design.py b/sf_manufacturing/models/sf_technology_design.py index 02b844be..15d2c22d 100644 --- a/sf_manufacturing/models/sf_technology_design.py +++ b/sf_manufacturing/models/sf_technology_design.py @@ -99,6 +99,7 @@ class sf_technology_design(models.Model): if not production_technology_designs_dict.get(technology_design.group_uniq_id): technology_design = technology_design.get_technology_design() technology_design.update({'production_id': production_id}) + technology_design.pop('group_uniq_id') self.env['sf.technology.design'].create(technology_design) diff --git a/sf_manufacturing/views/purchase_order_view.xml b/sf_manufacturing/views/purchase_order_view.xml index 5fbd7bd1..af1efcfc 100644 --- a/sf_manufacturing/views/purchase_order_view.xml +++ b/sf_manufacturing/views/purchase_order_view.xml @@ -7,6 +7,7 @@ + diff --git a/sf_quality/models/quality_cnc_test.py b/sf_quality/models/quality_cnc_test.py index 6f9d1c61..9c73715d 100644 --- a/sf_quality/models/quality_cnc_test.py +++ b/sf_quality/models/quality_cnc_test.py @@ -16,7 +16,7 @@ class SfQualityCncTest(models.Model): equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备') production_line_id = fields.Many2one(related='workorder_id.production_line_id', string='生产线') - part_number = fields.Char(related='workorder_id.part_number', string='成品零件图号') + part_number = fields.Char(related='workorder_id.part_number', string='零件图号') detection_report = fields.Binary(related='workorder_id.detection_report', readonly=True, string='检测报告') state = fields.Selection([ ('waiting', '待判定'),