更新一下 property_meter_water_views 视图

This commit is contained in:
sunjie
2025-08-14 20:43:40 +08:00
parent a724edf1af
commit 2736cae62f
7 changed files with 57 additions and 18 deletions
-2
View File
@@ -4,8 +4,6 @@
'summary': "Planning Gantt",
'description': 'Planning Gantt',
'author': 'XSK',
'website': '',
'website': '',
'category': 'Tools',
'version': '17.0',
'depends': ['base', 'planning'],
@@ -48,7 +48,9 @@ patch(PlanningGanttRenderer.prototype, {
if (!groupBy) {
groupPills.push({id: 0, name: "未知班次", pill: pill})
} else {
groupPills.push({id: parseInt(groupBy[0], 10), name: groupBy[1], pill: pill})
console.log(pill)
// groupPills.push({id: parseInt(groupBy[0], 10), name: groupBy[1], pill: pill})
groupPills.push({id: parseInt(groupBy[0], 10), name: `${pill.record.department_id[1]} ${pill.record.planning_name}`, pill: pill})
}
});
// 遍历groupPills,根据type进行分组,并计算数量
@@ -223,6 +225,7 @@ patch(PlanningGanttRenderer.prototype, {
groupPills[key].pills = aggregatePills;
});
// 填充模板信息
console.log(groupPills)
this.fetchSlotTemplate(groupPills);
return Object.values(groupPills);
},
+12 -12
View File
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="planning_view_gantt_inherit_add_previous_template_id" model="ir.ui.view">
<field name="name">planning.slot.gantt.inherit</field>
<field name="model">planning.slot</field>
<field name="inherit_id" ref="planning.planning_view_gantt"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="template_id" />
</xpath>
</field>
</record>
<data>
<record id="planning_view_gantt_inherit_add_previous_template_id" model="ir.ui.view">
<field name="name">planning.slot.gantt.inherit</field>
<field name="model">planning.slot</field>
<field name="inherit_id" ref="planning.planning_view_gantt"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="template_id"/>
</xpath>
</field>
</record>
</data>
</data>
</odoo>
+2 -1
View File
@@ -13,7 +13,7 @@
'sequence': 240,
'website': 'https://www.pengyuthon.com',
'depends': ['hr_attendance', 'resource', 'base', 'hr', 'mail',
'soong_workflow', 'yuthon_issue', 'planning', 'calendar', 'web_gantt', 'yuthon_wechat', 'yuthon_hr_employee'],
'soong_workflow', 'yuthon_issue', 'planning', 'calendar', 'web_gantt', 'yuthon_wechat', 'yuthon_hr_employee','planning'],
'data': [
'security/ir.model.access.csv',
'security/planning_group.xml',
@@ -78,6 +78,7 @@
'yuthon_hr_attendance/static/src/css/*.css',
'yuthon_hr_attendance/static/src/js/planning_gantt_renderer.js',
'yuthon_hr_attendance/static/src/xml/planning_gantt_renderer.xml',
'yuthon_hr_attendance/static/src/planning_gantt/planning_gantt_controller.xml',
],
},
'installable': True,
@@ -101,13 +101,23 @@ class PlanningSlotTemplate(models.Model):
# else:
# record.display_name = "Unknown"
@api.depends('role_id','planning_name')
def _compute_display_name(self):
for shift_template in self:
name = '{} {} {}'.format(
shift_template.planning_name,
shift_template.name,
shift_template.role_id.name if shift_template.role_id.name is not False else '',
)
shift_template.display_name = name
class Planning(models.Model):
_inherit = 'planning.slot'
department_id = fields.Many2one('hr.department', string='部门')
color = fields.Integer("Color", compute='_compute_color')
planning_name = fields.Char("班次名称", related='template_id.planning_name')
planning_name = fields.Char("班次名称", related='template_id.planning_name', store=True)
display_sequence = fields.Integer(string=" ")
active = fields.Boolean('Active', default=True, tracking=True)
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-inherit-mode="extension" t-inherit="planning.PlanningGanttView.Buttons">
<xpath expr="//button[hasclass('o_gantt_button_send_all')]" position="attributes">
<attribute name="class">o_hidden</attribute>
</xpath>
<xpath expr="//button[hasclass('o_gantt_button_auto_plan')]" position="attributes">
<attribute name="class">o_hidden</attribute>
</xpath>
</t>
</templates>
@@ -17,7 +17,7 @@
<field name="model">planning.slot.template</field>
<field name="inherit_id" ref="planning.planning_slot_template_view_form"/>
<field name="arch" type="xml">
<xpath expr="//form" position="attributes">
<xpath expr="//form" position="attributes">
<attribute name="create">0</attribute>
</xpath>
<xpath expr="//field[@name='role_id']" position="after">
@@ -28,4 +28,17 @@
</xpath>
</field>
</record>
<record id="planning_view_gantt_inherit_add_previous_template_id" model="ir.ui.view">
<field name="name">planning.slot.gantt.inherit</field>
<field name="model">planning.slot</field>
<field name="inherit_id" ref="planning.planning_view_gantt"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="planning_name"/>
<field name="department_id"/>
</xpath>
</field>
</record>
</odoo>