Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0044759Openbravo ERP02. Master data managementpublic2020-08-05 22:302020-08-14 11:57
sdossantos 
inigo_lerga 
highmajoralways
closedfixed 
5
pi 
PR20Q4 
Core
No
0044759: It is not possible to deactivate a product with zero stock
A new product is created and stock is added to the new product with a physical inventory.
We execute a flow of sale and purchase with the new product, without leaving any pending documents associated with the product.
The stock of the new product is changed to zero with a physical inventory.
When the stock is zero, and we want to deactivate the new product, the following error appears: "Error saving. There are lines of pending documents associated with the product. Please reactivate them before updating the product."
The error comes of the M_PRODUCT_TRG, when the following query obtain a result different to zero:
SELECT COALESCE(SUM(QtyReserved),0) , COALESCE(SUM(QtyOrdered),0)
FROM (SELECT QtyOnHand, 0 AS QtyReserved, 0 AS QtyOrdered
FROM M_Storage_Detail s
WHERE s.M_Product_ID='idproduct'
UNION
SELECT 0 AS QtyOnHand, QtyReserved, QtyOrdered
FROM M_Storage_Pending s
WHERE s.M_Product_ID='idproduct')

For some reason, the m_storage_pending is not updated.
Specs:
1- Create a new product.
2- Configure the price list of the new product.
3- Create a physical inventory with the new product and add stock.
4- Create a sales order with the new product. Complete it.
5- Create a good shipment with the sales order of the point 4. Complete and Post it.
6- Create a purchase order with the new product. Complete it.
7- Create a good receipt with the purchase order of point 6.
8- Control the stock of the new product and create a physical inventory and leave the stock in zero.
9- Deactivate the product.
No tags attached.
? product.mp4 (3,973,276) 2020-08-05 23:52
https://issues.openbravo.com/file_download.php?file_id=14858&type=bug
Issue History
2020-08-05 22:30sdossantosNew Issue
2020-08-05 22:30sdossantosAssigned To => Triage Finance
2020-08-05 22:30sdossantosModules => Core
2020-08-05 22:30sdossantosTriggers an Emergency Pack => No
2020-08-05 23:52sdossantosFile Added: product.mp4
2020-08-07 09:10ngarciaResolution time => 1566943200
2020-08-07 09:28ngarciaResolution time1566943200 => 1598565600
2020-08-10 14:47dmiguelezAssigned ToTriage Finance => inigo_lerga
2020-08-11 08:22inigo_lergaStatusnew => scheduled
2020-08-11 13:59hgbotNote Added: 0121982
2020-08-11 14:48inigo_lergaNote Added: 0121987
2020-08-14 11:57hgbotNote Added: 0122064
2020-08-14 11:57hgbotResolutionopen => fixed
2020-08-14 11:57hgbotStatusscheduled => closed
2020-08-14 11:57hgbotFixed in Version => PR20Q4
2020-08-14 11:57hgbotNote Added: 0122065

Notes
(0121982)
hgbot   
2020-08-11 13:59   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/119 [^]
(0121987)
inigo_lerga   
2020-08-11 14:48   
--Test Plan Mantis HQL--
#This Issue only occurs in an environment with Oracle Database#

As the F&B International Group Admin role in Backend:
- Go to Product window and create a new record with any Name and Test Plan desired.
  Go to Price Tab and create a new record with 'Tarifa de ventas' as Price List Version
  and set any desired Unit and List Price.
  Create a new record in the same Price Tab with 'Tarifa Bebidas Alegres' as Price List
  Version and set any desired Unit and List Price.
  Save the record.

- Go to Physical Inventory window and create a new record leaving the fields as default.
  Go to Lines Tab and create a new line with the previously created poduct and 100 as
  Quantity Count. Also set 'RN-2-0-0' as Storage Bin.
  Save and process the Physical Inventory.

- Go to Sales Order window and create a new record with 'Alimentos y Supermercado' as Business Partner.
  Go to Lines Tab and create a new line with the previously created product and 20 as Ordered
  QuantityCreate a sales order with the new product.
  Save the record and complete it.

- Go to Goods Shipment window and create a new record with 'Alimentos y Supermercado' as Business
  Partner.
  Go to Lines Tab and select lines from the previous Sales Order setting 'RN-2-0-0' as Storage Bin.
  Save the record, complete it and post it.

- Go to Purchase Order window and create a new record with 'Bebidas Alegres, S.L' as Business Partner.
  Go to Lines Tab and create a new line with the previously created product and 20 as Ordered Quantity.
  Save the record and complete it.

- Go to Goods Receipt window and create a new record with 'Bebidas Alegres, S.L.' as Business Partner.
  Go to Lines Tab and select lines from the previous Purchase Order setting 'RN-2-0-0' as Storage Bin.
  Save the record, complete it and post it.

- Go back to Physical Inventory window and create a new record leaving the fields as default.
  Go to Lines Tab and create a new line with the previously created poduct and 0 as
  Quantity Count. Also set 'RN-2-0-0' as Storage Bin.
  Save and process the Physical Inventory.

- Go back to Product window and disable the Active checkbox in the record of the previously created product.

#Now this workflow is successfully executed"
(0122064)
hgbot   
2020-08-14 11:57   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/119 [^]
(0122065)
hgbot   
2020-08-14 11:57   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 60f9d67859046a105b4458386de33aeffeaeb013
Author: inigo_lerga <inigo.lerga@openbravo.com>
Date: 2020-08-14T09:57:06+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/60f9d67859046a105b4458386de33aeffeaeb013 [^]

fixes BUG-44759:Avoided comparation with null in Oracle

When doing a comparison like ''<>'OB', the '' part
is considered as NULL by Oracle, which causes an
error. This patch fixes that.

---
M src-db/database/model/functions/C_ORDER_POST1.xml
---