Budget Blueprint

Continuing the discussion from Add support for budget:

Rational

Tryton should allow to enter budget for accounts or analytic accounts.
A budget is a plan over a period to define the balance per sets of accounts.

Proposal

It should be possible to define a budget based on accounts or analytic accounts.
It should be possible to compare actual with budget.

Implementation

account_budget should define Mixin to be reused for other similar modules.

Budget

account.budget

  • name: Char
  • company: Many2One to company.company
  • fiscalyear: Many2One to account.fiscalyear
  • parent: Many2One to account.budget
  • children: One2Many to account.budget
  • amount: Numeric in company currency
  • accounts: Many2Many of account.account
  • balance: Function of Numeric with the sum of accounts balance over the fiscal year including the children budget.
  • periods: One2Many to account.budget.period

sum of period must be <= than amount
sum of children must be <= than amount
account must be only once per budget root

account.budget.period

  • budget: Many2One to account.budget
  • period: Many2One to account.period
  • amount: Numeric in company currency
  • balance: Function of Numeric with the sum of accounts balance over the period.

Unique per budget and period

A wizard should allow to copy the entire budget tree but changing the fiscal year by a new one (skipping the period as no direct link could be done). It must also have an option to zero the amount.
A wizard should allow to distribute the amount of a budget over all the period using a selected method (default: evenly).

Analytic Budget

analytic_account.budget

Same as account.budget but over date period.

Future Improvements and Ideas

  • Modules base on sale, project etc.
  • Budget debit/credit amount

Implementation

Accounting & Analytic Budget: https://bugs.tryton.org/issue6089

1 Like

Could you clarify which is this objective of this Mixin, and which structure should define?

We should be able to reuse most of the code from account_budget for analytic_account_budget.

Acknowledged.

By the way, on the analytic module we should also have the period distribution? If so I understand we must create a period based on a end_date and the dates must not overlap.

What about the distribute wizard? Shall we also support period distribution? If so, how we create the dates? Based on a selection method? For example create monthly and 3-months periods based on the fiscalyear start and end dates (similare to the create period button from the fiscalyear)?

I do not think there must be any period with distribution kind.

No, distribution of budget will always be custom and so done using a wizard to just fill the budgets of an account over a selected set of periods.

Thanks for your comments, I have added the implementation of both account_budget and analytic_budget modules, so I think we are now ready for testing. See: Issue 6089: Budget module - Tryton issue tracker

To achieve that I think we should not use a Many2Many but a Many2One.
This will also simplify the naming because we could use the account name when filled and only make required to fill a name for budget line without account (a kind of group).

I think it is better to use a ratio percentage. Like that if the parent amount is modified, the period amount is recomputed automatically.

Indeed I think it is more powerful to provide a percentage to apply on amounts.

I think we should keep the Many2Many to allow including expenses from several accounts into a single budget. Otherwise we are forcing the user to create a budget for each account which is not usable.

I see two possiblities here:

  • Use a parent amount and distribute its children using ratios
  • Set an amount for all the children and let the system compute the parent amount.

So I think we should keep both fields.

Why would it not be usable. SAP is working like that.

I do not see the point to make this more complicated by having top-bottom and bottom-top behavior.

Then there is something that I do not understand.

I have two accounts for revenues that I want to include into a single budget item. How can I achieve that with a many2one?
This is common when selling goods and services as the budged is for the full revenue but for accounting the services and goods are splited into two accounts.

The same can be applied for expenses, for example operational expenses include several accounts.

You create a line without any account and on this line two children with each account. Then you put the amount on the parent line (or on the children if you want).

But this forces the user to create a budget for each account, which makes the setup more complex.

What you propose can be also achieved with the Many2Many if the user prefers (by just selecting a single account on the relation).

The benefit of using the Many2Many is that it simplies the widget setup with multiple accounts by allowing the user to include multiple accounts by just selecting them instead of creating a line for each.

For example, when creating a budget that Mimics the Spanish Income Statement, we will force the user to create a line for each account, while he is interested only on having the budget of each type. Looking at the PYME Chart of accounts we have 21 types for the income statement while having 238 accounts linked to the same type.

With the Many2One, the user will be forced to always create (at least) 238 budget items, which is more time consuming that create just 21 budget items.

Indeed, I do not see why the Many2One will help to test if the account is used multiple times per root, as we will need to check the full tree each time a budget item is updated, which is exactly the same with the Many2Many design.

This will simply be done with SQL unique constraint.

The same can be done with the Many2Many by materializing the root of the account.

Only if it is a One2Many so it is the same as having a Many2One.

Not sure to follow you.

For me is clear that from the user point of view it should be a Many2Many widget (to allow selecting multiple accounts for the same budget) to simplify the definition of the types.

How the data is internally stored and how the unique constraint is validated is a implementation detail that we should not care at the blueprint discussion.

I have uploaded a new version which should help to understand my design proposal.

I just tested the last review uploaded with the spanish chart of account and I will explain why I think this is not usable (or at least so complex to be used).

My objective is to compare the real Profit and Loss with a budget that we prepared in advance. To achive it, I create a new budget enter the fiscalyear and click the “Fill lines” button. This is what I get:

What I want to ilustrate is that I just get 238 budget lines that does not tell anything to me. Of course I can just create a line for each type and assign it’s accounts to it. But this is something that tryton already knows for me and I do not think we should force our users to spend so much time on this process.

So my first question is: “Is an easy way to create a budget that mimics the Income Statement”?

What I’m trying to achieve is what is shown in a blog post descriving the bugdet functionalities of A3ERP, of one of the Spanish Account systems that have Budget features. The post is in spanish but you can see in the screenshoots

Well you can not have both the P&L structure and the freedom of any structure.

Why not? For me the P&L structure is “any structure”. We just need to have an easy way to create it

To be honest, with the Many2Many widget this was easier to setup because the user just need to create the same budgets as the type and add the related accounts using the type filter.

The P&L structure is just an example, but I will expect that “any structure” will include more than a single account, so having the Many2Many widget allows to easly find them and add them in a bunch instead of creating a line for each item.

On the other hand, the fill lines button allows to easly spot the accounts that are not missing on the chart and this is a nice feature so I’m wondering if it makes sense to have a Function field which shows the accounts that are not included on the budget. This may be usefull to easly spot that a new account have been created by some user on the system and this account should be included on the budget.