diff --git a/app_common/__manifest__.py b/app_common/__manifest__.py index e5e118cf..e49b6511 100644 --- a/app_common/__manifest__.py +++ b/app_common/__manifest__.py @@ -33,7 +33,7 @@ { 'name': "Sunpop Odooapp Common Func", - 'version': '13.21.06.13', + 'version': '13.21.08.19', 'author': 'Sunpop.cn', 'category': 'Base', 'website': 'https://www.sunpop.cn', @@ -70,6 +70,7 @@ # 'data/.xml', # 'views/ir_module_module_views.xml', # 'report/.xml', + 'views/ir_cron_views.xml', ], 'qweb': [ 'static/src/xml/*.xml', diff --git a/app_common/i18n/zh_CN.po b/app_common/i18n/zh_CN.po index f1e36e3e..a4f04c96 100644 --- a/app_common/i18n/zh_CN.po +++ b/app_common/i18n/zh_CN.po @@ -1,14 +1,31 @@ # Translation of Odoo Server. +# This file contains the translation of the following modules: +# * app_common # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" +"Project-Id-Version: Odoo Server 13.0+e\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-01-08 14:28+0000\n" -"PO-Revision-Date: 2018-01-08 14:28+0000\n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2021-08-19 09:28+0000\n" +"PO-Revision-Date: 2021-08-19 09:28+0000\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" + +#. module: app_common +#: model:ir.model.fields,field_description:app_common.field_ir_cron__trigger_user_id +msgid "Last Trigger User" +msgstr "手动运行用户" + +#. module: app_common +#: model:ir.model,name:app_common.model_ir_cron +msgid "Scheduled Actions" +msgstr "安排的动作" + +#. module: app_common +#: model:ir.model,name:app_common.model_ir_ui_view +msgid "View" +msgstr "查看" diff --git a/app_common/models/__init__.py b/app_common/models/__init__.py index b806789e..b9904014 100644 --- a/app_common/models/__init__.py +++ b/app_common/models/__init__.py @@ -26,4 +26,5 @@ from . import base from . import fields from . import view_validation from . import ir_ui_view +from . import ir_cron diff --git a/app_common/models/base.py b/app_common/models/base.py index fe928793..a621ed65 100644 --- a/app_common/models/base.py +++ b/app_common/models/base.py @@ -9,51 +9,9 @@ from io import BytesIO from datetime import date, datetime, time import pytz -# 常规的排除的fields -EXCLU_FIELDS = [ - '__last_update', - 'access_token', - 'access_url', - 'access_warning', - 'activity_date_deadline', - 'activity_exception_decoration', - 'activity_exception_icon', - 'activity_ids', - 'activity_state', - 'activity_summary', - 'activity_type_id', - 'activity_user_id', - 'display_name', - 'message_attachment_count', - 'message_channel_ids', - 'message_follower_ids', - 'message_has_error', - 'message_has_error_counter', - 'message_has_sms_error', - 'message_ids', - 'message_is_follower', - 'message_main_attachment_id', - 'message_needaction', - 'message_needaction_counter', - 'message_partner_ids', - 'message_unread', - 'message_unread_counter', - 'website_message_ids', - 'write_date', - 'write_uid', -] - class Base(models.AbstractModel): _inherit = 'base' - - @api.model - def _get_normal_fields(self): - f_list = [] - for k, v in self._fields.items(): - if k not in EXCLU_FIELDS: - f_list.append(k) - return f_list - + @api.model def _app_get_m2o_default(self, fieldname, domain=[]): if hasattr(self, fieldname) and self._fields[fieldname].type == 'many2one': diff --git a/app_common/models/ir_cron.py b/app_common/models/ir_cron.py new file mode 100644 index 00000000..0d5955ad --- /dev/null +++ b/app_common/models/ir_cron.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +import logging +from odoo import api, fields, models, modules, tools, _ + +_logger = logging.getLogger(__name__) + +class IrCron(models.Model): + _inherit = "ir.cron" + + trigger_user_id = fields.Many2one('res.users', string='Last Trigger User') + + def method_direct_trigger(self): + self.write({'trigger_user_id': self.env.user.id}) + return super(IrCron, self).method_direct_trigger() diff --git a/app_common/views/ir_cron_views.xml b/app_common/views/ir_cron_views.xml new file mode 100644 index 00000000..4ba63f0b --- /dev/null +++ b/app_common/views/ir_cron_views.xml @@ -0,0 +1,13 @@ + + + + app.ir.cron.tree + ir.cron + + + + + + + + \ No newline at end of file