Hi Sergei,

please see inline:

On Mar 9, 2012, at 10:36 PM, biletnikov wrote:

> Hello all,
> if we complete an order we get the invoice. Each order item and adjustment
> is related to the corresponding invoice item via (OrderItemBilling and
> OrderAdjustmentBilling). This relation makes the invoice items removing not
> possible, we just get an error:
> 
> ERROR: Could not complete the Remove an existing Invoice Item
> [file:/D:/work/AlfahOFBiz/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml#removeInvoiceItem]
> process [problem removing the lookedUpValue value: Exception while deleting
> the following entity:
> [GenericEntity:InvoiceItem][invoiceId,10016(java.lang.String)][invoiceItemSeqId,00002(java.lang.String)]
> (SQL Exception while executing the following:DELETE FROM OFBIZ.INVOICE_ITEM
> WHERE INVOICE_ID=? AND INVOICE_ITEM_SEQ_ID=? (DELETE on table 'INVOICE_ITEM'
> caused a violation of foreign key constraint 'ORDER_ADJBLNG_IITM' for key
> (10016,00002). The statement has been rolled back.))]
> 
> so, why we have the "Remove" button on the invoice items page?

You can also create an invoice manually: the remove button can be used in that 
context.

> It looks like a bug.
> I see two solutions here:
> * do not show the Remove button for the items which have the order relation
> (if it has sense)

I agree that this should be the right fix.

> * fix this and remove the appropriate OrderItemBilling and
> OrderAdjustmentBilling records
> 
> The next point is the invoice copying feature.
> If we click "Copy" we get the new invoice which looks like a copy of the
> source invoice.
> However, it is not the real copy, because new invoice missed the order item
> and adjustment relations, i.e. 
> OrderItemBilling and OrderAdjustmentBilling are not used for the copied
> invoice. Why ? Is there a reason for that?

I don't know... but I suspect that the idea is to use the "copy" button to 
create a new (editable) invoice from a "template".

Jacopo

> 
> Thank you.
> 
> 
> -----
> Kind regards,
> Sergei
> --
> View this message in context: 
> http://ofbiz.135035.n4.nabble.com/Invoice-copying-and-items-removing-tp4460748p4460748.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Reply via email to