在搜索视图中按相关的one2many字段过滤

时间:2018-06-14 08:23:46

标签: odoo odoo-11

我继承了account.account模型并添加了与account.move.line模型相关的move_ids One2many字段:

[Thu Jun 14 13:25:48.134132 2018] [wsgi:error] [pid 21611] [remote 127.0.0.1:15106] mod_wsgi (pid=21611): Target WSGI script '/home/toto/Desktop/dash_test/dash_test/wsgi.py' cannot be loaded as Python module.
[Thu Jun 14 13:25:48.134152 2018] [wsgi:error] [pid 21611] [remote 127.0.0.1:15106] mod_wsgi (pid=21611): Exception occurred processing WSGI script '/home/toto/Desktop/dash_test/dash_test/wsgi.py'.
[Thu Jun 14 13:25:48.134167 2018] [wsgi:error] [pid 21611] [remote 127.0.0.1:15106] Traceback (most recent call last):
[Thu Jun 14 13:25:48.134182 2018] [wsgi:error] [pid 21611] [remote 127.0.0.1:15106]   File "/home/toto/Desktop/dash_test/dash_test/wsgi.py", line 11, in <module>
[Thu Jun 14 13:25:48.134203 2018] [wsgi:error] [pid 21611] [remote 127.0.0.1:15106]     from django.core.wsgi import get_wsgi_application
[Thu Jun 14 13:25:48.134216 2018] [wsgi:error] [pid 21611] [remote 127.0.0.1:15106] ImportError: No module named django.core.wsgi

所以现在我需要在搜索视图中按来自moves_ids的日期字段进行过滤。有没有办法做到这一点?

我需要这样的东西:

class ViewSumasYSaldos(models.Model):
    _inherit = "account.account"

    moves_ids = fields.One2many('account.move.line', 'account_id', string="Account moves")

1 个答案:

答案 0 :(得分:0)

我找到了解决方案并自己回答,

TEST-dbtest.DBSourceTest.xml

其中'self'是年份。