提交 a0843550 authored 作者: 贺阳's avatar 贺阳

Merge branch 'develop' into feature/PDA扫码揽收

# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
......@@ -41,6 +41,7 @@
'views/cc_history_package_good_view.xml',
'views/cc_history_ship_package_view.xml',
'views/cc_history_package_sync_log_view.xml',
'views/history_tt_api_log.xml',
'views/menu_view.xml',
# 'views/cc_customers_declaration_order_view.xml',
'templates/login.xml',
......
......@@ -15,3 +15,4 @@ from . import cc_history_big_package
from . import cc_history_package_good
from . import cc_history_ship_package
from . import cc_history_package_sync_log
from . import history_tt_api_log
......@@ -639,11 +639,13 @@ class CcBL(models.Model):
history_days = self.env['ir.config_parameter'].sudo().get_param('history_days') or 180
history_limit = self.env['ir.config_parameter'].sudo().get_param('history_limit') or 50
origin_delete = self.env['ir.config_parameter'].sudo().get_param('origin_delete') or 1
history_limit_log = self.env['ir.config_parameter'].sudo().get_param('history_limit_log') or 5000
redis_conn = self.env['common.common'].sudo().get_redis()
vals = {
'history_days': history_days,
'history_limit': history_limit,
'origin_delete': origin_delete
'origin_delete': origin_delete,
'history_limit_log': history_limit_log
}
redis_conn.lpush('history_data_list', json.dumps(vals))
......
# -*- coding: utf-8 -*-
# Part of SmartGo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError, Warning
import logging
_logger = logging.getLogger(__name__)
class HistoryTTErrorLog(models.Model):
_name = "history.tt.api.log"
_description = "tt推送日志"
_order = 'id desc'
big_bag_no = fields.Char('业务信息', index=True)
push_time = fields.Datetime('产生时间', index=True)
error_msg = fields.Char('失败原因')
success_bl = fields.Boolean('是否成功', default=False, index=True)
data_text = fields.Text('传输数据')
request_id = fields.Char('请求id', index=True)
source = fields.Selection([('推入', '推入'), ('推出', '推出')], string='类型', default='推入')
......@@ -74,3 +74,4 @@ access_cc_history_big_package_base.group_user,cc_history_big_package base.group_
access_cc_history_package_good_base.group_user,cc_history_package_good base.group_user,ccs_base.model_cc_history_package_good,base.group_user,1,1,1,1
access_cc_history_ship_package_base.group_user,cc_history_ship_package base.group_user,ccs_base.model_cc_history_ship_package,base.group_user,1,1,1,1
access_cc_history_package_sync_log_base.group_user,cc_history_package_sync_log base.group_user,ccs_base.model_cc_history_package_sync_log,base.group_user,1,1,1,1
access_history_tt_api_log_base.group_user,history_tt_api_log base.group_user,ccs_base.model_history_tt_api_log,base.group_user,1,1,1,1
\ No newline at end of file
......@@ -7,6 +7,7 @@
<field name="arch" type="xml">
<tree string="Ship Package" decoration-warning="is_cancel==True">
<field optional="show" name="state" string="Progress" widget="badge" decoration-info="1 == 1"/>
<field name="is_sync" string="是否同步"/>
<field optional="show" name="process_time"/>
<field optional="show" name="tracking_no" string="Tracking No."/>
<field optional="show" name="trade_no"/>
......
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
# ---------- TIKTOK推送日志 ------------
<record model="ir.ui.view" id="tree_history_tt_api_log_view">
<field name="name">tree.history.tt.api.log</field>
<field name="model">history.tt.api.log</field>
<field name="arch" type="xml">
<tree string="TIKTOK推送日志">
<field name="source"/>
<field name="big_bag_no"/>
<field name="push_time"/>
<field name="error_msg"/>
<field name="success_bl"/>
<field name="request_id"/>
<field name="create_date" optional="hide"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="form_history_tt_api_log_view">
<field name="name">form.history.tt.api.log</field>
<field name="model">history.tt.api.log</field>
<field name="arch" type="xml">
<form string="TIKTOK推送日志">
<sheet>
<group>
<field name="source"/>
<field name="big_bag_no"/>
<field name="push_time"/>
<field name="error_msg"/>
<field name="success_bl"/>
<field name="request_id"/>
<field name="data_text"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="search_history_tt_api_log_view">
<field name="name">search.history.tt.api.log</field>
<field name="model">history.tt.api.log</field>
<field name="arch" type="xml">
<search string="TIKTOK推送日志">
<filter string="今日日志"
domain="[('create_date', '&gt;=', (datetime.datetime.combine(context_today(), datetime.time(0, 0, 0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')), ('create_date', '&lt;', (datetime.datetime.combine(context_today(), datetime.time(0, 0, 0)).to_utc() + datetime.timedelta(days=1)).strftime('%Y-%m-%d %H:%M:%S'))]"
name="create_date"/>
<filter string="昨日日志"
domain="[('create_date', '>=', (datetime.datetime.combine(context_today() - datetime.timedelta(days=1), datetime.time(0, 0, 0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')), ('create_date', '&lt;', (datetime.datetime.combine(context_today(), datetime.time(0, 0, 0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"
name="last_24h"/>
<filter string="近7日日志"
domain="[('create_date', '>=', (datetime.datetime.combine(context_today() - datetime.timedelta(days=7), datetime.time(0, 0, 0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')),('create_date', '&lt;', (datetime.datetime.combine(context_today(), datetime.time(0, 0, 0)).to_utc() + datetime.timedelta(days=1)).strftime('%Y-%m-%d %H:%M:%S'))]"
name="last_7d"/>
<filter string="本周日志" name="this_week_log"
domain="[('create_date', '&gt;=', (datetime.datetime.combine(context_today() + relativedelta(weeks=-1,days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')),
('create_date', '&lt;', (datetime.datetime.combine(context_today() + relativedelta(days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/>
<filter string="上周日志" name="last_week_log"
domain="[('create_date', '&gt;=', (datetime.datetime.combine(context_today() + relativedelta(weeks=-2,days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')),
('create_date', '&lt;', (datetime.datetime.combine(context_today() + relativedelta(weeks=-1,days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/>
<!-- <filter string="本月日志" name="this_month_log"-->
<!-- domain="[('create_date','&gt;=', time.strftime('%Y-%m-1 00:00:00')),('create_date','&lt;',(context_today() + relativedelta(months=1)).strftime('%Y-%m-1 00:00:00'))]"/>-->
<!-- <filter string="上月日志" name="last_month_log"-->
<!-- domain="[('create_date','&lt;', time.strftime('%Y-%m-1 00:00:00')),('create_date','&gt;=',(context_today() - relativedelta(months=1)).strftime('%Y-%m-1 00:00:00'))]"/>-->
<filter string="近30日日志" name="last_30d"
domain="[('create_date', '>=', (datetime.datetime.combine(context_today() - datetime.timedelta(days=30), datetime.time(0, 0, 0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')), ('create_date', '&lt;', (datetime.datetime.combine(context_today(), datetime.time(0, 0, 0)).to_utc() + datetime.timedelta(days=1)).strftime('%Y-%m-%d %H:%M:%S'))]"/>
<separator/>
<field name="big_bag_no"/>
<field name="data_text"/>
<separator/>
<filter name="filter_success_bl" string="成功" domain="[('success_bl','=',True)]"/>
<filter name="filter_not_success_bl" string="失败" domain="[('success_bl','=',False)]"/>
<separator/>
<group expand="0" string="分组">
<filter domain="[]" name="groupby_success_bl" string="是否成功"
context="{'group_by': 'success_bl'}"/>
<filter domain="[]" name="groupby_big_bag_no" string="业务信息"
context="{'group_by': 'big_bag_no'}"/>
<filter domain="[]" name="groupby_source" string="类型"
context="{'group_by': 'source'}"/>
</group>
<searchpanel>
<field icon="fa-users" select="multi" name="source"/>
</searchpanel>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_history_tt_api_log">
<field name="name">TIKTOK推送日志</field>
<field name="res_model">history.tt.api.log</field>
<field name="view_mode">tree,form,search</field>
<field name="domain">[]</field>
<field name="context">{'search_default_last_30d':1}</field>
</record>
</data>
</odoo>
\ No newline at end of file
......@@ -61,5 +61,7 @@
<menuitem parent="menu_cc_history_data" sequence="3" name="History Ship Package" id="menu_cc_history_ship_package" action="action_cc_history_ship_package"/>
<menuitem parent="menu_cc_history_data" id="menu_history_flight_tt_api_log" name="TIKTOK推送日志" sequence="7" action="action_history_tt_api_log"/>
</data>
</odoo>
\ No newline at end of file
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论