This commit is contained in:
ivan deng
2021-08-19 17:36:29 +08:00
parent dae7f8d8d3
commit 24426d6545
6 changed files with 53 additions and 48 deletions

View File

@@ -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',

View File

@@ -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 "查看"

View File

@@ -26,4 +26,5 @@ from . import base
from . import fields
from . import view_validation
from . import ir_ui_view
from . import ir_cron

View File

@@ -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':

View File

@@ -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()

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<odoo>
<record id="app_ir_cron_view_tree" model="ir.ui.view">
<field name="name">app.ir.cron.tree</field>
<field name="model">ir.cron</field>
<field name="inherit_id" ref="base.ir_cron_view_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='active']" position="before">
<field name='trigger_user_id' optional="show"/>
</xpath>
</field>
</record>
</odoo>