View source | View content page | Page history | Printable version   




The following requirements are behind this development:


Having a multi-organizational ERP platform has quickly shown the need for the product costing that is multi-org and multi-warehouse as well.

Functional Specification

Users and Roles

Product costing relates to three important but different processes:

  1. Calculating or updating the actual costing of a product
  2. Using the product costing value in order to post relevant documents to the general ledger
  3. viewing the value of inventory (reporting)

The users and roles involved are directly related to the above processes.

Core Roles

Let's see how the standard set of roles available in core Openbravo 3 are involved in the above processes:

Additional Roles

One process not covered by the core footprint of Openbravo 3 and the roles included is production. A floor manager enters Work Efforts that are the source data for calculating the costing of final products manufactured by that process.

User Stories

Story 1 - Configuration

As part of the initial ERP setup, Ana, the company's accountant sets up the following:

Specifically, the two products are configured as:

Story 2 - Ordering Goods

Jane orders 400 units of Ale Beer from Happy Drinks vendor to the east coast headquarters of F&B in US by filling out and completing a standard Purchase Order.

She fills in a separate order to the same vendor for 600 units of Lager Beer, ordered and to be delivered to the west coast headquarters.

Story 3 - Receiving Goods

Mike who works in warehousing receives a package that contains items that have been ordered a week ago by Jane. He creates a Goods Receipt with the corresponding lines, recording the receipt of 400 units of Ale Beer into the East. He completes the Goods Receipt and views the posting that should be automatically be done within a minute or so.

Story 4 - Calculating Average Cost

Ana from accounting triggers the Generate Average Cost process in order to recalculate them based on previous orders and receipts.

Looking into the Costing tab of both products (Ale and Lager beer), she should now see a new record that represents the new stock value of those products.

Story 5 - Moving Goods

Mike moves 200 units of Ale Beer from east coast warehouse to the west coast. The following posting should be generated????????????

Story 6 - Production of Goods

Processes affected

Processes that generate product costs

Accounting processes

Here is an overview how accounting postings are done and sequenced:

Product cost postings.png


The Valued Stock Report uses product costing to display the value of inventory on a given date.

Technical Specification


Implementation of new costing features will be delivered as part of the core. No new modules are required. A new architecture of business events shall be used and the old stored procedures deprecated.

Data Model


The following properties of the Costing entity play a significant role in the average cost calculation:

A new property needs to be added:

Deprecated elements

The following elements are to be deprecated due to the new automatic cost calculation instead of old manual batch calculation done by stored procedures:

New Business Events

Processes to review


Q: Is M_Costing.C_Invoiceline_ID used at any point?

A: Yes it is used in the existing/old calculation when only an invoice is available as the price source for the average calculation.

Q: Is IsPermanent flag ever set to Y and what does it mean if it is? I could not find any business logic that uses the Y value.

A: It is always set to N by the calculation process and must be manually set to Y for records that the batch calculation process should not delete on the next run (M_Generate_average_costs deletes all records with IsPermanent=N on every run)

Q: How is CumQty calculated?

A: It is calculated based on current stock at that given date, i.e. previous quantity minus all goods shipment plus all goods receipts)

Q: What does the manual check mean?

A: It is used to distinguish between an entry done by the process (Not manual) and a manual entry into the Costing tab. However, what is confusing for the end user is the ability to set this to any record. It should be readonly and automatically set by the system to Y when manually adding records and N otherwise.

Q: Where is the posting accounting class for the following docs that post using the costing value:


Q: What is the difference between a Purchase Invoice and a Matched Invoice?

A: Matched invoice is a document that links a goods receipt with a purchase invoice. This document's entries are stored in M_MatchInv table. It is used in order to post differences between the posting of the goods receipt which derives from prices in the Purchase Order and the actual final prices on the Purchase Invoice.

Q: When is the value of the Product >> Standard Cost field used?

A: We have no clue...probably never

Q: When running the Generate Average Costs process, the following message can be received by the user:

One or more Goods Receipt documents are posted using a cost that will be modified if the Generate Average Cost process is run. Please unpost the document with Document No. "

What does that mean and why is it happening?

A: This is a weird behaviour that is very difficult for the end-user to understand and manage and will be removed with the new process.

Q: Technically, should it be implemented by using the "Complete" process of the underlying documents or onUpdate business event which triggers when a document is completed.

Retrieved from ""

This page has been accessed 3,550 times. This page was last modified on 16 November 2012, at 13:30. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.