Dolibarr: BOM creation, when you save the line it is not displayed until page refresh.

Created on 31 Jul 2020  路  6Comments  路  Source: Dolibarr/dolibarr

Bug

In module MRP, creating or modifying a BOM, new lines doesn't show until page refresh. Modifying existing line doesn't show new values on save until page refresh.

Environment

  • Version: 12.0.1
  • OS: Ubuntu 18.04 Server
  • Web server: Apache/2.4.29
  • PHP: 7.2.24
  • Database: MariaDB 5.5.5-10.1.44
  • URL(s): /bom/bom_card.php

Expected and actual behaviour

Added or saved lines will show right away.

Steps to reproduce the behavior

Go to MRP -> New bill of material -> Input name, product ant qty -> Create.
On the next screen, try add 脿 new line (select 脿 product, set qty and other values -> Click ADD button). The new line form is reset but the line (despite being correctly writed to database) does not show in the card. Reloading the BOM will show the line (Refreshing the page or navigate away and come back to this BOM).

Similar thing happen when modifying an existing line. New values doesn't show until page relaod.

Bug

Most helpful comment

+1
I confirm on v12.0.1, debian, french

All 6 comments

+1
I confirm on v12.0.1, debian, french

Further confirm that this bug is still available in 12.0.2

+1
confirmed in 12.0.2, ubuntu 18.04, mariaDB 10.5

Ok, dont know why this issue has been closed but the problem still partially exist on 12.0.3.

The issue have been corrected on the line update but not on the line add.

Fortunately it's an easy fix, edit the file : /dolibar_root_folder/htdocs/bom/bom_card.php

Around line 181 / 186, change :

{
                unset($_POST['idprod']);
                unset($_POST['qty']);
                unset($_POST['qty_frozen']);
                    unset($_POST['disable_stock_change']);
            }

To

{
                unset($_POST["idprod"]);
                unset($_POST["qty"]);
                unset($_POST["qty_frozen"]);
                    unset($_POST["disable_stock_change"]);

                        $object->fetchLines()
            }

If you are on a version prior to 12.0.3 do the same thing around lines 223 / 229.

Simon3P that did the job, thanks for the easy fix. Hope this will be included in the next release

While the above code works their is still a redirecting issue when reloading the page.
it redirects to bom_card.php?id=27#addline this results in not showing the prices
it should redirect to bom_card.php?id=27

Was this page helpful?
0 / 5 - 0 ratings

Related issues

borsti67 picture borsti67  路  5Comments

gnovaro picture gnovaro  路  5Comments

truefriend-cz picture truefriend-cz  路  5Comments

defrance picture defrance  路  3Comments

low5 picture low5  路  4Comments