添加功能

This commit is contained in:
李鹏宇
2025-11-12 09:36:06 +08:00
parent fabecca0fb
commit d6bfbbcadd
2 changed files with 42 additions and 20 deletions
@@ -1,28 +1,50 @@
<!--<templates xml:space="preserve">-->
<!-- <t t-inherit="web.FormStatusIndicator" t-inherit-mode="extension">-->
<!-- &lt;!&ndash; 隐藏原来的按钮容器 &ndash;&gt;-->
<!-- <xpath expr="//div[contains(@class,'o_form_status_indicator_buttons')]" position="attributes">-->
<!-- <attribute name="t-att-class">"o_form_status_indicator_buttons d-flex invisible"</attribute>-->
<!-- </xpath>-->
<!-- </t>-->
<!-- <t t-inherit="web.FormView" t-inherit-mode="extension">-->
<!-- <xpath expr="//Layout/t[@t-set-slot='control-panel-create-button'][2]" position="inside">-->
<!-- &lt;!&ndash; edit by Lucky 20250714:增加buttonState.showEditButton &ndash;&gt;-->
<!-- <t t-if="!model.root.isInEdition and buttonState.showEditButton">-->
<!-- <t t-if="!model.root.isInEdition and buttonState.showEditButton and leny.isSmall">-->
<!-- <button type="button" class="btn btn-outline-primary o_form_button_edit" t-on-click="edit" data-hotkey="a">编辑</button>-->
<!-- </t>-->
<!-- <t t-if="model.root.isInEdition and buttonState.formRendered">-->
<!-- <div class="o_form_buttons_edit">-->
<!-- <button id="editButton" type="button" class="btn btn-secondary o_form_button_save" t-on-click="saveButtonClicked" data-hotkey="s">-->
<!-- <i class="fa fa-cloud-upload fa-fw" />-->
<!-- 保存-->
<!-- </button>-->
<!-- <button type="button" id="formDiscard" class="btn btn-secondary" t-on-click="discard" data-hotkey="j">-->
<!-- <i class="fa fa-undo fa-fw" />-->
<!-- 丢弃-->
<!-- </button>-->
<!-- </div>-->
<!-- </t>-->
<!-- </xpath>-->
<!-- </t>-->
<!--</templates>-->
<templates xml:space="preserve">
<t t-inherit="web.FormStatusIndicator" t-inherit-mode="extension">
<!-- 隐藏原来的按钮容器 -->
<xpath expr="//div[contains(@class,'o_form_status_indicator_buttons')]" position="attributes">
<attribute name="t-att-class">"o_form_status_indicator_buttons d-flex invisible"</attribute>
</xpath>
</t>
<t t-inherit="web.FormView" t-inherit-mode="extension">
<xpath expr="//Layout/t[@t-set-slot='control-panel-create-button'][2]" position="inside">
<xpath expr="//Layout[t@t-set-slot='control-panel-create-button'][2]" position="inside">
<!-- edit by Lucky 20250714:增加buttonState.showEditButton -->
<t t-if="!model.root.isInEdition and buttonState.showEditButton">
<button type="button" class="btn btn-outline-primary o_form_button_edit" t-on-click="edit" data-hotkey="a">编辑</button>
<t t-if="model.root.isInEdition and buttonState.showEditButton and !env.isSmall">
<button type="button" class="btn btn-outline-primary o_form_button_edit" t-on-click="edit" data-hotkey="a">编
</button>
</t>
<t t-if="model.root.isInEdition and buttonState.formRendered">
<div class="o_form_buttons_edit">
<button id="editButton" type="button" class="btn btn-secondary o_form_button_save" t-on-click="saveButtonClicked" data-hotkey="s">
<i class="fa fa-cloud-upload fa-fw" />
保存
</button>
<button type="button" id="formDiscard" class="btn btn-secondary" t-on-click="discard" data-hotkey="j">
<i class="fa fa-undo fa-fw" />
丢弃
</button>
</div>
<t t-call="web.FormView.buttons"/>
</t>
</xpath>
<!-- 继承 ControlPanel 模板 -->
<t t-inherit="web.ControlPanel" t-inherit-mode="extension">
<xpath expr="//div[@class='o_control_panel d-flex flex-column gap-3 gap-lg-1 px-3 pt-2 pb-3']" position="attributes">
<attribute name="t-attf-class">o_control_panel d-flex flex-column gap-3 gap-lg-1 px-3 pt-2 pb-3 #{env.isSmall ? '
</attribute>
</xpath>
</t>
</t>
</templates>
+1 -1
View File
@@ -149,7 +149,7 @@ class HrAttendance(models.Model):
while current_date <= end_date:
for employee in valid_employees:
existing_attendance = self.env["hr.attendance"].search([
('employee_id', '=', employee.id), # 关联员工
('employee_id', '=', employee.id),
('current_data', '=', current_date)
], limit=1)
if not existing_attendance: