Administration

Stored computed fields

dolixcalc · version 1.0.0

An extra field computed by a formula written without PHP, with its value stored: right in the lists, sortable, filterable and printable on PDFs.

Price
€49 excl. VAT
Dolibarr
19.0 minimum
Version
1.0.0
Licence
GPL v3+
Languages
French, English, German

Sold directly to businesses in France

Direct purchase, with immediate download and an invoice by email, is open to businesses and associations established in France, on the French page of this module. From elsewhere, write to support@dolix.fr.

Support and contact

Try it without installing anything: the online demo (login demo, password demo; sample data, reset every night; the demo is in French).

A rule of the module, with demo data: on order lines, the “Cartons” field is computed by the formula arrondi_sup(qty / produit.options_cond), which reads the packaging of the line's product. The test on an existing line gives 3, with the values read (quantity 30, packaging 12), without saving anything.
A rule of the module, with demo data: on order lines, the “Cartons” field is computed by the formula arrondi_sup(qty / produit.options_cond), which reads the packaging of the line's product. The test on an existing line gives 3, with the values read (quantity 30, packaging 12), without saving anything. Screenshot of the French-language interface.
01

What the module does

  • One rule: the kind of record, the extra field that receives the result (integer, decimal, price, text, date or checkbox) and the formula. Dolibarr's native computed fields are not offered as a target.
  • Supported records: products and services, third parties, contacts, members, commercial proposals, sales orders, customer invoices, and the lines of proposals, orders and invoices.
  • Formulas without PHP or SQL: operations, comparisons, and / or / not, if(), rounding, min, max, texts, dates (a date plus a number adds days, days_between, today()). Function names in English or French. A list inserts a field or a function at the cursor.
  • Linked records: produit.xxx for the product of a line, document.xxx for its document, tiers.xxx for the third party of a contact, a document or a line.
  • Sums, counts, averages, minimums and maximums over the lines of a document, with a condition if needed, and over the subscriptions of a member. An order can thus add up an extra field computed on its lines.
  • Value stored each time the record is created or modified, from the screen or the REST API; for a document, also when a line is added, modified or deleted; for a member, when a subscription is added, modified or deleted.
  • Since the value is in the database, it is the same on the record and in the list, and the list can be sorted and filtered on it. It prints on PDFs like any other extra field (checked with the eratosthene order template).
  • Never blocking: a formula in error leaves the field as it is, the record is saved, and the error is noted on the rule and in the log.
  • Test before saving: the formula is computed on an existing record, without saving anything, with the result and the values read.
  • Recompute all existing records of a rule, by batches, with the “Recompute now” button. Nightly scheduled job, disabled by default, for formulas that read another record.
  • Rules of the same kind of record are computed in the order of their position: a rule can read the result of a previous rule.
02

Who it is for

Dolibarr's computed fields are not stored in the database: a list cannot be sorted or filtered on them, and the value shown in a list can differ from the one on the record. In recent versions, the security rules for formulas prevent sums and reading another record, and the allowed functions are set in conf.php. As for the hidden option that stores these fields, it blocks saving the whole record as soon as a formula is in error.

Price including tax of a product, number of cartons of a line, total of an order, trade name of the third party on a contact: Dolibarr can display a computed field, but it does not store it.

  • The value is not in the database: a list cannot be sorted or filtered on it, and the value shown in a list can differ from the one on the record.
  • In recent versions, the security rules for formulas prevent sums and reading another record, and the allowed functions are set in conf.php.
  • The hidden option that stores these fields blocks saving the whole record as soon as a formula is in error.

The details, with formulas tried on Dolibarr 24: our note Computed fields in Dolibarr.

Who it is for: Dolibarr administrators who need a computed value that can be sorted, filtered or printed: price including tax of a product, number of cartons of a line, total cartons of an order, trade name of the third party on a contact, total subscriptions of a member, overdue invoice.

03

What the module does not do

This section appears on all 29 module pages, without exception.

  • After a Dolibarr import, values are not computed: the import writes straight into the database without telling the modules. Click “Recompute now”, or rely on the nightly job if it is enabled.
  • When a linked record changes (the product of a line, the third party of a contact), the value is not recomputed immediately: it follows at the next recompute, at the next change of the record or with the nightly job.
  • Ten kinds of records only: no supplier orders or invoices, no shipments, no projects, no objects of other modules.
  • A formula reads a fixed list of fields per kind of record (offered in the insert list), plus the extra fields. Linked records: the product, the document and the third party only. Sums only cover the lines of the document or the subscriptions of the member.
  • The result goes into an extra field you create yourself (integer, decimal, price, text, date or checkbox). Dolibarr's native computed fields cannot be a target.
  • The value is written directly to the extra field table, without running Dolibarr's triggers again.
  • The log keeps the last 1,000 errors; the tab shows the 200 most recent.
  • Interface in French, English and German. Function names in English or French.
  • Not tested: PostgreSQL, multicompany, Firefox and Safari browsers, PDF templates other than eratosthene, export.
04

How it works

A rule says which extra field to compute, and with which formula. The module computes the value and stores it in the field, which remains an ordinary Dolibarr extra field.

Records concerned

Products and services, third parties, contacts, members, commercial proposals, sales orders, customer invoices, and the lines of proposals, orders and invoices.

The field that receives the result is an extra field you create in Dolibarr: integer, decimal, price, text, date or checkbox. Dolibarr’s native computed fields are not offered as a target.

Formulas

They are written without PHP or SQL. A list inserts a field or a function at the cursor.

  • Numbers, texts in quotes, operations + - * /, comparisons, and, or, not.
  • Fields of the record by their name (qty, total_ht, price…), extra fields with options_ in front.
  • Linked records: produit.xxx for the product of a line, document.xxx for its document, tiers.xxx for the third party of a contact, a document or a line.
  • Sums over the lines of a document, with a condition if needed: sum(lines.qty; lines.product_type = 0); also count, avg, minimum, maximum. Over the subscriptions of a member: sum(subscriptions.amount).
  • Functions: if, round, ceil, floor, min, max, abs, today, days_between, year, month, upper, lower, len, empty, concat. A date plus a number adds days. French names work too (si, arrondi, somme…).

A few examples from the module’s help:

Value Record Formula
Price incl. tax Product round(price * (1 + tva_tx / 100); 2)
Cartons Order line ceil(qty / produit.options_cond)
Trade name Contact tiers.name_alias
Total subscriptions Member sum(subscriptions.amount)
Total cartons Order sum(lines.options_cartons)
Overdue invoice Invoice if(paye = 0 and date_lim_reglement < today(); "Overdue"; "")

When the value is computed

  • At each creation or modification of the record, from the screen or the REST API.
  • For a document: also when a line is added, modified or deleted. For a member: when a subscription is added, modified or deleted.
  • Rules of the same kind of record are computed in the order of their position: a rule can read the result of a previous rule.
  • Never blocking: a formula in error leaves the field as it is, the record is saved, and the error is noted on the rule and in the log.

Test, then recompute

  • Test on a record: the formula is computed on an existing record, without saving anything. The result is shown with the values read.
  • Recompute now: the rule’s button computes all existing records, by batches.
  • Nightly scheduled job, disabled by default: it recomputes all active rules, for formulas that read another record.

The “Cartons” rule of order lines: the formula reads the packaging of the line’s product. The test on an existing line gives 3, with the values read, without saving anything.

On the order, each line carries its number of cartons, computed and stored.

In the header of the same order, the total cartons and the number of lines are computed from the lines.

The product list sorted on the computed price including tax: the value is in the database, so Dolibarr’s sorting works.

The Help tab explains how to write a formula and gives examples.

