diff --git a/odex25_transactions/exp_transaction_documents/__manifest__.py b/odex25_transactions/exp_transaction_documents/__manifest__.py index a43582da9..8f828dbad 100644 --- a/odex25_transactions/exp_transaction_documents/__manifest__.py +++ b/odex25_transactions/exp_transaction_documents/__manifest__.py @@ -19,11 +19,12 @@ Managing Communications Transcations flows """, 'website': 'http://www.exp-sa.com', 'depends': ['base', 'base_odex', 'mail','attachment_indexation','odex25_sign','html_text', 'odex_sms','sale', - 'sale_management'], + 'sale_management','system_notification'], 'data': [ 'security/groups.xml', 'security/ir.model.access.csv', 'email_templates/out_templates.xml', + 'email_templates/mail_notification_template.xml', 'data/cm_data.xml', 'data/ir_cron.xml', 'views/entity.xml', diff --git a/odex25_transactions/exp_transaction_documents/email_templates/incoming_templates.xml b/odex25_transactions/exp_transaction_documents/email_templates/incoming_templates.xml index ed9a46b95..fe984d65b 100644 --- a/odex25_transactions/exp_transaction_documents/email_templates/incoming_templates.xml +++ b/odex25_transactions/exp_transaction_documents/email_templates/incoming_templates.xml @@ -48,14 +48,12 @@
- ${user.company_id.name} - - +
+ تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
diff --git a/odex25_transactions/exp_transaction_documents/email_templates/internal_templates.xml b/odex25_transactions/exp_transaction_documents/email_templates/internal_templates.xml index 63f1526a2..5d1650760 100644 --- a/odex25_transactions/exp_transaction_documents/email_templates/internal_templates.xml +++ b/odex25_transactions/exp_transaction_documents/email_templates/internal_templates.xml @@ -48,10 +48,12 @@- رابط المعاملة + + رابط المعاملة +
-+ تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
]]> @@ -245,11 +247,12 @@+
+ تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس ${user.company_id.name}
@@ -318,9 +321,12 @@- رابط المعاملة + + رابط المعاملة +
-+
+ تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس ${user.company_id.name}
@@ -381,9 +387,12 @@- رابط المعاملة + + رابط المعاملة +
+ تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس ${user.company_id.name}
@@ -437,10 +446,12 @@- رابط المعاملة + + رابط المعاملة +
- ${user.company_id.name} + تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
]]> @@ -507,11 +518,13 @@- رابط المعاملة + + رابط المعاملة +
- ${user.company_id.name} + تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
@@ -579,11 +592,13 @@- رابط المعاملة + + رابط المعاملة +
- ${user.company_id.name} + تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
@@ -651,11 +666,13 @@- رابط المعاملة + + رابط المعاملة +
- ${user.company_id.name} + تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
]]> @@ -708,10 +725,12 @@- رابط المعاملة + + رابط المعاملة +
- ${user.company_id.name} + تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
]]> diff --git a/odex25_transactions/exp_transaction_documents/email_templates/mail_notification_template.xml b/odex25_transactions/exp_transaction_documents/email_templates/mail_notification_template.xml new file mode 100644 index 000000000..81a7598a2 --- /dev/null +++ b/odex25_transactions/exp_transaction_documents/email_templates/mail_notification_template.xml @@ -0,0 +1,94 @@ + +
+ تم الإرسال بواسطة
+ تم الإرسال بواسطة + + + + + + + باستخدام + أودكس +
+
+ تم الإرسال بواسطة
- ${user.company_id.name} - - +
+ تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
@@ -113,12 +111,12 @@- رابط المعاملة + + رابط المعاملة +
-- ${user.company_id.name} - - +
+ تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
@@ -180,10 +178,12 @@- رابط المعاملة + + رابط المعاملة +
- ${user.company_id.name} + تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
@@ -235,12 +235,12 @@- رابط المعاملة + + رابط المعاملة +
-- ${user.company_id.name} - - +
+ تم الإرسال بواسطة ${user.company_id.name} باستخدام اودكس
diff --git a/odex25_transactions/exp_transaction_documents/models/__init__.py b/odex25_transactions/exp_transaction_documents/models/__init__.py index 852cb75bd..f84c9155d 100644 --- a/odex25_transactions/exp_transaction_documents/models/__init__.py +++ b/odex25_transactions/exp_transaction_documents/models/__init__.py @@ -7,4 +7,5 @@ from . import internal_transaction from . import outgoing_transaction from . import incoming_transaction from . import tools +from . import mail_thread # diff --git a/odex25_transactions/exp_transaction_documents/models/mail_thread.py b/odex25_transactions/exp_transaction_documents/models/mail_thread.py new file mode 100644 index 000000000..d380cf417 --- /dev/null +++ b/odex25_transactions/exp_transaction_documents/models/mail_thread.py @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- + +import re +import logging +from odoo import models, api + +_logger = logging.getLogger(__name__) + + +class MailMail(models.Model): + _inherit = 'mail.mail' + + @api.model + def create(self, vals): + """Override create to modify email HTML: fix logo and button colors""" + # Modify body_html before creating the record + if vals.get('body_html'): + body_html = vals['body_html'] + + # Fix logo path - use correct base URL + # Get base URL from system parameter OR company + base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + if not base_url: + try: + base_url = self.env.company.get_base_url() if hasattr(self.env, 'company') and self.env.company else '' + except: + base_url = '' + + if base_url: + logo_path = '/exp_transaction_documents/static/src/img/Odex-logo.png' + absolute_logo_url = '%s%s' % (base_url.rstrip('/'), logo_path) + + # Replace img tag src with absolute URL + def fix_logo_url(match): + img_tag = match.group(0) + # Remove loading="lazy" attribute + img_tag = re.sub(r'\s+loading\s*=\s*["\'][^"\']*["\']', '', img_tag, flags=re.IGNORECASE) + + # Replace src with absolute URL + if 'src=' in img_tag: + img_tag = re.sub( + r'src\s*=\s*["\'][^"\']*["\']', + r'src="%s"' % absolute_logo_url, + img_tag, + flags=re.IGNORECASE + ) + else: + if 'alt=' in img_tag: + img_tag = re.sub( + r'(alt=["\']ODEX["\'])', + r'\1 src="%s"' % absolute_logo_url, + img_tag, + flags=re.IGNORECASE + ) + else: + img_tag = img_tag.replace('