GoodERP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.5KB

  1. # -*- coding: utf-8 -*-
  2. """
  3. @Time : 2024/07/28 07:28
  4. @Author : Jason Zou
  5. @Email : zou.jason@qq.com
  6. @Company: 多度信息科技(南京)有限公司
  7. """
  8. from odoo import models, api
  9. class ReportBase(models.Model):
  10. _inherit = 'report.base'
  11. def select_sql_inherit(self, sql_type='out', sql_origin=''):
  12. return ''
  13. def from_sql_inherit(self, sql_type='out', sql_origin=''):
  14. return ''
  15. def where_sql_inherit(self, sql_type='out', sql_origin=''):
  16. return ''
  17. def group_sql_inherit(self, sql_type='out', sql_origin=''):
  18. return ''
  19. def order_sql_inherit(self, sql_type='out', sql_origin=''):
  20. return ''
  21. def get_context_inherit(self, sql_type='out', context=None):
  22. return {}
  23. def execute_sql_inherit(self, sql_type='out', sql_origin=''):
  24. context = self.get_context_inherit(sql_type, context=self.env.context)
  25. for key, value in list(context.items()):
  26. if key == "date_end":
  27. continue
  28. if key == "date_start":
  29. continue
  30. if isinstance(context[key], str):
  31. context[key] = value.encode('utf-8')
  32. search_sql = (self.select_sql_inherit(sql_type, sql_origin) + self.from_sql_inherit(sql_type, sql_origin)
  33. + self.where_sql_inherit(sql_type, sql_origin) + self.group_sql_inherit(sql_type, sql_origin)
  34. + self.order_sql_inherit(sql_type, sql_origin)).format(**context)
  35. self.env.cr.execute(search_sql)
  36. return self.env.cr.dictfetchall()
上海开阖软件有限公司 沪ICP备12045867号-1