Fixed QWeb template inheritance error - removed non-existent template references for Odoo 14

This commit is contained in:
Mohamed Eltayar 2025-08-28 17:45:59 +03:00
parent d7ec2cf848
commit 477563b3eb
1 changed files with 40 additions and 26 deletions

View File

@ -3,11 +3,11 @@
Enhanced Hijri Datepicker Template for Odoo 14
Seamlessly integrates with Odoo's standard datepicker template structure
Maintains all Hijri functionality while following Odoo's UI patterns
Fixed placeholder display for both Gregorian and Hijri fields
Fixed template inheritance for Odoo 14 compatibility - removed non-existent templates
-->
<templates id="template" xml:space="preserve">
<!-- Main datepicker template extension -->
<!-- Main datepicker template extension - the only template that exists in Odoo 14 -->
<t t-name="web.datepicker" t-extend="web.datepicker">
<t t-jquery=".o_datepicker" t-operation="replace">
<div class="o_datepicker input-group"
@ -19,7 +19,7 @@
<input type="text"
class="o_datepicker_input o_input form-control datetimepicker-input"
t-att-name="widget.name"
placeholder="التاريخ الميلادي"
placeholder="التاريخ الميلادي (مم/يي/سسسس)"
t-attf-data-target="##{datepickerID}"
autocomplete="off"
t-att-readonly="widget.readonly ? 'readonly' : null"/>
@ -42,7 +42,7 @@
<input type="text"
class="o_hijri o_input form-control"
t-att-name="widget.name + '_hijri'"
placeholder="التاريخ الهجري"
placeholder="التاريخ الهجري (الشهر اليوم، السنة)"
readonly="readonly"
style="background-color: rgba(40, 167, 69, 0.1); border-color: rgba(40, 167, 69, 0.2); color: #28a745;"
title="مكافئ التاريخ الهجري"
@ -57,13 +57,8 @@
</span>
</div>
</div>
</t>
</t>
<!-- Enhanced date widget template for form views -->
<t t-name="web.DateWidget" t-extend="web.DateWidget">
<t t-jquery=".o_datepicker" t-operation="after">
<!-- Hijri date display in readonly mode -->
<!-- Hijri readonly display for form views - integrated directly -->
<div class="o_hijri_readonly d-none" style="margin-top: 0.25rem;">
<small class="text-muted">
<i class="fa fa-calendar-alt text-success mr-1" aria-hidden="true"/>
@ -74,25 +69,44 @@
</t>
</t>
<!-- List view date cell template enhancement -->
<t t-name="ListView.row" t-extend="ListView.row">
<t t-jquery="td[t-att-class*='o_data_cell']" t-operation="attributes">
<t t-att-data-hijri-enabled="widget.type === 'date' ? 'true' : null"/>
</t>
</t>
<!-- Form view date field template enhancement -->
<t t-name="FieldDate" t-extend="FieldDate">
<t t-jquery=".o_field_date" t-operation="attributes">
<t t-att-data-hijri-supported="true"/>
</t>
</t>
<!-- Accessibility enhancements for screen readers -->
<t t-name="web.datepicker.hijri_accessibility">
<t t-name="web.hijri_accessibility">
<div class="sr-only" aria-live="polite" id="hijri_announce">
<!-- Screen reader announcements for Hijri date changes -->
</div>
</t>
<!-- Hijri date display template for standalone use -->
<t t-name="hijri_date_display">
<div class="hijri-date-container">
<div class="gregorian-date" t-esc="gregorian_date"/>
<div class="hijri-date text-success" t-if="hijri_date">
<small>
<i class="fa fa-calendar-alt mr-1"/>
التاريخ الهجري: <span t-esc="hijri_date"/>
</small>
</div>
</div>
</t>
<!-- Hijri picker popup template for advanced customization -->
<t t-name="hijri_picker_popup">
<div class="hijri-picker-popup">
<div class="picker-header">
<h6 class="mb-0">اختيار التاريخ الهجري</h6>
</div>
<div class="picker-body">
<!-- Calendar will be inserted here by JavaScript -->
</div>
<div class="picker-footer">
<button type="button" class="btn btn-sm btn-secondary hijri-cancel">
إلغاء
</button>
<button type="button" class="btn btn-sm btn-primary hijri-today">
اليوم
</button>
</div>
</div>
</t>
</templates>