The lines of a demo order: the “Cartons” field is computed and stored on each line, 3 for 20 coffees sold by cartons of 8, and 3 for 30 teas sold by cartons of 12.
The lines of a demo order: the “Cartons” field is computed and stored on each line, 3 for 20 coffees sold by cartons of 8, and 3 for 30 teas sold by cartons of 12. Screenshot of the French-language interface.
The header of the same order: “Total des cartons” (total cartons, 6) and “Nombre de lignes” (number of lines, 2) are fields computed by the module from the lines, and stored with the order.
The header of the same order: “Total des cartons” (total cartons, 6) and “Nombre de lignes” (number of lines, 2) are fields computed by the module from the lines, and stored with the order. Screenshot of the French-language interface.
The product list, sorted on the “Prix TTC” (price including tax) column computed by the module: since the value is stored, Dolibarr's sorting works (24, 14.4, 10.55, 8.44).
The product list, sorted on the “Prix TTC” (price including tax) column computed by the module: since the value is stored, Dolibarr's sorting works (24, 14.4, 10.55, 8.44). Screenshot of the French-language interface.
The Help tab of the module: how to write a formula (numbers, texts, operations, linked records, sums over lines or subscriptions, functions in French or English), then examples.
The Help tab of the module: how to write a formula (numbers, texts, operations, linked records, sums over lines or subscriptions, functions in French or English), then examples. Screenshot of the French-language interface.
05

Settings

Everything is set in SetupModules/Applications“Stored computed fields”, in three tabs.

Tab Content
Rules The list of rules (kind of record, computed field, formula, status, last error); “New rule”, edit, enable or disable, delete. Inside a rule: the formula, the position, the test on a record and “Recompute now”.
Error log Formula errors: date, rule, kind of record, record id, message. “Clear the log” button.
Help How to write formulas, examples, and when the value is computed.

Deleting a rule leaves the values already computed in the field; they are no longer updated. The module adds no setting constant.

The Rules tab of the module setup: each row gives the kind of record, the computed field, the formula and its status. It shows a sum of a member's subscriptions, a sum and a number of lines on orders, the cartons of a line, the third party's trade name on a contact, an overdue invoice and a date + 30.
The Rules tab of the module setup: each row gives the kind of record, the computed field, the formula and its status. It shows a sum of a member's subscriptions, a sum and a number of lines on orders, the cartons of a line, the third party's trade name on a contact, an overdue invoice and a date + 30. Screenshot of the French-language interface.
06

Security and safeguards

  • Administrators only: rules, test, recompute, log and help are refused to other users. The module adds no permission.
  • No PHP, no SQL in formulas: they are read and computed by the module, without eval. A formula is limited to 2,000 characters and 50 levels of parentheses.
  • Nothing is blocked: a formula error never prevents saving a record.
  • The module only writes into the fields chosen as the target of a rule, directly in the extra field table, without running Dolibarr’s triggers again.
  • The batch recompute only answers an administrator, with the session’s security token.
07

What you get

What the module writes to your installation
Database tables createdTwo tables. llx_dolixcalc_rule: the rules (kind of record, computed field, formula, enabled or not, position, last error and its date). llx_dolixcalc_log: the error log (rule, kind of record, record id, message, date); the module keeps its last 1,000 lines. Computed values are written to Dolibarr's extra field tables (llx_product_extrafields, llx_commandedet_extrafields…), in the fields you chose as targets. The module adds no setting constant.
PermissionsThe descriptor declares rights = array(): the module adds no permission. Rules, testing a formula, recomputing and the log are reserved for Dolibarr administrators. Computed values are ordinary extra fields: whoever sees the record sees the field, according to that field's visibility settings in Dolibarr.
Uninstalling
  • Disable the module in SetupModules/Applications. Records are saved normally; values are no longer recomputed.
  • Values already computed stay in the extra fields, which are ordinary Dolibarr extra fields. Deleting a rule also leaves them in place.
  • The llx_dolixcalc_rule and llx_dolixcalc_log tables are not deleted: when the module is enabled again, the rules are back.

