إصلاح عرض رمز العملة السعودية - تطبيق انتقائي للفونت على الحقول النقدية فقط
This commit is contained in:
parent
cd4f0c2fcb
commit
dfceebcc71
|
|
@ -1,4 +1,15 @@
|
|||
/* SAR Symbol Font Definition */
|
||||
@font-face {
|
||||
font-family: 'Tajawal-Regular';
|
||||
src: url('../fonts/Tajawal-Regular.eot');
|
||||
src: url('../fonts/Tajawal-Regular.eot?#iefix') format('embedded-opentype'),
|
||||
url('../fonts/Tajawal-Regular.woff2') format('woff2'),
|
||||
url('../fonts/Tajawal-Regular.woff') format('woff'),
|
||||
url('../fonts/Tajawal-Regular.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'sar-symbol';
|
||||
src: url('../fonts/sar-symbol.eot?ebwrxj');
|
||||
|
|
@ -11,189 +22,83 @@
|
|||
font-display: block;
|
||||
}
|
||||
|
||||
/* إزالة التطبيق العام للفونت - هذا السبب في المشكلة الأصلية */
|
||||
/*
|
||||
هذا السطر كان يغير فونت النظام كله:
|
||||
*:not(.fa):not(.oi) {
|
||||
font-family: 'Tajawal-Regular', 'sar-symbol', sans-serif !important;
|
||||
}
|
||||
تم حذفه نهائياً
|
||||
*/
|
||||
[class^="icon-sar"], [class*=" icon-sar"] {
|
||||
/* use !important to prevent issues with browser extensions that change fonts */
|
||||
font-family: 'sar-symbol' !important;
|
||||
/* Don't use speak property as it causes lint warnings */
|
||||
-webkit-font-feature-settings: 'liga';
|
||||
font-feature-settings: 'liga';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
|
||||
/* ==========================================
|
||||
الحل الصحيح: تطبيق الفونت بشكل انتقائي
|
||||
========================================== */
|
||||
|
||||
/* 1. تعريف كلاس خاص لرمز العملة السعودية */
|
||||
.sar_currency_symbol,
|
||||
.saudi_riyal_symbol,
|
||||
[data-currency="SAR"],
|
||||
[data-currency-code="SAR"] {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
/* Better Font Rendering =========== */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
/* 2. تطبيق على الحقول النقدية المحددة */
|
||||
.o_field_monetary.sar_currency,
|
||||
.o_field_monetary[data-currency="SAR"],
|
||||
.oe_currency_value.sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
.icon-sar:before {
|
||||
content: "\e900";
|
||||
}
|
||||
|
||||
/* 3. تطبيق على عناصر القوائم والجداول */
|
||||
.o_list_view .sar_currency,
|
||||
.o_list_table .sar_currency,
|
||||
table.o_list_table td.sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
/* تطبيق محدود للفونت - فقط للحقول النقدية وما يحتوي على رمز العملة */
|
||||
.o_field_monetary,
|
||||
.oe_currency_value,
|
||||
.o_field_widget[data-field-type="monetary"],
|
||||
.monetary_field,
|
||||
.currency_field,
|
||||
.pos-receipt .price,
|
||||
.pos-content .price,
|
||||
.o_account_reports_table .o_account_report_column_value,
|
||||
.o_list_view .o_data_cell[data-field-type="monetary"],
|
||||
.o_kanban_view .oe_kanban_details .oe_kanban_monetary,
|
||||
.product_price {
|
||||
font-family: 'Tajawal-Regular', 'sar-symbol', sans-serif !important;
|
||||
}
|
||||
|
||||
/* 4. تطبيق على عروض kanban */
|
||||
.o_kanban_view .sar_currency,
|
||||
.oe_kanban_details .sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
}
|
||||
|
||||
/* 5. التقارير المحاسبية */
|
||||
.o_account_reports_table .sar_currency,
|
||||
.o_account_report_line .sar_currency,
|
||||
.account_report .sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
}
|
||||
|
||||
/* 6. نقطة البيع */
|
||||
.pos-content .sar_currency,
|
||||
.o_pos_order_line .sar_currency,
|
||||
.pos-receipt .sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
}
|
||||
|
||||
/* 7. الفواتير والتقارير المطبوعة */
|
||||
.o_report_layout_standard .sar_currency,
|
||||
.o_report_layout_boxed .sar_currency,
|
||||
.report .sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
}
|
||||
|
||||
/* 8. قوائم الأسعار */
|
||||
.product_price.sar_currency,
|
||||
.pricelist .sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
}
|
||||
|
||||
/* 9. الحقول المحسوبة والمجاميع */
|
||||
.o_form_view .o_group .sar_currency,
|
||||
.oe_subtotal_footer .sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
}
|
||||
|
||||
/* 10. تطبيق خاص للطباعة */
|
||||
/* تطبيق على التقارير المطبوعة */
|
||||
@media print {
|
||||
.sar_currency,
|
||||
[data-currency="SAR"],
|
||||
.saudi_riyal_symbol {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
.o_field_monetary,
|
||||
.oe_currency_value,
|
||||
.monetary_field,
|
||||
.currency_field,
|
||||
.price {
|
||||
font-family: 'Tajawal-Regular', 'sar-symbol', sans-serif !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* 11. حقول البحث والفلاتر */
|
||||
.o_searchview .sar_currency,
|
||||
.o_facet_values .sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
/* تطبيق على عناصر التقارير */
|
||||
.o_report_layout_standard .price,
|
||||
.o_report_layout_boxed .price,
|
||||
.report .monetary,
|
||||
.page .monetary {
|
||||
font-family: 'Tajawal-Regular', 'sar-symbol', sans-serif !important;
|
||||
}
|
||||
|
||||
/* 12. الويدجات المخصصة */
|
||||
.o_widget_monetary.sar_currency,
|
||||
.monetary_field.sar_currency {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
}
|
||||
|
||||
/* 13. تحسين عرض الرمز */
|
||||
.sar_currency_symbol::before {
|
||||
font-family: 'sar-symbol' !important;
|
||||
content: '\e900';
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
/* 14. للاستخدام اليدوي في القوالب */
|
||||
.manual_sar_symbol {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
}
|
||||
|
||||
.manual_sar_symbol::before {
|
||||
/* Special class for SAR amount fields */
|
||||
.oe_currency_value::before,
|
||||
.o_account_report_column_value::before,
|
||||
.o_account_report_summary_value::before,
|
||||
.o_account_report_line [data-parent-id] .o_account_report_column_value::before {
|
||||
content: '\e900';
|
||||
font-family: 'sar-symbol' !important;
|
||||
margin-right: 2px;
|
||||
display: inline-block;
|
||||
margin-right: 0;
|
||||
visibility: hidden;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
JavaScript Helper Classes
|
||||
هذه الكلاسات ستُطبق عبر JavaScript
|
||||
========================================== */
|
||||
|
||||
.js_has_sar_symbol {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
body .o_content .o_account_reports_body .oe_currency_value::before,
|
||||
body .o_content .o_account_reports_body .o_account_report_column_value::before,
|
||||
body .o_content .o_account_reports_body .o_account_report_summary_value::before,
|
||||
body .o_content .o_account_reports_body .o_account_report_line [data-parent-id] .o_account_report_column_value::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.js_currency_sar {
|
||||
font-family: 'sar-symbol', inherit, sans-serif !important;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
ضمان عدم تأثير على باقي النظام
|
||||
========================================== */
|
||||
|
||||
/* التأكد من أن باقي النصوص تحتفظ بالفونت الأصلي */
|
||||
body,
|
||||
.o_form_view,
|
||||
.o_list_view,
|
||||
.o_kanban_view,
|
||||
input:not(.sar_currency),
|
||||
textarea:not(.sar_currency),
|
||||
select:not(.sar_currency),
|
||||
.o_field_widget:not(.sar_currency),
|
||||
.btn:not(.sar_currency) {
|
||||
/* الاحتفاظ بالفونت الأصلي */
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
CRITICAL: JavaScript Integration Required
|
||||
========================================== */
|
||||
|
||||
/*
|
||||
هذا الحل يتطلب JavaScript للعمل بفعالية:
|
||||
|
||||
1. البحث عن العناصر التي تحتوي على رمز العملة السعودية
|
||||
2. إضافة كلاس 'sar_currency' أو 'js_has_sar_symbol' لها
|
||||
3. هذا سيضمن تطبيق الفونت الصحيح فقط على العناصر المطلوبة
|
||||
|
||||
مثال JavaScript المطلوب:
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// البحث عن العناصر التي تحتوي على رمز الريال
|
||||
const elements = document.querySelectorAll('*');
|
||||
elements.forEach(element => {
|
||||
if (element.textContent && element.textContent.includes('﷼')) {
|
||||
element.classList.add('js_has_sar_symbol');
|
||||
}
|
||||
});
|
||||
|
||||
// مراقبة التغييرات في DOM
|
||||
const observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
if (mutation.type === 'childList') {
|
||||
mutation.addedNodes.forEach(function(node) {
|
||||
if (node.nodeType === 1) { // Element node
|
||||
if (node.textContent && node.textContent.includes('﷼')) {
|
||||
node.classList.add('js_has_sar_symbol');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
});
|
||||
*/
|
||||
/* JavaScript Helper Classes */
|
||||
.js_has_sar_symbol,
|
||||
.sar_currency {
|
||||
font-family: 'Tajawal-Regular', 'sar-symbol', sans-serif !important;
|
||||
}
|
||||
Loading…
Reference in New Issue