diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py index 904aac56..936afaaf 100644 --- a/sf_manufacturing/__manifest__.py +++ b/sf_manufacturing/__manifest__.py @@ -40,6 +40,7 @@ 'views/res_config_settings_views.xml', 'views/sale_order_views.xml', 'views/mrp_workorder_batch_replan.xml', + 'views/purchase_order_view.xml', ], 'assets': { diff --git a/sf_manufacturing/models/__init__.py b/sf_manufacturing/models/__init__.py index 9f77d841..c4d8ad94 100644 --- a/sf_manufacturing/models/__init__.py +++ b/sf_manufacturing/models/__init__.py @@ -15,3 +15,4 @@ from . import sf_technology_design from . import sf_production_common from . import sale_order from . import quick_easy_order +from . import purchase_order \ No newline at end of file diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 460fd994..4b927596 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -774,11 +774,10 @@ class ResProductMo(models.Model): # bfm下单 manual_quotation = fields.Boolean('人工编程', default=False, readonly=True) - part_number = fields.Char(string='零件图号', readonly=True) machining_drawings = fields.Binary('2D加工图纸', readonly=True) quality_standard = fields.Binary('质检标准', readonly=True) part_name = fields.Char(string='零件名称', readonly=True) - + part_number = fields.Char(string='零件图号', readonly=True) @api.constrains('tool_length') def _check_tool_length_size(self): if self.tool_length > 1000000: @@ -892,7 +891,7 @@ class ResProductMo(models.Model): 'machining_drawings': '' if not item['machining_drawings'] else base64.b64decode( item['machining_drawings']), 'quality_standard': '' if not item['quality_standard'] else base64.b64decode(item['quality_standard']), - 'part_name': item['part_name'], + 'part_name': item.get('part_name') or '', } tax_id = self.env['account.tax'].sudo().search( [('type_tax_use', '=', 'sale'), ('amount', '=', item.get('tax')), ('price_include', '=', 'True')]) diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py new file mode 100644 index 00000000..52095fc7 --- /dev/null +++ b/sf_manufacturing/models/purchase_order.py @@ -0,0 +1,7 @@ +import logging +from odoo import models, fields, api + +_logger = logging.getLogger(__name__) +class PurchaseOrderLine(models.Model): + _inherit = 'purchase.order.line' + part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True) diff --git a/sf_manufacturing/models/sale_order.py b/sf_manufacturing/models/sale_order.py index 5d318141..e31faf1c 100644 --- a/sf_manufacturing/models/sale_order.py +++ b/sf_manufacturing/models/sale_order.py @@ -152,7 +152,7 @@ class SaleOrder(models.Model): class SaleOrderLine(models.Model): _inherit = 'sale.order.line' - + part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True) # 供货方式 supply_method = fields.Selection([ ('automation', "自动化产线加工"), diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index d08ff81f..c9856cb8 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -18,9 +18,12 @@ + + + + + diff --git a/sf_manufacturing/views/purchase_order_view.xml b/sf_manufacturing/views/purchase_order_view.xml new file mode 100644 index 00000000..5fbd7bd1 --- /dev/null +++ b/sf_manufacturing/views/purchase_order_view.xml @@ -0,0 +1,15 @@ + + + + + purchase.order.form.inherit.sf + purchase.order + + + + + + + + + \ No newline at end of file diff --git a/sf_manufacturing/views/sale_order_views.xml b/sf_manufacturing/views/sale_order_views.xml index 49cc752f..8e1d1061 100644 --- a/sf_manufacturing/views/sale_order_views.xml +++ b/sf_manufacturing/views/sale_order_views.xml @@ -18,6 +18,10 @@ + + + + {'invisible': [('state', '!=', 'draft')]} diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py index 6ee1d3ee..5f4003da 100644 --- a/sf_plan/models/custom_plan.py +++ b/sf_plan/models/custom_plan.py @@ -13,7 +13,8 @@ class sf_production_plan(models.Model): _description = 'sf_production_plan' _inherit = ['mail.thread'] # _order = 'state desc, write_date desc' - + part_name = fields.Char('零件名称', related='product_id.part_name', readonly=True) + part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True) state = fields.Selection([ ('draft', '待排程'), ('done', '已排程'), diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml index 47e1dd54..09bd790c 100644 --- a/sf_plan/views/view.xml +++ b/sf_plan/views/view.xml @@ -17,6 +17,8 @@ decoration-danger="state == 'finished'"/> + + diff --git a/sf_quality/views/quality_cnc_test_view.xml b/sf_quality/views/quality_cnc_test_view.xml index 29cab866..d2d37686 100644 --- a/sf_quality/views/quality_cnc_test_view.xml +++ b/sf_quality/views/quality_cnc_test_view.xml @@ -18,7 +18,8 @@ - + +