Merge pull request #4478 from expsa/eltayar

enhance_sar_symbol
This commit is contained in:
Mohamed Eltayar 2025-08-31 23:24:54 +03:00 committed by GitHub
commit 24b97de99a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 95 additions and 164 deletions

View File

@ -1,2 +1,9 @@
After installing this module, copy the symbol () and paste it in the currency symbol field
for the Saudi Riyal (SAR) currency in: Accounting > Configuration > Accounting > Currencies.
After installing this module, copy the Saudi Riyal symbol below and paste it in the currency symbol field for the Saudi Riyal (SAR) currency in: Accounting > Configuration > Accounting > Currencies.
**Copy this symbol:**
**الرمز للنسخ:**
Note: The symbol above should display as the new Saudi Riyal currency symbol. If you see a square or different character, please ensure the module is properly installed and the page is refreshed.
ملاحظة: الرمز أعلاه يجب أن يظهر كرمز العملة السعودية الجديد. إذا رأيت مربعاً أو حرفاً مختلفاً، تأكد من أن الموديول مثبت بشكل صحيح وأن الصفحة محدثة.

View File

@ -1,4 +1,4 @@
/* SAR Symbol Font Definition */
/* SAR Symbol Font Definition Only - No other font changes */
@font-face {
font-family: 'sar-symbol';
src: url('../fonts/sar-symbol.eot?ebwrxj');
@ -11,189 +11,113 @@
font-display: block;
}
/* إزالة التطبيق العام للفونت - هذا السبب في المشكلة الأصلية */
/*
هذا السطر كان يغير فونت النظام كله:
*:not(.fa):not(.oi) {
font-family: 'Tajawal-Regular', 'sar-symbol', sans-serif !important;
}
تم حذفه نهائياً
*/
/* ==========================================
الحل الصحيح: تطبيق الفونت بشكل انتقائي
========================================== */
/* 1. تعريف كلاس خاص لرمز العملة السعودية */
.sar_currency_symbol,
.saudi_riyal_symbol,
[data-currency="SAR"],
[data-currency-code="SAR"] {
font-family: 'sar-symbol', inherit, sans-serif !important;
/* SAR Icon Class */
[class^="icon-sar"], [class*=" icon-sar"] {
font-family: 'sar-symbol' !important;
-webkit-font-feature-settings: 'liga';
font-feature-settings: 'liga';
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-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_form_view .o_field_char[name="symbol"],
.o_field_widget[name="symbol"],
.o_field_char[name="symbol"] input,
input[name="symbol"],
.o_form_view input[name="symbol"] {
font-family: inherit, '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;
/* إضافة دعم للحقول في موديل res.currency */
.o_form_view[data-res-model="res.currency"] .o_field_char,
.o_form_view[data-res-model="res.currency"] input[type="text"] {
font-family: inherit, 'sar-symbol', 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;
/* ============================================================
الحل الأمثل: إضافة فونت sar-symbol للفونت الموجود بدون تغييره
============================================================ */
/* تطبيق محدود - إضافة sar-symbol للفونت family الموجود */
.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: inherit, 'sar-symbol', 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: inherit, '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: inherit, 'sar-symbol', sans-serif !important;
}
/* 12. الويدجات المخصصة */
.o_widget_monetary.sar_currency,
.monetary_field.sar_currency {
font-family: 'sar-symbol', inherit, sans-serif !important;
/* JavaScript Helper Classes */
.js_has_sar_symbol,
.sar_currency {
font-family: inherit, 'sar-symbol', sans-serif !important;
}
/* 13. تحسين عرض الرمز */
.sar_currency_symbol::before {
font-family: 'sar-symbol' !important;
content: '\e900';
margin-right: 3px;
/* Special handling for elements that contain SAR symbol */
.contains_sar_symbol {
font-family: inherit, 'sar-symbol', sans-serif !important;
}
/* 14. للاستخدام اليدوي في القوالب */
.manual_sar_symbol {
font-family: 'sar-symbol', inherit, sans-serif !important;
/* ============================================================
دعم إضافي لصفحات الإعدادات والقوائم
============================================================ */
/* قوائم العملات */
.o_list_view[data-res-model="res.currency"] .o_data_cell,
.o_list_view[data-res-model="res.currency"] td {
font-family: inherit, 'sar-symbol', sans-serif !important;
}
.manual_sar_symbol::before {
content: '\e900';
font-family: 'sar-symbol' !important;
margin-right: 2px;
/* عرض kanban للعملات */
.o_kanban_view[data-res-model="res.currency"] .oe_kanban_details {
font-family: inherit, 'sar-symbol', sans-serif !important;
}
/* ==========================================
JavaScript Helper Classes
هذه الكلاسات ستُطبق عبر JavaScript
========================================== */
.js_has_sar_symbol {
font-family: 'sar-symbol', inherit, sans-serif !important;
}
.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 للعمل بفعالية:
/* ============================================================
ملاحظة مهمة:
الكود ده بيستخدم inherit علشان يحتفظ بالفونت الأصلي
للثيم المستخدم ويضيف بس فونت sar-symbol كـ fallback
للرمز الخاص بالعملة السعودية
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
});
});
*/
تم إضافة دعم خاص لحقول الإعدادات علشان يظهر الرمز
في صفحة إعدادات العملة نفسها
============================================================ */