Hello Emad,

Please read the code of the service/method:
File: InvoiceServices.java
https://github.com/apache/ofbiz-framework/blob/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
Method: createInvoiceForOrder

See the line #461
createInvoiceItemContext.put("invoiceItemTypeId",
getInvoiceItemType(delegator, orderItem.getString("orderItemTypeId"),
                        product == null ? null :
product.getString("productTypeId"), invoiceType, "INV_FPROD_ITEM"));

Then see the method present inside line # 1941:
private static String getInvoiceItemType(Delegator delegator, String key1,
String key2, String invoiceTypeId, String defaultValue) {
}

Hopefully it's self explanatory, Please let me know if you need
further assistance on this.

--
Kind Regards,
Ashish Vijaywargiya
Vice President of Operations
*HotWax Systems*
*Enterprise open source experts*
http://www.hotwaxsystems.com



On Wed, Aug 31, 2022 at 5:31 PM Emad Radwan <[email protected]> wrote:

> Hello Ashis,
>
> Many thanks for the usual help! One issue please that I don't understand in
> the data itself, I noticed that for products - finished good - an
> invoice_item_type_id is 'INV_FPROD_ITEM' while order_item_type_id is '
> PRODUCT_ORDER_ITEM'
> but the key for 'INV_FPROD_ITEM' is 'FINISHED_GOOD' however, so how the
> mapping is happening? What am I missing here?
>
> For other mappings like adjustments, mappings looks fine.
>
> Please shed some light on this.
>
> Regards,
> Emad
>
> On Wed, Aug 31, 2022 at 6:53 AM Ashish Vijaywargiya <
> [email protected]> wrote:
>
> > Hello Emad,
> >
> > A very good question. Please refer to the records present inside
> > InvoiceItemTypeMap entity:
> >
> >
> https://demo-stable.ofbiz.apache.org/webtools/control/FindGeneric?entityName=InvoiceItemTypeMap
> >
> > Hopefully it's self explanatory.
> >
> > --
> > Kind Regards,
> > Ashish Vijaywargiya
> > Vice President of Operations
> > *HotWax Systems*
> > *Enterprise open source experts*
> > http://www.hotwaxsystems.com
> >
> >
> >
> > On Wed, Aug 31, 2022 at 1:16 AM Emad Radwan <[email protected]>
> wrote:
> >
> > > Hello Community,
> > >
> > > Let me explain my query with this when I create an order with items and
> > > possible adjustments, the auto-created invoice when the order gets
> > > completed we get a list of invoice items that is almost a match with
> both
> > > order items plus adjustments. My question what decides the
> > > invoice_item_type for each invoice item?
> > >
> > > I understand that an invoice can be not only for order; e.g. work
> effort,
> > > but I used order item vs invoice item as an example.
> > >
> > > Is it mapped somehow and is configurable, or pre-determined and
> > hard-coded?
> > >
> > >
> > > Regards,
> > > Emad
> >
>

Reply via email to