Accept Merge Request #357: (feature/产品点击库存应用没有在cloud生成动态的夹具和刀具物料Bug修复 -> develop)

Merge Request: 产品库存应用没有在cloud生成动态的夹具和刀具物料Bug修复

Created By: @杨金灵
Accepted By: @杨金灵
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/357?initial=true
This commit is contained in:
杨金灵
2023-08-31 17:36:32 +08:00
committed by Coding

View File

@@ -472,3 +472,22 @@ class ReStockMove(models.Model):
item.product_id.write({'register_state': '注册失败'})
except Exception as e:
raise UserError("注册刀具到云端失败,请联系管理员!")
class ReStockQuant(models.Model):
_inherit = 'stock.quant'
def action_apply_inventory(self):
inventory_diff_quantity = self.inventory_diff_quantity
super(ReStockQuant, self).action_apply_inventory()
if inventory_diff_quantity >= 1:
stock = self.env['stock.move'].search([('product_id', '=', self.product_id.id), ('is_inventory', '=', True),
('reference', '=', '更新的产品数量'), ('state', '=', 'done')],
limit=1, order='id desc')
if self.product_id.categ_type == '夹具':
stock._register_fixture()
elif self.product_id.categ_type == '刀具':
stock._register_cutting_tool()
return True