The dolixcalc folder, in readable PHP, under the GPL v3 or later licence: the module descriptor, the trigger that computes the values, the formula engine, the three setup tabs, the batch recompute page, the SQL files of the two tables and the icons.

  • Languages: French (fr_FR), English (en_US) and German (de_DE).
  • A README.md and a ChangeLog.md.
  • No Dolibarr core file modified, nothing to add in conf.php.
  • Two tables: llx_dolixcalc_rule (the rules) and llx_dolixcalc_log (the error log, of which the module keeps the last 1,000 lines).
  • Computed values are written to Dolibarr’s extra field tables (llx_product_extrafields, llx_commandedet_extrafields…), only in the fields chosen as a target. No other field is changed.
  • Nothing leaves your server: the module calls no outside service.
  • When disabled, values already computed stay in the fields, and both tables stay in the database: when enabled again, the rules are back.
08

Compatibility

The module descriptor only declares a minimum version. No upper bound is written in the code: the versions below are those on which the module has actually been run.

Compatibility of the Stored computed fields module
Dolibarr versionsDolibarr 19.0 minimum. Installed and run on 19.0.4, 20.0.4, 21.0.4, 22.0.5, 23.0.4, 24.0.2 and 24.0.3.
Minimum PHP7.1
Dolibarr modules to enableNone
LicenceGPL v3 or later, full source code
LanguagesFrench, English, German
MenuNo menu entry. Rules are managed in SetupModules/Applications“Stored computed fields”, in three tabs: Rules, Error log, Help. Values are shown in the extra fields of records and lists.

The test results, Dolibarr version by version, are on the Compatibility tested page.

09

