From 211d74d9fff212fc319e7003ac2f1861f06487ff Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Wed, 6 Nov 2024 17:24:10 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=20=20=E5=AE=A2=E4=BE=9B?=
=?UTF-8?q?=E6=96=99=E5=85=A5=E5=BA=93=E5=8D=95=E4=BC=98=E5=8C=96=20=20?=
=?UTF-8?q?=E9=9C=80=E6=B1=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_bf_connect/views/view.xml | 2 +-
sf_manufacturing/__manifest__.py | 1 +
sf_manufacturing/models/product_template.py | 4 +-
sf_manufacturing/models/stock.py | 31 +++++++++++
sf_manufacturing/views/stock_picking_view.xml | 51 +++++++++++++++----
sf_sale/models/sale_order.py | 6 +--
sf_sale/views/sale_order_view.xml | 6 +--
sf_warehouse/models/model.py | 2 +
8 files changed, 83 insertions(+), 20 deletions(-)
diff --git a/sf_bf_connect/views/view.xml b/sf_bf_connect/views/view.xml
index 184d0e71..f4245343 100644
--- a/sf_bf_connect/views/view.xml
+++ b/sf_bf_connect/views/view.xml
@@ -58,7 +58,7 @@
-
+
diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py
index fd15858a..5106dcb1 100644
--- a/sf_manufacturing/__manifest__.py
+++ b/sf_manufacturing/__manifest__.py
@@ -29,6 +29,7 @@
'views/production_line_view.xml',
'views/mrp_workcenter_views.xml',
'views/mrp_workorder_view.xml',
+ 'views/stock_picking_view.xml',
'views/model_type_view.xml',
'views/agv_setting_views.xml',
'views/sf_maintenance_equipment.xml',
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index b7aa1adb..71aa05f8 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -141,11 +141,11 @@ class ResProductMo(models.Model):
cutting_tool_coarse_medium_fine = fields.Selection(related='cutting_tool_model_id.integral_coarse_medium_fine', string='粗/中/精')
# cutting_tool_model_id.integral_coarse_medium_fine
# cutting_tool_run_out_accuracy_max = fields.Float('端跳精度max', digits=(6, 1))
- cutting_tool_run_out_accuracy_max = fields.Char(related='cutting_tool_model_id.integral_run_out_accuracy_max', string='端跳精度max', digits=(6, 1))
+ cutting_tool_run_out_accuracy_max = fields.Char(related='cutting_tool_model_id.integral_run_out_accuracy_max', string='端跳精度max')
# cutting_tool_model_id.integral_run_out_accuracy_max
# cutting_tool_run_out_accuracy_min = fields.Float('端跳精度min', digits=(6, 1))
cutting_tool_run_out_accuracy_min = fields.Char(related='cutting_tool_model_id.integral_run_out_accuracy_min',
- string='端跳精度min', digits=(6, 1))
+ string='端跳精度min')
# cutting_tool_model_id.integral_run_out_accuracy_min
# cutting_tool_blade_tip_working_size = fields.Char('刀尖倒角度(°)', size=20)
cutting_tool_blade_tip_working_size = fields.Char(related='specification_id.blade_tip_working_size',
diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index 40d159d5..fb678fd3 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -548,6 +548,35 @@ class StockPicking(models.Model):
_inherit = 'stock.picking'
surface_technics_parameters_id = fields.Many2one('sf.production.process.parameter', string="表面工艺可选参数")
+ person_of_delivery = fields.Char('收货人', compute='_compute_origin', store=True)
+ telephone_of_delivery = fields.Char('电话号码', compute='_compute_origin', store=True)
+ address_of_delivery = fields.Char('联系地址', compute='_compute_origin')
+
+ retrospect_ref = fields.Char('追溯参考', compute='_compute_origin', store=True)
+
+ @api.depends('origin')
+ def _compute_origin(self):
+ """
+ 计算带料入库单对应销售单
+ """
+ for item in self:
+ if item.picking_type_id.sequence_code == 'DL' and item.origin:
+ if 'WH/IN/' in item.origin:
+ picking_id = self.env['stock.picking'].search([('name', '=', item.origin)])
+ if picking_id and picking_id.origin:
+ purchase_id = self.env['purchase.order'].sudo().search([('name', '=', picking_id.origin)])
+ if purchase_id and purchase_id.origin:
+ sale_id = self.env['sale.order'].sudo().search([('name', '=', purchase_id.origin)])
+ item.person_of_delivery = sale_id.person_of_delivery
+ item.telephone_of_delivery = sale_id.telephone_of_delivery
+ item.address_of_delivery = sale_id.address_of_delivery
+
+ bom = self.env['mrp.bom'].sudo().search([('bom_line_ids.product_id', '=', self.move_ids.product_id.id)])
+ if bom:
+ if item.picking_type_id.sequence_code == 'DL':
+ item.retrospect_ref = bom.product_tmpl_id.default_code
+ elif item.picking_type_id.sequence_code in ['INT', 'PC']:
+ item.retrospect_ref = bom.product_tmpl_id.name
# 设置外协出入单的名称
def _get_name_Res(self, rescode):
@@ -741,6 +770,8 @@ class ReStockMove(models.Model):
self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
elif self.product_id.tracking == "lot":
self._put_tool_lot(self.company_id, self.product_id, self.origin)
+ if not self.move_line_nosuggest_ids:
+ self._generate_serial_numbers()
return {
'name': _('Detailed Operations'),
diff --git a/sf_manufacturing/views/stock_picking_view.xml b/sf_manufacturing/views/stock_picking_view.xml
index 13bb12c2..356059c2 100644
--- a/sf_manufacturing/views/stock_picking_view.xml
+++ b/sf_manufacturing/views/stock_picking_view.xml
@@ -1,22 +1,51 @@
-
- stock.move.operations.form.inherit.sf
- stock.move
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
stock.picking.form.inherit.sf
stock.picking
+
+
+
+
+
+
+
+
+
+
+ sf.vpicktree.1
+ stock.picking
+
+
+
+
+
+
+
+
+
+ stock.picking.search
+ stock.picking
+
+
+
+
+
diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py
index 53f73aef..91b22171 100644
--- a/sf_sale/models/sale_order.py
+++ b/sf_sale/models/sale_order.py
@@ -32,9 +32,9 @@ class ReSaleOrder(models.Model):
tracking=3,
default='draft')
deadline_of_delivery = fields.Date('订单交期', tracking=True)
- person_of_delivery = fields.Char('交货人')
- telephone_of_delivery = fields.Char('交货人电话号码')
- address_of_delivery = fields.Char('交货人地址')
+ person_of_delivery = fields.Char('收货人')
+ telephone_of_delivery = fields.Char('电话号码')
+ address_of_delivery = fields.Char('联系地址')
payments_way = fields.Selection([('现结', '现结'), ('月结', '月结')], '结算方式', default='现结', tracking=True)
pay_way = fields.Selection([('转账', '转账'), ('微信', '微信'), ('支付宝', '支付宝')], '支付方式')
check_status = fields.Selection([('pending', '待审核'), ('approved', '已审核'), ('fail', '不通过')], '审核状态')
diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml
index d2cff55d..16ae9c4c 100644
--- a/sf_sale/views/sale_order_view.xml
+++ b/sf_sale/views/sale_order_view.xml
@@ -192,11 +192,11 @@
-
-
-
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index 371e4a54..341ec60f 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -1119,6 +1119,8 @@ class SfPickingType(models.Model):
action = super(SfPickingType, self)._get_action(action_xmlid)
if not self.env.user.has_group('base.group_system'):
action['context']['create'] = False
+ if self.sequence_code in ['DL', 'INT', 'PC']:
+ action['context']['search_default_retrospect_ref'] = 1
return action