From 0bb89d760faba333dd7815f70aa5ba5a10f12de6 Mon Sep 17 00:00:00 2001 From: Ivan Office Date: Tue, 24 Oct 2023 17:52:09 +0800 Subject: [PATCH] update izi and common misc --- app_common/__manifest__.py | 28 +++++---- app_common/models/ir_ui_view.py | 2 +- app_common/models/mail_mail.py | 9 ++- app_common/static/description/index.html | 76 +++++++++++++++--------- 4 files changed, 74 insertions(+), 41 deletions(-) diff --git a/app_common/__manifest__.py b/app_common/__manifest__.py index ae90a3c3..cd0caeb8 100644 --- a/app_common/__manifest__.py +++ b/app_common/__manifest__.py @@ -38,8 +38,8 @@ ############################################################################## { - 'name': "odooai Odooapp Common Func", - 'version': '16.23.10.10', + 'name': "odooAi Common Util and Tools", + 'version': '16.23.10.24', 'author': 'odooai.cn', 'category': 'Base', 'website': 'https://www.odooai.cn', @@ -50,18 +50,25 @@ 'currency': 'EUR', 'images': ['static/description/banner.png'], 'summary': ''' - Core for common use odooai apps. + Core for common use for odooai.cn apps. 基础核心,必须没有要被依赖字段及视图等,实现auto_install ''', - 'description': ''' - Support Odoo 16, Enterprise and Community Edition + 'description': ''' need to setup odoo.conf, add follow: server_wide_modules = web,app_common - 1. - 2. - 3. Multi-language Support. - 4. Multi-Company Support. - 5. Support Odoo 16, Enterprise and Community Edition + 1. Quick import data from excel with .py code + 2. Quick m2o default value + 3. Filter for useless field + 4. UTC local timezone convert + 5. Get browser ua, user-agent + 6. Image to local, image url to local, media to local attachment + 7. Log cron job + 8. Boost for less no use mail + 9. Customize .rng file + 10. Misc like get distance between two points + 11. Multi-language Support. Multi-Company Support + 12. Support Odoo 17,16,15,14,13,12, Enterprise and Community and odoo.sh Edition. + 13. Full Open Source. ========== 1. 2. @@ -84,6 +91,7 @@ # 'pre_init_hook': 'pre_init_hook', # 'post_init_hook': 'post_init_hook', # 'uninstall_hook': 'uninstall_hook', + 'external_dependencies': {'python': ['pyyaml', 'ua-parser', 'user-agents']}, 'installable': True, 'application': True, 'auto_install': True, diff --git a/app_common/models/ir_ui_view.py b/app_common/models/ir_ui_view.py index 1ba89d75..1163b15e 100644 --- a/app_common/models/ir_ui_view.py +++ b/app_common/models/ir_ui_view.py @@ -23,7 +23,7 @@ def app_relaxng(view_type): relaxng_doc = etree.parse(frng) _relaxng_cache[view_type] = etree.RelaxNG(relaxng_doc) except Exception: - _logger.error('Failed to load RelaxNG XML schema for views validation') + _logger.error('You can Ignore this. Failed to load RelaxNG XML schema for views validation') _relaxng_cache[view_type] = None return _relaxng_cache[view_type] diff --git a/app_common/models/mail_mail.py b/app_common/models/mail_mail.py index 34e4de5b..1b8b6d92 100644 --- a/app_common/models/mail_mail.py +++ b/app_common/models/mail_mail.py @@ -11,6 +11,13 @@ class MailMail(models.Model): # 猴子补丁模式,改默认发邮件逻辑 def _send(self, auto_commit=False, raise_exception=False, smtp_session=None): for m in self: - if m.email_to and (m.email_to.find('example.com') != -1 or m.email_to.find('@odooai.cn') != -1 or m.email_to.find('@odooapp.cn') != -1): + email_to = m.email_to + # 忽略掉无效email,避免被ban + if email_to.find('no-reply@odooai.cn') != -1 or email_to.find('postmaster-odoo@odooai.cn') != -1: + pass + elif email_to.find('example.com') != -1 or email_to.find('@sunpop.cn') != -1 or email_to.find('@odooapp.cn') != -1: + _logger.error(_("=================Email to ignore: %s") % email_to) self = self - m + if not self: + return True return super(MailMail, self)._send(auto_commit, raise_exception, smtp_session) diff --git a/app_common/static/description/index.html b/app_common/static/description/index.html index ffd6b0fe..e9a0e234 100644 --- a/app_common/static/description/index.html +++ b/app_common/static/description/index.html @@ -1,8 +1,8 @@
-

-

+

odooAi Common Util and Tools

+

Network and media and base tools

Lastest update: v16.22.02.02

@@ -14,19 +14,59 @@
  • - Put key function here. + 1. Quick import data from excel with .py code
  • - 3. Multi-language Support. + 2. Quick m2o default value
  • - 4. Multi-Company Support. + 3. Filter for useless field
  • - 5. Support Odoo 16, 15, 14, 13, 12, 11, Enterprise and Community Edition. + 4. UTC local timezone convert +
  • +
  • + + 5. Get browser ua, user-agent +
  • +
  • + + 6. Image to local, image url to local, media to local attachment +
  • +
  • + + 7. Log cron job +
  • +
  • + + 8. Boost for less no use mail +
  • +
  • + + 9. Customize .rng file +
  • +
  • + + 10. Misc like get distance between two points +
  • +
  • + + 11. Multi-language Support. Multi-Company Support +
  • +
  • + + 12. Support Odoo 17,16,15,14,13,12, Enterprise and Community and odoo.sh Edition. +
  • +
  • + + 11. Multi-language Support. Multi-Company Support +
  • +
  • + + 13. Full Open Source.
@@ -40,33 +80,11 @@

Setup, please run the follow command to install the lib.

pip install pyyaml ua-parser user-agents

-
- -
+

After that, install the app_common

-
-
-

So Easy to navigator and search any data.

-

-
- -
-
-
- -
-
-

Multi-language Support..

-

-
- -
-
-
-