|  | # -*- coding: utf-8 -*-
"""
@Time    : 2024/07/28 07:28
@Author  : Jason Zou
@Email   : zou.jason@qq.com
@Company: 多度信息科技(南京)有限公司
"""
from odoo import models, api
class ReportBase(models.Model):
    _inherit = 'report.base'
    def select_sql_inherit(self, sql_type='out', sql_origin=''):
        return ''
    def from_sql_inherit(self, sql_type='out', sql_origin=''):
        return ''
    def where_sql_inherit(self, sql_type='out', sql_origin=''):
        return ''
    def group_sql_inherit(self, sql_type='out', sql_origin=''):
        return ''
    def order_sql_inherit(self, sql_type='out', sql_origin=''):
        return ''
    def get_context_inherit(self, sql_type='out', context=None):
        return {}
    def execute_sql_inherit(self, sql_type='out', sql_origin=''):
        context = self.get_context_inherit(sql_type, context=self.env.context)
        for key, value in list(context.items()):
            if key == "date_end":
                continue
            if key == "date_start":
                continue
            if isinstance(context[key], str):
                context[key] = value.encode('utf-8')
        search_sql = (self.select_sql_inherit(sql_type, sql_origin) + self.from_sql_inherit(sql_type, sql_origin)
                      + self.where_sql_inherit(sql_type, sql_origin) + self.group_sql_inherit(sql_type, sql_origin)
                      + self.order_sql_inherit(sql_type, sql_origin)).format(**context)
        self.env.cr.execute(search_sql)
        return self.env.cr.dictfetchall()
 |