Arthur Jochems (ajoc) 43f296177e [IMP] {mrp,stock}_account: cross analytics support
A recent feature in accounting (odoo#139225) introduces cross analytics,
which allows submitting multiple accounts per line (one account per
plan). This is not done, as would be assumed, by changing the
`account_id` field from a Many2One to a Many2Many, but by adding fields
to `account.analytic.line` every time a new root analytic plan is
created.

This approach has certain advantages, but a particular disadvantage is
that it becomes harder to update existing lines. For MRP, updating
rather unlink-recreating lines is important for employee time tracking,
where the analytic line will be updated every time the time worked is
updated, and the employee's wage can change between updates. In this
edge case, the accumulated cost must remain calculated at the old wage,
and newer costs must accumulate at the new, actual wage.

Concurrent closing line edge case
================================
An analytic distribution assigns divides an expense into smaller
expenses for analytic accounting. Typically, every fractional expense is
credited to a different analytic account, and they total to 100% of the
original expense. With multiple analytic plans, dividing that expense
can happen different ways. For example, one analytic plan may track
expenses per department, while another keeps track of expenses per
region. This means that an analytic distribution may contain accounts
belonging to different plans, with every plan dividing the original
expense in different ways across its own accounts. For cross accounting,
fractional expenses can be assigned simultaneously (i.e. on one line) to
multiple accounts (up to one per analytic plan). In our example, this
would mean that this fraction was spent by a specific department in a
specific region.

For an analytic distribution to be accurate, we must ensure that for
every plan, the sum of all accounts come out to the total percentage
(usually 100%) that was distributed in the first place. Because
multiplying large numbers with small percentages can introduce rounding
errors, we need to correct for any discrepancies. With one account per
line, this is easy; when a line closes out one of the plans in an
analytic distribution, we assign the exact outstanding amount for that
plan to that line, ensuring that the sum across all accounts adds up to
the exact total percentage of the expense that was divided in the first
place. Since every plan closes out on a different line, we can apply
this correction every time and the amounts are always correct across the
entire analytic distribution.

The problem with cross analytics, and thus multiple accounts per line,
is that a line can now sometimes close out two different plans, with
slightly different outstanding amounts. This means we can no longer
guarantee that every plan in an analytic distribution sums out to the
original expense. Luckily, only certain analytic distributions are
vulnerable to this edge case: they must distribute across multiple
plans, and must have at least one line where not all participating plans
are credited. There exists no trivial way to fix this. The current
implementation follows the approach of the accounting module, which
takes no special precautions against this edge case.

Part-of: odoo#146114

Task-3621105

Part-of: odoo/odoo#146114
2024-02-01 07:06:46 +00:00
2023-11-02 21:02:44 +00:00
…
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%