Odoo Community Association

Product Average Price From Invoices

Beta License: AGPL-3 OCA/account-invoicing Translate me on Weblate Try me on Runboat

This module computes, from posted invoices, two average prices and stores them on product templates and product variants:

Each one is a weighted average: the untaxed subtotal of the invoice lines divided by the invoiced quantity. Taxes and added costs (landed costs, for instance) are excluded, and so are refunds, as a returned quantity is not a price the product was traded at.

Both prices are company dependent: every company gets its own figures, computed from its own invoices and with its own window settings, so each one sees the prices it traded at.

Instead of a fixed period, an expanding window is used: the last 30 days are checked first and, while no invoiced quantity is found, the window is widened 30 days at a time up to 360 days. The first window with data wins, and the range it covers is stored next to the price, so the figure is always readable in context. Both the step size and the maximum number of steps are configurable.

Templates and variants are computed independently: a template averages the invoices of all its variants over a single window, a variant averages only its own. Because of that, they may end up using different periods.

Values are stored, not computed on the fly. They are refreshed by a daily scheduled action, and on demand from the product form, where the journal items behind each price can also be opened.

Table of contents

Usage

Consulting the prices

Go to a product template or a product variant, General Information tab, right below the Cost field see APP and ASP, each one followed by the period it was computed for (From … to …)

A price of 0.00 labelled No data means no invoiced quantity was found within the widest window. In that case no period is stored, and the arrow button opens an empty list.

What is shown always belongs to the active company. Switching companies shows the prices that company computed from its own invoices.

Refreshing automatically

The Update product average prices scheduled action runs every night and recomputes, for every company, the products it invoiced within the widest window, at both variant and template level. Its frequency can be changed in Settings > Technical > Scheduled Actions.

Configuring the window

Go to Settings > Accounting, section Product Average Prices. Both values belong to the active company:

  • Step size (days): length of each step of the window, 30 by default.
  • Max steps: how many times the window may be widened before giving up, 12 by default, so the search goes back 360 days at most.

Changing them does not recompute anything by itself. Stored prices keep the window they were computed with until the scheduled action or a button refreshes them.

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Tecnativa

Contributors

  • Tecnativa:
    • Eduardo Ezerouali
    • Pedro M. Baeza

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

eduezerouali-tecnativa

This module is part of the OCA/account-invoicing project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.