Installation

  1. Buy the module on dolix.fr (“Acheter directement” button, “Buy directly”, on the French module page), then download the zip.
  2. In Dolibarr: HomeSetupModules/Applications“Deploy/install external app/module” tab, then upload the zip. Otherwise, unzip the dolixcalc folder into htdocs/custom/.
  3. Enable “Stored computed fields” in the list of modules. The module's two tables and a nightly scheduled job, disabled, are created.
  4. Create the extra field that will receive the result (integer, decimal, price, text, date or checkbox) in the setup of the module concerned, for example the extra fields of products or of order lines.
  5. In the setup of “Stored computed fields”, Rules tab: “New rule”, choose the kind of record, the field and the formula, test it on a record, then save.
  6. To compute the records that already existed, click “Recompute now” in the rule. Records created or modified afterwards are computed on their own.
  7. Optional: for a recompute every night, enable the scheduled job “Computed fields: recompute all rules” (Dolibarr's Scheduled jobs module).

The details — permissions on the custom folder, shared hosting, upgrades, uninstalling — are on the page Installation and upgrades.

10

Frequently asked questions

Which Dolibarr versions does this module work on?

The descriptor requires Dolibarr 19.0 minimum. The module has been installed from its zip and run on 19.0.4, 20.0.4, 21.0.4, 22.0.5, 23.0.4 and 24.0.2 with PHP 8.2, and on 24.0.3 with PHP 8.5, with 39 tests out of 39 on each version, MariaDB. If you have any doubt about your installation, write before buying.

What is the difference with Dolibarr's computed fields?

Dolibarr's computed field is recomputed at display time and is not stored: no sorting or filtering in lists, and the value in the list can differ from the one on the record. Here, the value is stored in an ordinary extra field. The formula is not PHP: no list of functions to set in conf.php, and a formula in error does not block saving. Native computed fields are not changed by the module.

What happens after an import?

Dolibarr's import writes straight into the database without telling the modules: the values of imported records are not computed. Then click “Recompute now” in the rule, or enable the nightly scheduled job.

A product's packaging changes: do the lines already entered follow?

Not immediately. When a linked record changes (the product of a line, the third party of a contact), the value follows at the next recompute, at the next change of the record, or every night if the scheduled job is enabled.

Can a formula in error block saving a record?

No. The field keeps its value, the record is saved normally, and the error (division by zero, unknown field…) is shown on the rule and noted in the Error log tab. The log keeps the last 1,000 errors.

Who can create the rules?

Only Dolibarr administrators: the module's pages (rules, test, recompute, log, help) are refused to other users. The module adds no permission. Computed values are then shown like any other extra field.

Does the module change my records?

It only writes into the extra fields you chose as the target of a rule. It touches no other field, and no Dolibarr file is modified. The value is written directly to the extra field table, without running Dolibarr's triggers again.

Who handles support, and how do updates work?

Support is provided by the person who wrote the module, at support@dolix.fr. After buying on dolix.fr, the latest version can be downloaded for two years at dolix.fr/telecharger/, with the invoice number and the email address of the order. Direct purchase is reserved for businesses and associations established in France; otherwise, write to support@dolix.fr.

11

Version history

Taken from the module’s ChangeLog.md file: a single source.

1.0.025 October 2026

First version: rules that compute an extra field with a formula without PHP or SQL, on products, third parties, contacts, members, proposals, orders, invoices and their lines; linked records (product, document, third party); sums, counts, averages, minimums and maximums over lines and subscriptions; computed at each creation or modification (screen, REST API) and at each change of a line or a subscription; a formula in error never blocks, error in the log; test on a record without saving; recompute by batches and nightly job (disabled by default). Interface in French, English and German.

12

Support for this module

Write to support@dolix.fr. The person who wrote the module is the one who replies.

Reply within two working days. This is not an on-call service.

To include in your message

  • The exact Dolibarr version.
  • The module concerned and its version — here dolixcalc 1.0.0.
  • What you did, and what you expected.
  • The error message copied exactly, or a screenshot.
  • How Dolibarr is installed, if you know.

Sold directly to businesses in France

Direct purchase, with immediate download and an invoice by email, is open to businesses and associations established in France, on the French page of this module. From elsewhere, write to support@dolix.fr.

Support and contact
Also

The other modules

Multiple barcodes

dolixmultibarcode · v1.0.1

Several barcodes for one product: supplier code, old code, in-store label, pack code. Scanned in TakePOS, each code adds the product to the ticket with its quantity: the code of a pack of 6 adds 6 units.

Sold in FranceRead more

Orders to collect in TakePOS

dolixretrait · v1.0.2

The customer comes to collect a pre-order: one click in TakePOS copies it into the ticket, and after payment the order is classified billed, even if the weight changed.

Sold in FranceRead more

TakePOS cash closing

dolixcloture · v1.0.0

Bank deposits, withdrawals to the safe, cash in and cash expenses recorded from TakePOS, a count by notes and coins, and the discrepancy booked so that the cash account matches the drawer.

Sold in FranceRead more

For your sales of goods to consumers in other EU countries: the VAT rate of the customer's country, found from the product's customs code and the European Commission's official rates, draft invoices fixed in one click, tracking of the €10,000 threshold and the quarterly OSS return.

Sold in FranceRead more

Keyboard shortcuts

dolixshortcuts · v1.0.0

Ctrl+S (Cmd+S on Mac) saves the record you are filling in, without scrolling down to the button. g then a letter opens third parties, proposals, orders, invoices or products. ? shows the help.

Sold in FranceRead more

Google Contacts two-way sync

dolixgcontacts · v1.0.0

Dolibarr contacts and Google Contacts synced both ways, for each user. Only the contacts with the “Dolibarr” label in Google are involved, and a field changed on both sides is settled by the rule you chose.

Sold in FranceRead more

Dolix Coop

dolixcoop · v1.0.0

For cooperative and community grocery stores: shelf labels with the price per kilo or per litre, the customer's membership status in the TakePOS checkout, a simplified home page and menu for volunteers, a quick inventory on the phone.

Sold in FranceRead more