From a7b5fc898e3ec0c5b19e2465ce3e75066866f37d Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Wed, 13 Nov 2024 17:34:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=89=B9=E6=AC=A1=E5=BA=8F=E5=88=97=E5=8F=B7=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/stock.py | 11 +++++++++-- sf_warehouse/models/model.py | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index a0787477..73a1fbee 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -505,6 +505,12 @@ class ProductionLot(models.Model): if product.categ_id.name == '刀具': return self.env['stock.lot'].get_tool_generate_lot_names1(company, product) else: + # 对last_serial的name进行检测,如果不是以产品名称+数字的形式的就重新搜索 + if product.name.split('[')[0] not in last_serial.name: + last_serial = self.env['stock.lot'].search( + [('company_id', '=', company.id), ('product_id', '=', product.id), + ('name', 'ilike', product.name.split('[')[0])], + limit=1, order='name desc') return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name, 2)[1] now = datetime.now().strftime("%Y%m%d") if product.cutting_tool_model_id: @@ -831,10 +837,11 @@ class ReStockMove(models.Model): self.next_serial = self._get_tool_next_serial(self.company_id, self.product_id, self.origin) else: self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) + if self.picking_type_id.sequence_code == 'DL' and not self.move_line_nosuggest_ids: + self.action_assign_serial_show_details() 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_warehouse/models/model.py b/sf_warehouse/models/model.py index 341ec60f..30024239 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -1106,6 +1106,9 @@ class SfProcurementGroup(models.Model): class SfPickingType(models.Model): _inherit = 'stock.picking.type' + code = fields.Selection([('incoming', 'Receipt'), ('outgoing', 'Delivery'), ('internal', '厂内出入库')], + 'Type of Operation', required=True) + def _default_show_operations(self): return self.user_has_groups( 'stock.group_production_lot,'