小程序操作优化

This commit is contained in:
pengyuthon
2026-02-11 09:49:38 +08:00
parent ef9ecfd99e
commit 2fd2e40b3e
3 changed files with 12 additions and 5 deletions
@@ -31,12 +31,14 @@ class AppletAddress(models.Model):
class AppletSecurity(models.Model):
_name = 'applet.security'
_description = "小程序权限管理"
_rec_name = "employee_id"
employee_id = fields.Many2one('hr.employee', string="员工")
company_id = fields.Many2one(related="employee_id.company_id", string="公司", store=True)
department_id = fields.Many2one(related="employee_id.department_id", string="部门", store=True)
applet_security_setting_ids = fields.Many2many('applet.security.setting', string="权限板块")
def init_applet_security(self):
"""
初始化权限
@@ -68,7 +70,6 @@ class AppletSecurity(models.Model):
"target": "new",
"context": {
"default_applet_security_ids": applet_ids.ids, # 默认员工
# "default_employee_ids": applet_ids.employee_id.ids, # 默认员工
},
}
@@ -3,9 +3,12 @@
<field name="name">applet.security.quick.perm.wizard.form</field>
<field name="model">applet.security.quick.perm.wizard</field>
<field name="arch" type="xml">
<form string="快速添加权限">
<form string="快速调整权限">
<group>
<field name="applet_security_ids" widget="many2many_tags" invisible="1"/>
<field name="add_unlink" widget="radio"/>
<field name="department_ids" widget="many2many_tags"/>
<field name="user_role_ids" widget="many2many_tags"/>
<field name="applet_security_ids" widget="many2many_tags" domain="[('department_id', 'in', department_ids)]"/>
<field name="applet_security_setting_ids" widget="many2many_tags"/>
</group>
<footer>
@@ -17,7 +20,7 @@
</record>
<record id="action_applet_security_quick_perm_wizard" model="ir.actions.act_window">
<field name="name">快速添加权限</field>
<field name="name">快速调整权限</field>
<field name="res_model">applet.security.quick.perm.wizard</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_applet_security_quick_perm_wizard_form"/>
@@ -3,8 +3,11 @@ from odoo import models, fields
class AppletSecurityQuickPermWizard(models.TransientModel):
_name = 'applet.security.quick.perm.wizard'
_description = '快速添加权限'
_description = '快速调整权限'
add_unlink = fields.Selection([('add', '添加'), ('unlink', '删除')], default="add", string="操作")
department_ids = fields.Many2many('hr.department', string="部门")
user_role_ids = fields.Many2many('soong.user.role', string="角色")
applet_security_ids = fields.Many2many('applet.security', string="权限记录集")
applet_security_setting_ids = fields.Many2many('applet.security.setting', string='权限板块')