From 0b9f64fbfcb8cdd0c74f168eb60955ae42497257 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 18 Mar 2024 08:51:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E2=80=9C=E8=BF=98=E5=8E=9F=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E8=B0=83=E6=95=B4=E6=8C=89=E9=92=AE=E2=80=9D=E5=81=9A?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/models/model.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index 3e691430..fbccbc76 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -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: