优化自动生成批次序列号方法
This commit is contained in:
@@ -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'),
|
||||
|
||||
@@ -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,'
|
||||
|
||||
Reference in New Issue
Block a user