From 6fed64ba2a3e4e2227d5f6f688d43452d7e47378 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Wed, 22 Nov 2023 17:55:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=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_manufacturing/models/stock.py | 2 +- sf_plan/__manifest__.py | 1 + sf_plan/security/ir.model.access.csv | 9 ++------- sf_plan/security/rules.xml | 9 +++++++++ sf_plan/views/view.xml | 9 +++++---- 5 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 sf_plan/security/rules.xml diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 1722886e..baae91e1 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -199,7 +199,7 @@ class StockRule(models.Model): sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)]) if sale_order: bb = sale_order.deadline_of_delivery - productions = self.env['sf.production.plan'].with_user(SUPERUSER_ID).sudo().with_company(company_id). \ + productions = self.env['sf.production.plan'].sudo().with_company(company_id). \ create({ 'name': production.name, 'order_deadline': sale_order.deadline_of_delivery, diff --git a/sf_plan/__manifest__.py b/sf_plan/__manifest__.py index 40b36882..d0cd7bcb 100644 --- a/sf_plan/__manifest__.py +++ b/sf_plan/__manifest__.py @@ -16,6 +16,7 @@ 'depends': ['sf_manufacturing'], 'data': [ 'security/ir.model.access.csv', + # 'security/rules.xml', 'views/view.xml', ], diff --git a/sf_plan/security/ir.model.access.csv b/sf_plan/security/ir.model.access.csv index 3a1a20c9..3123afe9 100644 --- a/sf_plan/security/ir.model.access.csv +++ b/sf_plan/security/ir.model.access.csv @@ -1,8 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_sf_production_plan,sf.production.plan,model_sf_production_plan,base.group_user,1,1,1,1 -access_sf_machine_schedule,sf.machine.schedule,model_sf_machine_schedule,base.group_user,1,1,1,1 - - - - - +access_sf_production_plan,sf.production.plan,model_sf_production_plan,base.group_user,1,0,0,0 +access_sf_production_plan_for_dispatch,sf.production.plan for dispatch,model_sf_production_plan,sf_base.group_plan_dispatch,1,1,1,0 diff --git a/sf_plan/security/rules.xml b/sf_plan/security/rules.xml new file mode 100644 index 00000000..7355bc8c --- /dev/null +++ b/sf_plan/security/rules.xml @@ -0,0 +1,9 @@ + + + Own Orders Only + + + + [('create_uid', '=', user.id)] + + \ No newline at end of file diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml index 5df9e8db..c2faf029 100644 --- a/sf_plan/views/view.xml +++ b/sf_plan/views/view.xml @@ -18,8 +18,8 @@ -