Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0047045Openbravo ERP07. Sales managementpublic2021-06-09 16:462021-06-30 10:32
hector_hernaez 
markmm82 
highmajoralways
closedfixed 
5
 
PR21Q3 
Core
No
0047045: In the backoffice when generating an invoice, the order reference of the associated sales order doesn't appear in the invoice
When a sales order with an order reference is created, this order reference doesn't appear in the sales invoice which is created from the sales order
Everything in the backoffice:
1.Generate the sales order with any product by entering, at the time of its creation, the Order Reference.
2. Make the book of the sales order
3.Generate the corresponding Goods Shipment and complete it.
4.Generate the Sales Invoice by selecting the order generated in step 1.
5. Observe that in the order reference field of the sales invoice, the order reference of the sales order associated doesn't appear.
No tags attached.
Issue History
2021-06-09 16:46hector_hernaezNew Issue
2021-06-09 16:46hector_hernaezAssigned To => Triage Finance
2021-06-09 16:46hector_hernaezModules => Core
2021-06-09 16:46hector_hernaezResolution time => 1625004000
2021-06-09 16:46hector_hernaezTriggers an Emergency Pack => No
2021-06-09 18:31vmromanosNote Added: 0129286
2021-06-09 18:31vmromanosAssigned ToTriage Finance => markmm82
2021-06-09 18:34vmromanosNote Edited: 0129286bug_revision_view_page.php?bugnote_id=0129286#r22708
2021-06-24 00:29markmm82Statusnew => scheduled
2021-06-24 15:11markmm82Note Added: 0129773
2021-06-24 15:15markmm82Note Added: 0129774
2021-06-24 15:16markmm82Note Edited: 0129773bug_revision_view_page.php?bugnote_id=0129773#r22773
2021-06-24 20:33hgbotNote Added: 0129785
2021-06-28 00:41markmm82Note Edited: 0129773bug_revision_view_page.php?bugnote_id=0129773#r22791
2021-06-28 00:42markmm82Note Edited: 0129774bug_revision_view_page.php?bugnote_id=0129774#r22793
2021-06-30 10:32hgbotResolutionopen => fixed
2021-06-30 10:32hgbotStatusscheduled => closed
2021-06-30 10:32hgbotFixed in Version => PR21Q3
2021-06-30 10:32hgbotNote Added: 0129992
2021-06-30 10:32hgbotNote Added: 0129993

Notes
(0129286)
vmromanos   
2021-06-09 18:31   
(edited on: 2021-06-09 18:34)
Right now the C_Invoice.C_Order_ID field is automatically populated when the invoice belongs to a unique order. If the invoice is created from 2 or more orders, then the C_Order_ID field is empty.

Note that you can easily reach the order's reference through that C_Invoice.C_Order_ID column.


Proposed solution:
When manually creating a new Invoice header, if the Order Reference is filled, keep it and do not override it.
If it is empty (usual scenario), then fill it based on the C_Invoice.C_Order_ID order reference.

Maybe an insert/update trigger on the C_Invoice is the easiest and safest solution in this case.

(0129773)
markmm82   
2021-06-24 15:11   
(edited on: 2021-06-28 00:41)
Test plan: Generating sales invoice lines from orders
1. Generate a sales order with any product by entering, at the time of its creation, the Order Reference = "Reference order". Complete it.
2. Generate the corresponding Goods Shipment and complete it.
3. Create a Sales Invoice header without defining its "Order reference".
   Notice that "Sales Order" field is empty.
4. Execute "Create Lines From Order" process.
5. Select all the lines related to previously created order.
   Notice that lines are created to the invoice.
   Notice that "Sales Order" field is now related to the order.
   Notice that "Order reference" value is now the same than order's reference = "Reference order".
6. Remove all the invoice lines.
   Notice that "Sales Order" field is empty.
   Notice that "Order reference" is empty.
7. Change the "Order reference" value to "Order reference mod" and save the invoice.
8. Execute "Create Lines From Order" process.
9. Select all the lines related to previously created order.
   Notice that lines are created to the invoice.
   Notice that "Sales Order" field is now related to the order.
   Notice that "Order reference" value wasn't updated and it still with = "Reference order mod" as value.
10. Remove all the invoice lines.
   Notice that "Sales Order" field is empty.
   Notice that "Order reference" still as "Order reference mod".

Repeat test for Purchase Invoices

(0129774)
markmm82   
2021-06-24 15:15   
(edited on: 2021-06-28 00:42)
Test plan: Generating sales invoice lines from shipments
1. Generate a sales order with any product by entering, at the time of its creation, the Order Reference = "Reference order". Complete it.
2. Generate the corresponding Goods Shipment and complete it.
   Notice that Sales Order field is now related to the order.
3. Create a Sales Invoice header without defining its "Order reference".
   Notice that "Sales Order" field is empty.
4. Execute "Create Lines From Shipment" process.
5. Select all the lines related to previously created shipment.
   Notice that lines are created to the invoice.
   Notice that "Sales Order" field is now related to the shipment's sales order.
   Notice that "Order reference" value is now the same than sales order's reference = "Reference order".
6. Remove all the invoice lines.
   Notice that "Sales Order" field is empty.
   Notice that "Order reference" is empty.
7. Change the "Order reference" value to "Order reference mod" and save the invoice.
8. Execute "Create Lines From Shipment" process.
9. Select all the lines related to previously created shipment.
   Notice that lines are created to the invoice.
   Notice that "Sales Order" field is now related to the order.
   Notice that "Order reference" value wasn't updated and it still with = "Reference order mod" as value.
10. Remove all the invoice lines.
   Notice that "Sales Order" field is empty.
   Notice that "Order reference" still as "Reference order mod".

Repeat test for Purchase Invoices

(0129785)
hgbot   
2021-06-24 20:33   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/408 [^]
(0129992)
hgbot   
2021-06-30 10:32   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 20d6adc360b10855ed376fd3611a0db77e78eef6
Author: Mark Orlando Molina <markmm82@gmail.com>
Date: 2021-06-30T08:31:59+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/20d6adc360b10855ed376fd3611a0db77e78eef6 [^]

Fixes BUG-47045: Set the order reference to an invoice header when the Order is updated.

When the C_Order_Id is filled (insert/update), the corresponding reference no. is inserted
unless the user did manually enter any other value, which in this case it's kept.

When the C_Order_Id is removed, the reference no. is removed too only if it's exactly the
same value as the order being removed, otherwise it's kept (which means the user manually
entered any other reference here).

The logic is managed in a trigger, so any invoicing process will get the same logic.

---
M src-db/database/model/triggers/C_INVOICE_TRG.xml
---
(0129993)
hgbot   
2021-06-30 10:32   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/408 [^]