Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0024905Openbravo ERP04. Warehouse managementpublic2013-10-08 09:352017-04-01 12:06
caristu 
mcobas 
urgentmajoralways
closedfixed 
5
 
3.0PR17Q2 
markmm82
Core
No
0024905: Sales Order relation is not updated in Shipment header in some cases
Sales Order relation is not updated in Shipment header in some cases. The problem is also reproducible in purchase flow
Case 1:
1) Create a sales order with at least one line
2) Create a goods shipment header
3) Using the create lines from, insert lines created in step 1) for the shipment
4) Add a new line for the shipment (not linked to any sales order line)
5) Delete the lines created from the order
6) Notice that the Sales Order information has not been cleared in the shipment header

Case 2:
1) Create two sales orders with at least one line each
2) Create a goods shipment header
3) Using the create lines from, insert lines created in step 1)
4) Delete the line associated with one of the orders
5) Complete the goods shipment
6) Notice that the Sales Order information has not been set although all the lines belong to the same order
No tags attached.
related to defect 0024890 closed jecharri Cannot delete shipments 
Issue History
2013-10-08 09:35caristuNew Issue
2013-10-08 09:35caristuAssigned To => jecharri
2013-10-08 09:35caristuModules => Core
2013-10-08 09:35caristuTriggers an Emergency Pack => No
2013-10-08 09:35caristuRelationship addedrelated to 0024890
2013-10-08 09:35caristuIssue Monitored: networkb
2015-05-13 15:30jecharriAssigned Tojecharri => Triage Finance
2017-02-16 11:18ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=14604#r14604
2017-02-16 11:21ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=14605#r14605
2017-02-16 11:25ngarciaResolution time => 1489014000
2017-02-16 11:25ngarciaDescription Updatedbug_revision_view_page.php?rev_id=14607#r14607
2017-02-16 11:25ngarciaIssue Monitored: ngarcia
2017-02-16 11:26ngarciaPriorityhigh => urgent
2017-02-16 15:05markmm82Assigned ToTriage Finance => Sanjota
2017-02-23 17:18markmm82Note Added: 0094580
2017-02-28 15:50markmm82Note Edited: 0094580bug_revision_view_page.php?bugnote_id=0094580#r14693
2017-02-28 15:51hgbotCheckin
2017-02-28 15:51hgbotNote Added: 0094662
2017-02-28 15:51hgbotStatusnew => resolved
2017-02-28 15:51hgbotResolutionopen => fixed
2017-02-28 15:51hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/9c931e5263c1c2fbd8263bb68176c035907e1b6d [^]
2017-02-28 15:54markmm82Review Assigned To => markmm82
2017-02-28 15:54markmm82Note Added: 0094663
2017-02-28 15:54markmm82Statusresolved => closed
2017-02-28 15:54markmm82Fixed in Version => 3.0PR17Q2
2017-03-08 18:08markmm82Assigned ToSanjota => mcobas
2017-03-15 20:20hudsonbotCheckin
2017-03-15 20:20hudsonbotNote Added: 0095241
2017-03-31 11:34hgbotCheckin
2017-03-31 11:34hgbotNote Added: 0095753
2017-04-01 12:06hudsonbotCheckin
2017-04-01 12:06hudsonbotNote Added: 0095779

Notes
(0094580)
markmm82   
2017-02-23 17:18   
(edited on: 2017-02-28 15:50)
Test Plan

Sales flow
Case 1:
1) Create a sales order with at least one line.
2) Create a goods shipment header.
3) Using the create lines from, insert lines created in step 1 for the shipment.
4) Notice that the Sales Order information has been updated in the shipment header with the previously created order.
5) Add a new line for the shipment (not linked to any sales order line).
6) Notice that the Sales Order information has not been updated in the shipment header.
7) Delete the lines created from the order and complete the shipment.
8) Notice that the Sales Order information has been cleared in the shipment header, and the value is empty.

Case 2:
1) Create two sales orders with at least one line each.
2) Create a goods shipment header.
3) Using the create lines from, insert any of the lines created in step 1.
4) Notice that the Sales Order information has been set in the shipment header with that order.
5) Using the create lines from, insert the other line created in step 1.
6) Notice that the Sales Order information has been cleared in the shipment header.
7) Delete the line associated with one of the orders and complete the shipment.
8) Notice that the Sales Order information has been set in the shipment header with the lefting order.

Case 3:
1) Create three sales orders with at least one line each.
2) Create a goods shipment header.
3) Using the create lines from, insert one line created in step 1.
4) Notice that the Sales Order information has been set in the shipment header.
5) Using the create lines from, insert others lines created in step 1.
6) Notice that the Sales Order information has been cleared in the shipment header.
7) Delete one line associated with the orders.
8) Notice that the Sales Order information has been kept clear in the shipment header.
9) Delete other line associated with the orders and complete the shipment.
10) Notice that the Sales Order information has been set in the shipment header.

Repeat above test cases for the Purchase flow.

(0094662)
hgbot   
2017-02-28 15:51   
Repository: erp/devel/pi
Changeset: 9c931e5263c1c2fbd8263bb68176c035907e1b6d
Author: Miguel <martencobasmiguel <at> gmail.com>
Date: Mon Feb 27 13:05:01 2017 -0500
URL: http://code.openbravo.com/erp/devel/pi/rev/9c931e5263c1c2fbd8263bb68176c035907e1b6d [^]

Fixes issue 24905: Sales Order relation is not updated in Shipment
header in some cases.

When a line was deleted was not verified if there was other
invoice lines associated to orders distinct than the header's Sales/Purchase
Order field and it was not updated rightly. Also when inserting a line from the
create lines process, there being two or more lines already inserted related to
different orders, the Sales Order field related with the header was updated
with the last one.

To get the sales order field updated correctly depending on the previous cases,
the following logic was added to the CreateFrom_Shipment_data.xsql and M_InOut
function.

Each time a line is inserted, the shipment's order line field will be updated
with NULL if there are not any line created from an order or if there are more
than one line created from different orders. In the case that lines were created
from an unique sales order then it will be fullfilled with it, otherwise it will
be left empty.

When the line is deleted, the logic explained above needs to be checked inside
a trigger, but it is not possible because the table is in a mutant status in
Oracle, due this reason it is not possible to update the shipment's header at
line's deletion time. As solution to this situation, this field is updated when
the shipment is completed.

---
M src-db/database/model/functions/M_INOUT_POST.xml
M src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Shipment_data.xsql
---
(0094663)
markmm82   
2017-02-28 15:54   
Code review + Testing OK
(0095241)
hudsonbot   
2017-03-15 20:20   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/54e102bef53e [^]
Maturity status: Test
(0095753)
hgbot   
2017-03-31 11:34   
Repository: erp/devel/pi
Changeset: 4f040fb8603a46d49bc3ac4533d2418d6147a5e3
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Fri Mar 31 10:34:33 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/4f040fb8603a46d49bc3ac4533d2418d6147a5e3 [^]

Related to issue 24905: Code review improvements

Write three queries in just one.
Do just one update with a select sub-query.

---
M src-db/database/model/functions/M_INOUT_POST.xml
---
(0095779)
hudsonbot   
2017-04-01 12:06   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/44185ff76d75 [^]
Maturity status: Test