Accept Merge Request #1506: (feature/单据页面优化 -> develop)
Merge Request: 优化自动生成批次序列号方法 Created By: @禹翔辉 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @禹翔辉 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1506?initial=true
This commit is contained in:
@@ -505,6 +505,12 @@ class ProductionLot(models.Model):
|
|||||||
if product.categ_id.name == '刀具':
|
if product.categ_id.name == '刀具':
|
||||||
return self.env['stock.lot'].get_tool_generate_lot_names1(company, product)
|
return self.env['stock.lot'].get_tool_generate_lot_names1(company, product)
|
||||||
else:
|
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]
|
return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name, 2)[1]
|
||||||
now = datetime.now().strftime("%Y%m%d")
|
now = datetime.now().strftime("%Y%m%d")
|
||||||
if product.cutting_tool_model_id:
|
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)
|
self.next_serial = self._get_tool_next_serial(self.company_id, self.product_id, self.origin)
|
||||||
else:
|
else:
|
||||||
self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
|
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":
|
elif self.product_id.tracking == "lot":
|
||||||
self._put_tool_lot(self.company_id, self.product_id, self.origin)
|
self._put_tool_lot(self.company_id, self.product_id, self.origin)
|
||||||
if not self.move_line_nosuggest_ids:
|
|
||||||
self._generate_serial_numbers()
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'name': _('Detailed Operations'),
|
'name': _('Detailed Operations'),
|
||||||
|
|||||||
@@ -1106,6 +1106,9 @@ class SfProcurementGroup(models.Model):
|
|||||||
class SfPickingType(models.Model):
|
class SfPickingType(models.Model):
|
||||||
_inherit = 'stock.picking.type'
|
_inherit = 'stock.picking.type'
|
||||||
|
|
||||||
|
code = fields.Selection([('incoming', 'Receipt'), ('outgoing', 'Delivery'), ('internal', '厂内出入库')],
|
||||||
|
'Type of Operation', required=True)
|
||||||
|
|
||||||
def _default_show_operations(self):
|
def _default_show_operations(self):
|
||||||
return self.user_has_groups(
|
return self.user_has_groups(
|
||||||
'stock.group_production_lot,'
|
'stock.group_production_lot,'
|
||||||
|
|||||||
Reference in New Issue
Block a user