是否可以在Odoo中为财务报告创建自定义筛选器?

2024-06-15 06:22:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我开发了一个定制的财务报告,但我需要比本地的过滤器更多的过滤器

我已尝试在“account.report”模型中进行继承,添加如下筛选器:

class AccountReport(models.AbstractModel):
    _inherit = 'account.report'

    filter_column = True

然后在我的自定义报告中使用它:

class BudgetaryPositionCompanyReport(models.AbstractModel):
    _name = "budgetary.position.report"
    _inherit = "account.report"


    filter_column = {'field': 'planned', 'field': 'real'}

其思想是,根据我在“filter_column”上选择的内容,其中一列将显示一些数据,如果我选择另一个选项,它将显示另一个数据。但这份报告表现得好像过滤器根本不存在

实际上,这是我第一次在Odoo中使用Enterprise,所以我不知道如何使用正确的语法来生成报告及其过滤器。在谷歌上找不到太多。我唯一发现的是:PDF Tutorial。所以我不知道我的方法是否正确。有什么帮助吗


Tags: 数据模型report过滤器fieldmodels报告column