Hi, currently account.period is sorted by start_date and the end_date of a period is supposed it doesn't collide with the end_date of another one in reports such as the General Ledger.
That works like a charm until you find the Spanish Localization needs :-) In short: We need to create two special periods at the last day of the fiscal year, and with the current way of selecting the periods, there is no way to give them an order. We'd need that the order was set with a sequence (or similar) field and use that order when creating reports. Instead of filtering with "select all periods with date <= the end_period.end_date" we should "select all periods with sequence <= the end_period.sequence". In detail: In Spain, before closing a year we do two additional account moves: - The Profit & Loss move: which takes the balances of all Profit and Loss accounts and moves the total balance to a single balance account which will contain the profit or loss of the year. That means, that when the year will be closed the balance of all profit and loss accounts will be zero due to this account move. - The closing move: which takes makes that when closing the fiscal year all balance accounts will be zero. If an account has balance of +10, the account will be added in a move line with a -10, and so on. The result is that when the year is closed all accounts (P&L and balance) have a balance of zero. Then, the year is opened with the opening move, which looks like the closing one but with credit and debit exchanged. What we do in Tryton is create three special periods: opening (first day of fiscal year), p&l (last day of fiscal year) and closing (last day of fiscal year), so the user is able to see their reports with or without the p&l period and with or without closing period. As closing and p&l start and end on the same date (usually Dec 31th), there's no way the correct order is used in reports. -- Albert Cervera i Areny Consultor funcional Tel. 93 553 18 03 @albertnan www.NaN-tic.com Avís legal >>
