1、优化产品按批量采购入库时,没有生成二维码问题;

This commit is contained in:
yuxianghui
2024-06-11 17:00:25 +08:00
parent bae947bdca
commit 7d7f0348d2

View File

@@ -837,19 +837,15 @@ class ProductProduct(models.Model):
return stock_lot return stock_lot
def get_stock_lot_name(self, tool_assembly_order_id): def get_stock_lot_name(self, obj):
""" """
生成功能刀具序列号 生成功能刀具序列号
""" """
tool_assembly_order = self.env['sf.functional.tool.assembly.order'].search( company = obj.cutting_tool_cutterhandle_model_id.code.split('-', 1)[0]
[('id', '=', tool_assembly_order_id)])
code = 'JKM-T-' + str(tool_assembly_order.after_assembly_functional_tool_type_id.code) + '-' + str(
tool_assembly_order.after_assembly_functional_tool_diameter) + '-'
new_time = datetime.strptime(str(fields.Date.today()), "%Y-%m-%d").strftime("%Y%m%d") new_time = datetime.strptime(str(fields.Date.today()), "%Y-%m-%d").strftime("%Y%m%d")
code += str(new_time) + '-' code = '%s-GNDJ-%s-%s' % (company, obj.after_assembly_functional_tool_type_id.code, new_time)
stock_lot_id = self.env['stock.lot'].sudo().search( stock_lot_id = self.env['stock.lot'].sudo().search(
[('name', 'like', new_time), ('product_id.categ_type', '=', '功能刀具'), [('name', 'like', code)], limit=1, order="id desc")
('product_id.tracking', '=', 'serial')], limit=1, order="id desc")
if not stock_lot_id: if not stock_lot_id:
num = "%03d" % 1 num = "%03d" % 1
else: else: