Purchasing and stock

Landed costs

dolixapproche · version 1.0.1

You spread freight, customs and the other costs of a shipment over the cost of products and their weighted average price.

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

€99 excl. VAT.

Ordering, payment, invoicing and download are handled by the DoliStore.

Buy on the DoliStore — €99 excl. VAT
One container, two suppliers, three costs: freight by weight, customs by value, forwarder equally. The landed cost of each product is calculated to the cent, applied before receiving, and recorded in the log.
One container, two suppliers, three costs: freight by weight, customs by value, forwarder equally. The landed cost of each product is calculated to the cent, applied before receiving, and recorded in the log. Screenshot of the French-language interface.
01

What the module does

  • A shipment file groups one or more purchase orders, from different suppliers if needed: a truck, a container. Draft orders are not offered.
  • Five cost types: freight, customs duties and taxes, insurance, forwarder, other. Each cost has an amount excluding tax and, if you wish, the matching supplier invoice, linked to find the document.
  • Four spread keys, cost by cost: by value (net line amount, discount deducted), by quantity, by weight (from the product card, converted to kg from t, g, mg, pound or ounce) or equally between lines.
  • Calculation to the cent: rounding cents go to the lines whose share has the largest remainder, and the amount spread always equals the amount of the cost. A negative cost, a credit note for example, is spread the same way.
  • Allocation table line by line: quantity, quantity already in stock, net purchase price, unit weight, allocated costs, costs per unit and landed unit cost. A cost that cannot be spread — missing weight, zero basis — blocks the application and the products concerned are named.
  • Apply before receiving: the landed cost is written on the lines of the receptions still in draft. When the reception is validated, Dolibarr computes the weighted average price with this cost, using its own formula.
  • Apply after receiving: the weighted average price is corrected product by product, on the part still in stock only (current stock / stock right after receiving). The part already gone is not revalued.
  • Log of every change and all-or-nothing undo, refused if a reception has been validated, a cost changed or a weighted average price changed since. Option: update the products' cost price as well, undone with the rest. Tab on the purchase order, reminder when an order is also in another file, multi-company respected.
02

Who it is for

The carrier and the forwarder invoice separately, and the weighted average price of your products only reflects the purchase price: stock value and margins are wrong.

A truck brings in goods from two suppliers. The carrier, a third supplier, invoices separately. So do the forwarder and customs.

In Dolibarr, a product’s weighted average price (WAP) is computed when stock comes in, from the purchase price only. Landed costs are not spread over any product: stock value is understated and margins are overstated. The only native way is to correct the price at reception, by hand, line by line.

Who it is for: Traders and importers who receive goods from several suppliers in the same truck or container, and pay freight, customs or the forwarder on separate invoices.

03

What the module does not do

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

  • No accounting entry and no invoice is changed: the module acts on reception costs, the weighted average price and, as an option, the cost price.
  • Prices are taken in the company currency: multicurrency is not taken into account.
  • No customs tariff by commodity code and no customs value calculation: duties are entered as an amount and spread like the other costs.
  • No spreading by lot or serial number. Only products receive costs: service lines and free-text lines are excluded.
  • Applying before receiving requires the Receptions module and a draft reception. If stock is updated when the purchase order or the supplier invoice is validated, neither application is possible.
  • Quantities not yet received at the time of the application get no costs. A warning says so before you confirm.
  • The weighted average price correction after receiving is written directly on the product: no stock movement is created. An applied file can no longer be edited until the application is undone.
  • The same order can be in two files: the module reminds you but does not prevent it. Order selection covers the 500 most recent purchase orders, and invoice linking the 300 most recent supplier invoices.
04

How it works

The module creates a shipment file: a truck, a container. You add the purchase orders that arrived together, even from different suppliers, then the costs.

The costs: a label, a type — freight, customs duties and taxes, insurance, forwarder, other —, an amount excluding tax and, if you wish, the matching supplier invoice. This link is there to find the document: no accounting entry is changed.

The spread, cost by cost:

Key Basis for each line
By value net amount of the order line, discount deducted
By quantity quantity ordered
By weight quantity × weight from the product card, converted to kg from t, g, mg, pound or ounce
Equally one share per product line

The calculation is done to the cent. Rounding cents go to the lines whose share has the largest remainder: the amount spread always equals the amount of the cost. A negative cost, a credit note for example, is spread the same way. A cost that cannot be spread — a product without a weight for a spread by weight, a zero basis — blocks the application, and the products concerned are named.

