Fixes BUG-47045: Set the order reference to an invoice header when the Order is updated.
If it is creating invoice lines related to maximum only one order, the "Sales/Purchase Order" field is updated related to that order. If there are invoice lines, related to more than once orders then this field is empty.
In this solution, if user has the "Order reference" value defined and then by adding lines related to an order the "Sales Order" field is updated, if the "Order reference" field was defined, then it will be not updated, in other hands, if it is empty its will be filled with the order's reference.