Files
public/rsbu_journal/models/rsbu_account.py

24 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from odoo import models
class RsbuAccount(models.Model):
"""Расширение плана счетов: наполнение хука агрегации данными журнала."""
_inherit = 'rsbu.account'
def _read_postings(self, domain=None):
"""Прочитать проведённые строки журнала для агрегации.
Переопределяет заглушку Этапа 1. Возвращает строки rsbu.move.line
по поддереву счёта, только проведённые (state='posted'), с учётом
дополнительного domain (период/компания) из вызывающего метода.
"""
self.ensure_one()
base_domain = [
('account_id', 'in', self._get_subtree_account_ids()),
('state', '=', 'posted'),
]
if domain:
# Отфильтровать по period/company — поля есть на строке (related).
base_domain += domain
return self.env['rsbu.move.line'].search(base_domain)