1、优化刀具、夹具同步接口;关闭刀具同步接口的实时调用;

This commit is contained in:
yuxianghui
2024-05-21 09:23:47 +08:00
parent dc381faae6
commit 1b6ca90bd4
7 changed files with 390 additions and 373 deletions

View File

@@ -831,10 +831,8 @@ class ProductProduct(models.Model):
new_time = datetime.strptime(str(fields.Date.today()), "%Y-%m-%d").strftime("%Y%m%d")
code += str(new_time) + '-'
stock_lot_id = self.env['stock.lot'].sudo().search(
[('name', 'like', new_time), ('product_id.name', '=', '功能刀具')],
limit=1,
order="id desc"
)
[('name', 'like', new_time), ('product_id.categ_type', '=', '功能刀具'),
('product_id.tracking', '=', 'serial')], limit=1, order="id desc")
if not stock_lot_id:
num = "%03d" % 1
else:
@@ -921,13 +919,13 @@ class StockLot(models.Model):
return stock_move_id, stock_move_line_id
class StockQuant(models.Model):
_inherit = 'stock.quant'
@api.model_create_multi
def create(self, vals_list):
records = super(StockQuant, self).create(vals_list)
for record in records:
if record.lot_id.product_id.categ_id.name == '刀具':
record.lot_id.enroll_tool_material_stock()
return records
# class StockQuant(models.Model):
# _inherit = 'stock.quant'
#
# @api.model_create_multi
# def create(self, vals_list):
# records = super(StockQuant, self).create(vals_list)
# for record in records:
# if record.lot_id.product_id.categ_id.name == '刀具':
# record.lot_id.enroll_tool_material_stock()
# return records