Before or after receiving

Before receiving. The landed cost (net purchase price + costs per unit) is written on the lines of the receptions still in draft. When the reception is validated, Dolibarr itself computes the WAP with this cost, using its own formula. The module does not rewrite that calculation.

After receiving, when the carrier’s invoice arrives later. The WAP is corrected product by product, on the part still in stock only: the share of the costs applied is current stock / stock right after receiving. The part already gone is not revalued, and past margins do not change.

What is possible depends on how your purchases enter stock:

Stock entry for purchases Before receiving After receiving
Validation of a reception (Receptions module) yes yes
Dispatch from the purchase order, without the Receptions module no yes
Validation of the purchase order or the supplier invoice no no

In the last case, the module finds no received quantity and cannot apply anything.

The log and undo

Every changed value is recorded with the old and the new value, the quantity, the stock and the amount. The application can be undone, all or nothing, as long as nothing has moved: reception still in draft, line cost, WAP and cost price unchanged. If a single product has changed, nothing is undone and the reason is shown product by product.

The menu is under ProductsWarehousesLanded costs.

A shipment file fits on one page. In the screenshot, the file “Conteneur Le Havre — semaine 41” groups two orders from two suppliers, 5,000 and 15,000 excluding tax, and three costs: 4,000 of sea freight by weight, 1,200 of customs duties by value, 300 of forwarder fees equally.

The “Répartition” (Allocation) table gives, for each line, the quantity, the quantity already in stock, the net purchase price, the unit weight, the allocated costs, the costs per unit and the landed unit cost: 77.35710 for the drill and 59.21430 for the drill bit set, both bought at 50. The allocated costs add up to 5,500.00 again. The file is “Appliqué avant réception” (Applied before receiving); the log shows, line by line, the reception cost before and after.

On the purchase order, the “Frais d’approche” (Landed costs) tab lists the shipment files that contain the order, with their status. The + button creates a new file with this order already added.

From the purchase order, the “Frais d'approche” (Landed costs) tab shows the shipment files that contain it, and lets you create a new one with this order.
From the purchase order, the “Frais d'approche” (Landed costs) tab shows the shipment files that contain it, and lets you create a new one with this order. Screenshot of the French-language interface.
05

Settings

Setting Default Effect
Also update the product cost price disabled The cost price on the product card takes the landed cost of the last applied shipment. It is set back to its previous value if the application is undone.

Only the products actually processed are changed. A product on several lines takes the average of its landed costs, weighted by quantity.

06

Security and safeguards

  • Two dedicated permissions: “Read shipment files” and “Create, edit and apply shipment files”. Without the second one, files can still be viewed but no button is displayed, and a forced write is refused.
  • Anti-CSRF token checked on every action that writes, including the setup page, which is restricted to administrators.
  • Confirmation before applying, undoing or deleting a file. Before applying, the window reports the order lines that are not fully received or in a reception.
  • Transactions: an application or an undo that fails along the way writes nothing.
  • Applied file locked: neither orders nor costs can be changed until the application is undone.
  • Purchase order tab subject to the same access checks as Dolibarr’s purchase order card.
  • Multi-company: files, orders, invoices and stock limited to the authorised entities.
07

What you get

What the module writes to your installation
Database tables createdFour tables: llx_dolixapproche_dossier (shipment files: reference, label, arrival date, status, note), llx_dolixapproche_order (purchase orders attached to each file), llx_dolixapproche_frais (costs: label, type, amount excluding tax, spread key, linked supplier invoice) and llx_dolixapproche_journal (every changed value, with the old and new value, quantity, stock and amount, so it can be undone).
PermissionsTwo permissions: “Read shipment files” and “Create, edit and apply shipment files”. Without the second one, files can still be viewed but no button is displayed. The tab on the purchase order is also subject to the same access checks as Dolibarr's purchase order card. The setup page is restricted to administrators.
Uninstalling
  • Disable the module in SetupModules/Applications. The menu and the purchase order tab disappear.
  • Reception costs, weighted average prices and cost prices already applied stay as they are. To go back to the previous values, undo the application before disabling.
  • The four llx_dolixapproche_* tables and the module's setting are not deleted.

The dolixapproche folder, complete and readable source code, under GPL v3 or later: the module descriptor, the screens (list, shipment file card, purchase order tab, setup page), the calculation and application classes, the SQL scripts for the tables and the icons.

Languages French (fr_FR), English (en_US), German (de_DE)
Documentation README.md and ChangeLog.md in the module folder
Minimum Dolibarr version 19.0, declared in the descriptor
Versions the module has been installed and run on 19.0.4, 20.0.4, 21.0.4, 22.0.5, 23.0.4, 24.0.1 and 24.0.2
Minimum PHP 7.4
Required Dolibarr modules Vendors, Stocks
Recommended Dolibarr module Receptions, to apply before receiving

No maximum version is set in the module.

  • Four tables are added: llx_dolixapproche_dossier (the files), llx_dolixapproche_order (the attached orders), llx_dolixapproche_frais (the costs) and llx_dolixapproche_journal (every changed value, with the old one).
  • What the module writes outside its own tables, and only when you apply or undo: the cost of draft reception lines, the products’ WAP and, if the option is ticked, their cost price. No invoice and no accounting entry is touched.
  • One setting is stored: DOLIXAPPROCHE_UPDATE_COST_PRICE.
  • No outgoing connection: nothing is sent anywhere.
  • When disabled, the menu and the tab disappear. Costs, WAPs and cost prices already applied stay as they are: undo the application before disabling if you want to go back. The four tables, with the log, and the setting are not deleted.
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 Landed costs 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.1 and 24.0.2.
Minimum PHP7.4
Dolibarr modules to enableVendors, Stocks
LicenceGPL v3 or later, full source code
LanguagesFrench, English, German
MenuProducts menuWarehouses“Landed costs”, and “Landed costs” tab on the purchase order card.
09

Installation

  1. Get the module from the DoliStore and download the zip file.
  2. In Dolibarr: HomeSetupModules/Applications“Deploy/install external app/module” tab, then upload the zip. Otherwise, unzip the dolixapproche folder into htdocs/custom/.
  3. Enable “Landed costs” in the list of modules. The Vendors and Stocks modules are enabled if they were not already, and the four tables are created at that point.
  4. Grant the users concerned the “Read shipment files” permission, and “Create, edit and apply shipment files” to those who apply the costs.
  5. To apply before receiving, use the Receptions module and create the reception without validating it. Optional: tick the cost price update in the module's setup page.

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 and PHP 7.4 minimum. The module has been installed and run on 19.0.4, 20.0.4, 21.0.4, 22.0.5, 23.0.4 and 24.0.1. If you have any doubt about your version, write before buying.

The carrier's invoice arrives after receiving. Is it too late?

No. Applying after receiving corrects the weighted average price of the products already in stock, on the part still there only. The part already sold is not revalued: past margins do not change. If everything has already gone, the product is skipped and the reason is displayed.

Does the module change my accounting?

No. No accounting entry and no invoice is changed. The supplier invoice linked to a cost is only there to find the document. The module writes the cost of draft reception lines, the products' weighted average price and, if the option is ticked, their cost price.

I do not use the Receptions module. Does the module work?

Partly. If you dispatch stock entries from the purchase order, only applying after receiving is possible: there is no draft reception to write the cost on. If stock is updated when the purchase order or the supplier invoice is validated, the module sees no received quantity and cannot apply anything.

Can an application be reversed?

Yes, as long as nothing has moved: reception still in draft, line cost, weighted average price and cost price unchanged. Undo then restores all the previous values. If a single product has changed, nothing is undone and the reason is shown product by product.

What if I uninstall?

The menu and the tab disappear. Weighted average prices and costs already applied remain: they are data in your database. The module's tables, with the log, also remain; you can delete them yourself.

Who handles support, and how do updates work?

Support is provided by the person who wrote the module, at support@dolix.fr. Ordering, payment, the invoice and the download are handled by the DoliStore, where new versions are published.

11

Version history

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

1.0.114 October 2026

Fix: a shipment file page opened without a valid file, or “New file” opened without write permission, showed the menus twice and wrote PHP warnings to the server log. The refusal message is now shown once. No data was affected.

1.0.012 October 2026

First version: shipment file grouping one or more purchase orders, from different suppliers if needed; costs spread by value, by quantity, by weight or equally, to the cent; linked supplier invoice for traceability; application before or after receiving; log and all-or-nothing undo; cost price option; tab on the purchase order; 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 dolixapproche 1.0.1.
  • What you did, and what you expected.
  • The error message copied exactly, or a screenshot.
  • How Dolibarr is installed, if you know.

This module is on sale on the DoliStore.

Ordering, payment, invoicing and download are handled by the DoliStore.

Buy on the DoliStore — €99 excl. VAT
Also

The other modules