Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0045477Openbravo ERP04. Warehouse managementpublic2020-11-23 12:222020-12-02 16:11
gorkaion 
AtulOpenbravo 
highmajoralways
closedfixed 
5
 
PR21Q1 
Core
No
0045477: Attribute required check in M_TRANSACTION_TRG trigger should allow when stock is zero
In the M_Transaction_TRG trigger there is a check to enforce that an attribute set instance is defined for products that requires attributes

The trigger should allow to sell an attribute required item without attributes when the stock on hand of the product is zero.

This is an scenario that happens on the POS when the preference to use attributes is not enabled.

On this scenario when a product using attributes is sold the POS searches the available stock to get an attribute instance to use. When no stock is available there is no attribute instance to use and the 0 instance is used.

With the current logic the transaction trigger won't allow to complete the execution as it is only allowed to use the 0 instance attribute when the quantity on hand is negative.
Configure an AutoBOM product with no stock available on the parts.
Try to sell it.
Change the "v_qtyOnHand >= 0" to "v_qtyOnHand > 0". So the exception is only raised when the stock is Positive or the transaction is a Receipt.


       ELSIF (:NEW.M_INOUTLINE_ID IS NOT NULL) THEN
          SELECT io.issotrx
          INTO v_issotrx
          FROM m_inout io
          JOIN m_inoutline iol ON (iol.m_inout_id = io.m_inout_id)
          WHERE iol.m_inoutline_id = :NEW.m_inoutline_id;

          IF (v_issotrx = 'N' OR v_qtyOnHand >= 0) THEN
            RAISE_APPLICATION_ERROR(-20000, '@20112@' || ' - ' || v_Name) ;
          END IF;
        ELSE
          IF ( v_qtyOnHand >= 0) THEN
            RAISE_APPLICATION_ERROR(-20000, '@20112@' || ' - ' || v_Name) ;
          END IF;
        END IF;
No tags attached.
related to defect 0044622 closed inigo_lerga Attribute required check in M_TRANSACTION_TRG trigger should be relaxed 
Issue History
2020-11-23 12:22gorkaionNew Issue
2020-11-23 12:22gorkaionAssigned To => Triage Finance
2020-11-23 12:22gorkaionModules => Core
2020-11-23 12:22gorkaionResolution time => 1607900400
2020-11-23 12:22gorkaionTriggers an Emergency Pack => No
2020-11-23 12:22gorkaionIssue generated from0044622
2020-11-23 12:22gorkaionRelationship addedrelated to 0044622
2020-11-27 09:42dmiguelezAssigned ToTriage Finance => AtulOpenbravo
2020-11-27 17:18AtulOpenbravoStatusnew => scheduled
2020-12-02 08:30AtulOpenbravoNote Added: 0124681
2020-12-02 08:31AtulOpenbravoNote Edited: 0124681bug_revision_view_page.php?bugnote_id=0124681#r21911
2020-12-02 15:53hgbotNote Added: 0124694
2020-12-02 16:11hgbotResolutionopen => fixed
2020-12-02 16:11hgbotStatusscheduled => closed
2020-12-02 16:11hgbotFixed in Version => PR21Q1
2020-12-02 16:11hgbotNote Added: 0124695
2020-12-02 16:11hgbotNote Added: 0124696

Notes
(0124681)
AtulOpenbravo   
2020-12-02 08:30   
(edited on: 2020-12-02 08:31)
Test Plan

- In a latest instance, configure avalanche transceiver product as bill of material = Yes, Auto BOM = Yes
- Add product Alpine Poles and Alpine Ski Boot in Bill Of Material tab for it. Verify BOM

- Login in Web POS with vallblanca user
- Create a ticket with VBS Customer for product Avalanche Transceiver. Check out and pay total amount, realize that in back office Sales Order and Bill Of Materials Production record is created successfully.


- Now make sure that stock for products Alpine Poles and Alpine Ski Boot is Zero. (Create a Shipment in the back office for the product with all available quantity and process it.)

- Login in Web POS with vallblanca user
- Create a ticket with VBS Customer for product Avalanche Transceiver. Check out and pay total amount, realize that in back office, Sales Order and Bill Of Materials Production record is not created.
- Console shows below error message:-
org.openbravo.base.exception.OBException: Insufficient stock: Alpine poles 8.0
This is OK.

- Login as System Admin in the back office.
- Set preference Auto BOM: Allow negative stock in raw materials as Yes

- Login in Web POS with vallblanca user
- Create a ticket with VBS Customer for product Avalanche Transceiver. Check out and pay total amount, realize that in back office, Sales Order and Bill Of Materials Production record is created successfully without any error message in the console.

- Login as The White Valley Group Admin in the back office.
- Navigate to product Avalanche transceiver
- Add product Travel Cap in the Bills of Material Tab. Execute Verify BOM.
- Create a Goods Shipment for VBS Customer in Vall Blanca store org, with Product Travel Cap with its all available quantity with Attribute Set Value = PSS103_28-03-2018, process Shipment so that stock is Zero for this product.

- Login in Web POS with vallblanca user
- Create a ticket with VBS Customer for product Avalanche Transceiver. Check out and pay total amount, realize that in back office, Sales Order and Bill Of Materials Production record is created successfully will all three BOM products without any error message in the console.

(0124694)
hgbot   
2020-12-02 15:53   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/254 [^]
(0124695)
hgbot   
2020-12-02 16:11   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: e652fdb7773e50d3c1441ffa09f5186e1eccb9c1
Author: Atul Gaware <atul.gaware@openbravo.com>
Date: 2020-12-02T14:53:28+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/e652fdb7773e50d3c1441ffa09f5186e1eccb9c1 [^]

Fixes BUG-0045477: Attribute required check in M_TRANSACTION_TRG
trigger should allow when stock is zero

**"There are some products without attributes" Exception is only
raised when the stock is Positive or the transaction is a Receipt.

---
M src-db/database/model/triggers/M_TRANSACTION_TRG.xml
---
(0124696)
hgbot   
2020-12-02 16:11   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/254 [^]