优化权限相关

This commit is contained in:
mgw
2023-12-17 10:48:51 +08:00
parent 0a3bd37224
commit 6738a855bb
15 changed files with 561 additions and 4 deletions

View File

@@ -15,6 +15,33 @@ class MrpProduction(models.Model):
schedule_state = fields.Selection([('未排', '未排'), ('已排', '已排')],
string='排程状态', default='未排')
check_status = fields.Boolean(string='启用状态', default=False, readonly=True)
active = fields.Boolean(string='已归档', default=True)
def action_check(self):
"""
审核启用
"""
self.check_status = True
def action_uncheck(self):
"""
审核禁用
"""
self.check_status = False
def archive(self):
"""
归档
"""
self.write({'active': False})
def unarchive(self):
"""
取消归档
"""
self.write({'active': True})
@api.depends('request_ids')
def _compute_maintenance_count(self):
for production in self:

View File

@@ -84,4 +84,24 @@ access_mrp_workcenter_tag_manager,access.mrp.workcenter.tag,mrp.model_mrp_workce
access_mrp_production_split_multi,access.mrp.production.split.multi,mrp.model_mrp_production_split_multi,sf_base.group_sf_mrp_user,1,1,1,0
access_mrp_production_split,access.mrp.production.split,mrp.model_mrp_production_split,sf_base.group_sf_mrp_user,1,1,1,0
access_mrp_production_split_line,access.mrp.production.split.line,mrp.model_mrp_production_split_line,sf_base.group_sf_mrp_user,1,1,1,0
access_mrp_workcenter_capacity_manager,mrp.workcenter.capacity.manager,mrp.model_mrp_workcenter_capacity,sf_base.group_sf_mrp_user,1,1,1,0
access_mrp_workcenter_capacity_manager,mrp.workcenter.capacity.manager,mrp.model_mrp_workcenter_capacity,sf_base.group_sf_mrp_user,1,1,1,0
access_mrp_production,mrp_production,model_mrp_production,sf_base.group_plan_dispatch,1,1,1,0
access_mrp_workorder,mrp_workorder,model_mrp_workorder,sf_base.group_plan_dispatch,1,0,0,0
access_sf_production_line,sf.production.line,model_sf_production_line,sf_base.group_plan_dispatch,1,1,1,0
access_mrp_workcenter,mrp_workcenter,model_mrp_workcenter,sf_base.group_plan_dispatch,1,1,1,0
access_mrp_bom,mrp.bom,mrp.model_mrp_bom,sf_base.group_plan_dispatch,1,1,1,0
access_mrp_bom_line,mrp.bom.line,mrp.model_mrp_bom_line,sf_base.group_plan_dispatch,1,0,0,0
access_mrp_unbuild,mrp.unbuild,mrp.model_mrp_unbuild,sf_base.group_plan_dispatch,1,1,1,0
access_stock_scrap,stock.scrap,stock.model_stock_scrap,sf_base.group_plan_dispatch,1,1,1,0
access_sf_model_type,sf.model.type,model_sf_model_type,sf_base.group_plan_dispatch,1,1,1,0
access_mrp_routing_workcenter,mrp.routing.workcenter,mrp.model_mrp_routing_workcenter,sf_base.group_plan_dispatch,1,1,1,0
access_mrp_document,mrp.document,mrp.model_mrp_document,sf_base.group_plan_dispatch,1,0,0,0
access_sf_product_model_type_routing_sort,sf.product.model.type.routing.sort,model_sf_product_model_type_routing_sort,sf_base.group_plan_dispatch,1,0,0,0
access_sf_embryo_model_type_routing_sort,sf.embryo.model.type.routing.sort,model_sf_embryo_model_type_routing_sort,sf_base.group_plan_dispatch,1,0,0,0
access_sf_surface_technics_model_type_routing_sort,sf.surface_technics.model.type.routing.sort,model_sf_surface_technics_model_type_routing_sort,sf_base.group_plan_dispatch,1,0,0,0
access_mrp_workcenter_capacity,mrp.workcenter.capacity,mrp.model_mrp_workcenter_capacity,sf_base.group_plan_dispatch,1,0,0,0
access_mrp_workcenter_productivity,mrp.workcenter.productivity,mrp.model_mrp_workcenter_productivity,sf_base.group_plan_dispatch,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
84 access_mrp_production_split access.mrp.production.split mrp.model_mrp_production_split sf_base.group_sf_mrp_user 1 1 1 0
85 access_mrp_production_split_line access.mrp.production.split.line mrp.model_mrp_production_split_line sf_base.group_sf_mrp_user 1 1 1 0
86 access_mrp_workcenter_capacity_manager mrp.workcenter.capacity.manager mrp.model_mrp_workcenter_capacity sf_base.group_sf_mrp_user 1 1 1 0
87 access_mrp_production mrp_production model_mrp_production sf_base.group_plan_dispatch 1 1 1 0
88 access_mrp_workorder mrp_workorder model_mrp_workorder sf_base.group_plan_dispatch 1 0 0 0
89 access_sf_production_line sf.production.line model_sf_production_line sf_base.group_plan_dispatch 1 1 1 0
90 access_mrp_workcenter mrp_workcenter model_mrp_workcenter sf_base.group_plan_dispatch 1 1 1 0
91 access_mrp_bom mrp.bom mrp.model_mrp_bom sf_base.group_plan_dispatch 1 1 1 0
92 access_mrp_bom_line mrp.bom.line mrp.model_mrp_bom_line sf_base.group_plan_dispatch 1 0 0 0
93 access_mrp_unbuild mrp.unbuild mrp.model_mrp_unbuild sf_base.group_plan_dispatch 1 1 1 0
94 access_stock_scrap stock.scrap stock.model_stock_scrap sf_base.group_plan_dispatch 1 1 1 0
95 access_sf_model_type sf.model.type model_sf_model_type sf_base.group_plan_dispatch 1 1 1 0
96 access_mrp_routing_workcenter mrp.routing.workcenter mrp.model_mrp_routing_workcenter sf_base.group_plan_dispatch 1 1 1 0
97 access_mrp_document mrp.document mrp.model_mrp_document sf_base.group_plan_dispatch 1 0 0 0
98 access_sf_product_model_type_routing_sort sf.product.model.type.routing.sort model_sf_product_model_type_routing_sort sf_base.group_plan_dispatch 1 0 0 0
99 access_sf_embryo_model_type_routing_sort sf.embryo.model.type.routing.sort model_sf_embryo_model_type_routing_sort sf_base.group_plan_dispatch 1 0 0 0
100 access_sf_surface_technics_model_type_routing_sort sf.surface_technics.model.type.routing.sort model_sf_surface_technics_model_type_routing_sort sf_base.group_plan_dispatch 1 0 0 0
101 access_mrp_workcenter_capacity mrp.workcenter.capacity mrp.model_mrp_workcenter_capacity sf_base.group_plan_dispatch 1 0 0 0
102 access_mrp_workcenter_productivity mrp.workcenter.productivity mrp.model_mrp_workcenter_productivity sf_base.group_plan_dispatch 1 0 0 0
103
104
105
106
107

View File

@@ -52,6 +52,24 @@
</field>
</record>
<!-- 增加权限相关的按钮 -->
<record id="custom_mrp_production_form_view" model="ir.ui.view">
<field name="name">custom.mrp.production.form</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<xpath expr="//form//header//button[@name='action_confirm']" position="after">
<field name="active" invisible="1"/>
<field name="check_status" invisible="1"/>
<button name="archive" type="object" string="归档" icon="fa-archive" class="oe_highlight" attrs="{'invisible': [('active', '=', False)]}"/>
<button name="unarchive" type="object" string="取消归档" icon="fa-archive" class="oe_highlight" attrs="{'invisible': [('active', '=', True)]}"/>
<button name="action_check" string="启用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', True)]}" groups="sf_base.group_plan_director"/>
<button name="action_uncheck" string="禁用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', False)]}" groups="sf_base.group_plan_director"/>
</xpath>
</field>
</record>
<!-- <record id="custom_mrp_production_form_view" model="ir.ui.view"> -->
<!-- <field name="name">custom.mrp.production.form</field> -->
<!-- <field name="model">mrp.production</field> -->