对“还原库存调整按钮”做权限控制

This commit is contained in:
mgw
2024-03-18 08:51:11 +08:00
parent aeca8ef2b2
commit 0b9f64fbfc

View File

@@ -424,6 +424,14 @@ class Sf_stock_move_line(models.Model):
# lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
def action_revert_inventory(self):
# 检查用户是否有执行操作的权限
if not self.env.user.has_group('sf_warehouse.group_sf_stock_user'):
raise UserError(_('You do not have the necessary permissions to perform this action.'))
# 如果用户有权限,调用父类方法
return super(CustomStockMoveLine, self).action_revert_inventory()
@api.depends('lot_name')
def _compute_lot_qr_code(self):
for record in self: