This commit is contained in:
李鹏宇
2026-01-08 18:06:25 +08:00
parent 0fc8b1c62f
commit 06119d711a
4 changed files with 49 additions and 6 deletions
+12 -1
View File
@@ -1,5 +1,5 @@
from odoo import fields, models, api
from odoo import api, fields, models
class IrModelFields(models.Model):
_inherit = 'ir.model.fields'
@@ -9,3 +9,14 @@ class IrModelFields(models.Model):
return name.startswith('x_') or name.endswith('_pinyin')
class UsersHomeBatchWizard(models.TransientModel):
_name = "users.home.batch.wizard"
_description = "Batch Update User Home"
user_ids = fields.Many2many("res.users", string="选中员工", default=lambda self: self.env.context.get("active_ids", []))
action_id = fields.Many2one('ir.actions.actions', string="动作")
def confirm(self):
for user in self.user_ids:
user.write({'action_id': self.action_id.id})
+1
View File
@@ -2,3 +2,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_system_version,system_version,model_system_version,base.group_system,1,1,1,1
access_ir_cron_type,ir.cron.type,model_ir_cron_type,base.group_system,1,1,1,1
access_yuthon_timed_tasks,yuthon.timed.tasks,model_yuthon_timed_tasks,base.group_system,1,1,1,1
access_users_home_batch_wizard,access_users_home_batch_wizard,model_users_home_batch_wizard,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_system_version system_version model_system_version base.group_system 1 1 1 1
3 access_ir_cron_type ir.cron.type model_ir_cron_type base.group_system 1 1 1 1
4 access_yuthon_timed_tasks yuthon.timed.tasks model_yuthon_timed_tasks base.group_system 1 1 1 1
5 access_users_home_batch_wizard access_users_home_batch_wizard model_users_home_batch_wizard base.group_user 1 1 1 1
+29
View File
@@ -42,5 +42,34 @@
<field name="view_mode">tree,form</field>
<field name="domain">[('cron_type_id.name', '=', '出勤')]</field>
</record>
<record id="view_users_home_batch_wizard_form" model="ir.ui.view">
<field name="name">users.home.batch.wizard.form</field>
<field name="model">users.home.batch.wizard</field>
<field name="arch" type="xml">
<form string="批量更新首页">
<group>
<group>
<field name="user_ids" widget="many2many_tags" string="员工姓名"/>
<field name="action_id"/>
</group>
<group/>
</group>
<footer>
<button name="confirm" string="确认" type="object" class="oe_highlight"/>
<button string="返回" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_users_home_batch_wizard" model="ir.actions.act_window">
<field name="name">批量更新首页</field>
<field name="res_model">users.home.batch.wizard</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_users_home_batch_wizard_form"/>
<field name="target">new</field>
<field name="binding_model_id" ref="base.model_res_users"/>
<field name="binding_view_types">list</field>
</record>
</odoo>
@@ -35,8 +35,8 @@
}
/* 审批详情列宽(匹配上方表格的5列结构) */
.approval-col1 { width: 20%; } /* 匹配上方"合同编号"等标题列宽度 */
.approval-col2 { width: 40%; } /* 匹配上方内容列宽度 */
.approval-col3 { width: 40%; } /* 匹配上方内容列宽度 */
.approval-col2 { width: 40%; border-right: none !important; } /* 匹配上方内容列宽度 */
.approval-col3 { width: 40%; border-left: none !important; } /* 匹配上方内容列宽度 */
</style>
<div class="title">租赁合同审批单</div>
@@ -123,7 +123,7 @@
</td>
</tr>
<!-- 审批详情:匹配上方5列结构 -->
<!-- 审批详情:仅修改colspan让边框样式生效,其他不变 -->
<tr>
<td class="header-cell" colspan="5" style="text-align:center;"><strong>审批详情</strong></td>
</tr>
@@ -131,8 +131,10 @@
<t t-foreach="doc.log_ids.sorted('sequence')" t-as="log">
<tr>
<td class="approval-col1" style="text-align:center;"><span t-esc="log.name"/></td>
<td class="approval-col2" colspan="2" style="text-align:center;"><span t-esc="log.comment"/></td>
<td class="approval-col3" colspan="2" style="text-align:center;">
<!-- 仅修改此处colspan为3,让approval-col2和approval-col3相邻 -->
<td class="approval-col2" colspan="3" style="text-align:center;"><span t-esc="log.comment"/></td>
<!-- 仅修改此处colspan为1,让两个单元格直接对接 -->
<td class="approval-col3" colspan="1" style="text-align:center;">
<t t-if="log.done_by">
<span t-esc="log.done_by.name"/> <span t-esc="log.lase_click_date and log.lase_click_date.strftime('%Y-%m-%d') or ''"/>
</t>