Given the following queries and code:
mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE where INVOICE_ITEM_TYPE_ID = 'INVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = 'INVOICE_HEAD_ADJ'; +----------------------+------------------+ | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | +----------------------+------------------+ | INVOICE_HEAD_ADJ | INVOICE_ADJ | | PINVOICE_ADJ | INVOICE_HEAD_ADJ | | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | +----------------------+------------------+ 3 rows in set (0.00 sec) mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE where INVOICE_ITEM_TYPE_ID = 'PINVOICE_ADJ' OR PARENT_TYPE_ID = 'PINVOICE_ADJ'; +----------------------+------------------+ | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | +----------------------+------------------+ | PINVOICE_ADJ | INVOICE_HEAD_ADJ | | PINV_ADD_FEATURE | PINVOICE_ADJ | | PINV_DISCOUNT_ADJ | PINVOICE_ADJ | | PINV_MISC_CHARGE | PINVOICE_ADJ | | PINV_PROMOTION_ADJ | PINVOICE_ADJ | | PINV_SALES_TAX | PINVOICE_ADJ | | PINV_SHIP_CHARGES | PINVOICE_ADJ | | PINV_SURCHARGE_ADJ | PINVOICE_ADJ | | PINV_WARRANTY_ADJ | PINVOICE_ADJ | | P_FEE | PINVOICE_ADJ | +----------------------+------------------+ 10 rows in set (0.00 sec) mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE where INVOICE_ITEM_TYPE_ID = 'SINVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = 'SINVOICE_HEAD_ADJ'; +----------------------+-------------------+ | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | +----------------------+-------------------+ | FEE | SINVOICE_HEAD_ADJ | | INV_ADD_FEATURE | SINVOICE_HEAD_ADJ | | INV_DISCOUNT_ADJ | SINVOICE_HEAD_ADJ | | INV_INTRST_CHRG | SINVOICE_HEAD_ADJ | | INV_MISC_CHARGE | SINVOICE_HEAD_ADJ | | INV_PROMOTION_ADJ | SINVOICE_HEAD_ADJ | | INV_SALES_TAX | SINVOICE_HEAD_ADJ | | INV_SHIPPING_CHARGES | SINVOICE_HEAD_ADJ | | INV_SURCHARGE_ADJ | SINVOICE_HEAD_ADJ | | INV_WARRANTY_ADJ | SINVOICE_HEAD_ADJ | | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | +----------------------+-------------------+ 11 rows in set (0.00 sec) GetInvoiceItemTypes.groovy: if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { itemTypesCond = exprBldr.OR() { EQUALS(invoiceItemTypeId: "INVOICE_ADJ") EQUALS(parentTypeId: "INVOICE_ADJ") EQUALS(invoiceItemTypeId: "INVOICE_ITM_ADJ") EQUALS(parentTypeId: "INVOICE_ITM_ADJ") EQUALS(invoiceItemTypeId: "INV_PROD_ITEM") EQUALS(parentTypeId: "INV_PROD_ITEM") } invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false); glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyIdFrom]); } else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) { itemTypesCond = exprBldr.OR() { EQUALS(invoiceItemTypeId: "PINVOICE_ADJ") EQUALS(parentTypeId: "PINVOICE_ADJ") EQUALS(invoiceItemTypeId: "PINVOICE_ITM_ADJ") EQUALS(parentTypeId: "PINVOICE_ITM_ADJ") EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM") EQUALS(parentTypeId: "PINV_PROD_ITEM") } invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false); glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId]); } In the last query the PARENT_TYPE_ID shouldn't be INVOICE_ADJ instead of INVOICE_HEAD_ADJ and also in the first query the INVOICE_ITEM_TYPE_ID field shouldn't be SINVOICE_ADJ? ------ I want to create a sales item tax manually in a sales invoice for instance so for now I've replaced the OR conditional when invoiceTypeId = 'SALES_INVOICE' with this: if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { itemTypesCond = exprBldr.OR() { EQUALS(invoiceItemTypeId: "SINVOICE_ADJ") EQUALS(parentTypeId: "SINVOICE_ADJ") EQUALS(invoiceItemTypeId: "SINVOICE_ITM_ADJ") EQUALS(parentTypeId: "SINVOICE_ITM_ADJ") EQUALS(invoiceItemTypeId: "SINV_PROD_ITEM") EQUALS(parentTypeId: "SINV_PROD_ITEM") EQUALS(invoiceItemTypeId: "SINVOICE_HEAD_ADJ") --> to be removed if the relation parent -> child is not correct as I suspect EQUALS(parentTypeId: "SINVOICE_HEAD_ADJ") --> to be removed if the relation parent -> child is not correct as I suspect } -- ----- Jonatan Soto |
have you looked at the makecondition method?
Jonatan Soto sent the following on 9/24/2010 2:00 AM: > Given the following queries and code: > > mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE > where INVOICE_ITEM_TYPE_ID = 'INVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = > 'INVOICE_HEAD_ADJ'; > +----------------------+------------------+ > | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | > +----------------------+------------------+ > | INVOICE_HEAD_ADJ | INVOICE_ADJ | > | PINVOICE_ADJ | INVOICE_HEAD_ADJ | > | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | > +----------------------+------------------+ > 3 rows in set (0.00 sec) > > mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE > where INVOICE_ITEM_TYPE_ID = 'PINVOICE_ADJ' OR PARENT_TYPE_ID = > 'PINVOICE_ADJ'; > +----------------------+------------------+ > | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | > +----------------------+------------------+ > | PINVOICE_ADJ | INVOICE_HEAD_ADJ | > | PINV_ADD_FEATURE | PINVOICE_ADJ | > | PINV_DISCOUNT_ADJ | PINVOICE_ADJ | > | PINV_MISC_CHARGE | PINVOICE_ADJ | > | PINV_PROMOTION_ADJ | PINVOICE_ADJ | > | PINV_SALES_TAX | PINVOICE_ADJ | > | PINV_SHIP_CHARGES | PINVOICE_ADJ | > | PINV_SURCHARGE_ADJ | PINVOICE_ADJ | > | PINV_WARRANTY_ADJ | PINVOICE_ADJ | > | P_FEE | PINVOICE_ADJ | > +----------------------+------------------+ > 10 rows in set (0.00 sec) > > mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE > where INVOICE_ITEM_TYPE_ID = 'SINVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = > 'SINVOICE_HEAD_ADJ'; > +----------------------+-------------------+ > | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | > +----------------------+-------------------+ > | FEE | SINVOICE_HEAD_ADJ | > | INV_ADD_FEATURE | SINVOICE_HEAD_ADJ | > | INV_DISCOUNT_ADJ | SINVOICE_HEAD_ADJ | > | INV_INTRST_CHRG | SINVOICE_HEAD_ADJ | > | INV_MISC_CHARGE | SINVOICE_HEAD_ADJ | > | INV_PROMOTION_ADJ | SINVOICE_HEAD_ADJ | > | INV_SALES_TAX | SINVOICE_HEAD_ADJ | > | INV_SHIPPING_CHARGES | SINVOICE_HEAD_ADJ | > | INV_SURCHARGE_ADJ | SINVOICE_HEAD_ADJ | > | INV_WARRANTY_ADJ | SINVOICE_HEAD_ADJ | > | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | > +----------------------+-------------------+ > 11 rows in set (0.00 sec) > > GetInvoiceItemTypes.groovy: > > if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { > itemTypesCond = exprBldr.OR() { > EQUALS(invoiceItemTypeId: "INVOICE_ADJ") > EQUALS(parentTypeId: "INVOICE_ADJ") > EQUALS(invoiceItemTypeId: "INVOICE_ITM_ADJ") > EQUALS(parentTypeId: "INVOICE_ITM_ADJ") > EQUALS(invoiceItemTypeId: "INV_PROD_ITEM") > EQUALS(parentTypeId: "INV_PROD_ITEM") > } > invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, > null, ["parentTypeId", "invoiceItemTypeId"], null, false); > glAccountOrganizationAndClassList = > delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : > invoice.partyIdFrom]); > } else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) { > itemTypesCond = exprBldr.OR() { > EQUALS(invoiceItemTypeId: "PINVOICE_ADJ") > EQUALS(parentTypeId: "PINVOICE_ADJ") > EQUALS(invoiceItemTypeId: "PINVOICE_ITM_ADJ") > EQUALS(parentTypeId: "PINVOICE_ITM_ADJ") > EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM") > EQUALS(parentTypeId: "PINV_PROD_ITEM") > } > invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, > null, ["parentTypeId", "invoiceItemTypeId"], null, false); > glAccountOrganizationAndClassList = > delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : > invoice.partyId]); > } > > In the last query the PARENT_TYPE_ID shouldn't be INVOICE_ADJ instead > of INVOICE_HEAD_ADJ > and also in the first query the INVOICE_ITEM_TYPE_ID field shouldn't be > SINVOICE_ADJ? > > ------ > > I want to create a sales item tax manually in a sales invoice for instance > so for now I've replaced the OR conditional when invoiceTypeId = > 'SALES_INVOICE' with this: > > if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { > itemTypesCond = exprBldr.OR() { > EQUALS(invoiceItemTypeId: "SINVOICE_ADJ") > EQUALS(parentTypeId: "SINVOICE_ADJ") > EQUALS(invoiceItemTypeId: "SINVOICE_ITM_ADJ") > EQUALS(parentTypeId: "SINVOICE_ITM_ADJ") > EQUALS(invoiceItemTypeId: "SINV_PROD_ITEM") > EQUALS(parentTypeId: "SINV_PROD_ITEM") > EQUALS(invoiceItemTypeId: "SINVOICE_HEAD_ADJ") --> to be removed if > the relation parent -> child is not correct as I suspect > EQUALS(parentTypeId: "SINVOICE_HEAD_ADJ") --> to be removed if the > relation parent -> child is not correct as I suspect > } > > > |
What do you mean?
I am saying that to me there's an error in the seed data and what I did in order to not alter the current database values for a xxxTYPE table. The code below Is just a simple hack I did before someone with more experience can check it out and confirm if I am right or not. In case I am right, I think a patch that corrects the seed data wouldn't be enough because a script that performs the necessary updates for the existing sales invoices data and everything related is also needed, mostly for the current production environments. On Fri, Sep 24, 2010 at 6:29 PM, BJ Freeman <[hidden email]> wrote: > have you looked at the makecondition method? > > Jonatan Soto sent the following on 9/24/2010 2:00 AM: > > Given the following queries and code: >> >> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE >> where INVOICE_ITEM_TYPE_ID = 'INVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = >> 'INVOICE_HEAD_ADJ'; >> +----------------------+------------------+ >> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | >> +----------------------+------------------+ >> | INVOICE_HEAD_ADJ | INVOICE_ADJ | >> | PINVOICE_ADJ | INVOICE_HEAD_ADJ | >> | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | >> +----------------------+------------------+ >> 3 rows in set (0.00 sec) >> >> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE >> where INVOICE_ITEM_TYPE_ID = 'PINVOICE_ADJ' OR PARENT_TYPE_ID = >> 'PINVOICE_ADJ'; >> +----------------------+------------------+ >> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | >> +----------------------+------------------+ >> | PINVOICE_ADJ | INVOICE_HEAD_ADJ | >> | PINV_ADD_FEATURE | PINVOICE_ADJ | >> | PINV_DISCOUNT_ADJ | PINVOICE_ADJ | >> | PINV_MISC_CHARGE | PINVOICE_ADJ | >> | PINV_PROMOTION_ADJ | PINVOICE_ADJ | >> | PINV_SALES_TAX | PINVOICE_ADJ | >> | PINV_SHIP_CHARGES | PINVOICE_ADJ | >> | PINV_SURCHARGE_ADJ | PINVOICE_ADJ | >> | PINV_WARRANTY_ADJ | PINVOICE_ADJ | >> | P_FEE | PINVOICE_ADJ | >> +----------------------+------------------+ >> 10 rows in set (0.00 sec) >> >> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE >> where INVOICE_ITEM_TYPE_ID = 'SINVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = >> 'SINVOICE_HEAD_ADJ'; >> +----------------------+-------------------+ >> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | >> +----------------------+-------------------+ >> | FEE | SINVOICE_HEAD_ADJ | >> | INV_ADD_FEATURE | SINVOICE_HEAD_ADJ | >> | INV_DISCOUNT_ADJ | SINVOICE_HEAD_ADJ | >> | INV_INTRST_CHRG | SINVOICE_HEAD_ADJ | >> | INV_MISC_CHARGE | SINVOICE_HEAD_ADJ | >> | INV_PROMOTION_ADJ | SINVOICE_HEAD_ADJ | >> | INV_SALES_TAX | SINVOICE_HEAD_ADJ | >> | INV_SHIPPING_CHARGES | SINVOICE_HEAD_ADJ | >> | INV_SURCHARGE_ADJ | SINVOICE_HEAD_ADJ | >> | INV_WARRANTY_ADJ | SINVOICE_HEAD_ADJ | >> | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | >> +----------------------+-------------------+ >> 11 rows in set (0.00 sec) >> >> GetInvoiceItemTypes.groovy: >> >> if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { >> itemTypesCond = exprBldr.OR() { >> EQUALS(invoiceItemTypeId: "INVOICE_ADJ") >> EQUALS(parentTypeId: "INVOICE_ADJ") >> EQUALS(invoiceItemTypeId: "INVOICE_ITM_ADJ") >> EQUALS(parentTypeId: "INVOICE_ITM_ADJ") >> EQUALS(invoiceItemTypeId: "INV_PROD_ITEM") >> EQUALS(parentTypeId: "INV_PROD_ITEM") >> } >> invoiceItemTypes = delegator.findList("InvoiceItemType", >> itemTypesCond, >> null, ["parentTypeId", "invoiceItemTypeId"], null, false); >> glAccountOrganizationAndClassList = >> delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId >> : >> invoice.partyIdFrom]); >> } else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) { >> itemTypesCond = exprBldr.OR() { >> EQUALS(invoiceItemTypeId: "PINVOICE_ADJ") >> EQUALS(parentTypeId: "PINVOICE_ADJ") >> EQUALS(invoiceItemTypeId: "PINVOICE_ITM_ADJ") >> EQUALS(parentTypeId: "PINVOICE_ITM_ADJ") >> EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM") >> EQUALS(parentTypeId: "PINV_PROD_ITEM") >> } >> invoiceItemTypes = delegator.findList("InvoiceItemType", >> itemTypesCond, >> null, ["parentTypeId", "invoiceItemTypeId"], null, false); >> glAccountOrganizationAndClassList = >> delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId >> : >> invoice.partyId]); >> } >> >> In the last query the PARENT_TYPE_ID shouldn't be INVOICE_ADJ instead >> of INVOICE_HEAD_ADJ >> and also in the first query the INVOICE_ITEM_TYPE_ID field shouldn't be >> SINVOICE_ADJ? >> >> ------ >> >> I want to create a sales item tax manually in a sales invoice for instance >> so for now I've replaced the OR conditional when invoiceTypeId = >> 'SALES_INVOICE' with this: >> >> if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { >> itemTypesCond = exprBldr.OR() { >> EQUALS(invoiceItemTypeId: "SINVOICE_ADJ") >> EQUALS(parentTypeId: "SINVOICE_ADJ") >> EQUALS(invoiceItemTypeId: "SINVOICE_ITM_ADJ") >> EQUALS(parentTypeId: "SINVOICE_ITM_ADJ") >> EQUALS(invoiceItemTypeId: "SINV_PROD_ITEM") >> EQUALS(parentTypeId: "SINV_PROD_ITEM") >> EQUALS(invoiceItemTypeId: "SINVOICE_HEAD_ADJ") --> to be removed >> if >> the relation parent -> child is not correct as I suspect >> EQUALS(parentTypeId: "SINVOICE_HEAD_ADJ") --> to be removed if >> the >> relation parent -> child is not correct as I suspect >> } >> >> >> >> > -- ----- Jonatan Soto |
Ok. not into actual tables just entities.
so guess can't help. Jonatan Soto sent the following on 9/24/2010 9:51 AM: > What do you mean? > > I am saying that to me there's an error in the seed data and what I did in > order to not alter the current database values for a xxxTYPE table. The code > below Is just a simple hack I did before someone with more experience can > check it out and confirm if I am right or not. > > In case I am right, I think a patch that corrects the seed data wouldn't be > enough because a script that performs the necessary updates for the existing > sales invoices data and everything related is also needed, mostly for the > current production environments. > > > On Fri, Sep 24, 2010 at 6:29 PM, BJ Freeman<[hidden email]> wrote: > >> have you looked at the makecondition method? >> >> Jonatan Soto sent the following on 9/24/2010 2:00 AM: >> >> Given the following queries and code: >>> >>> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE >>> where INVOICE_ITEM_TYPE_ID = 'INVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = >>> 'INVOICE_HEAD_ADJ'; >>> +----------------------+------------------+ >>> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | >>> +----------------------+------------------+ >>> | INVOICE_HEAD_ADJ | INVOICE_ADJ | >>> | PINVOICE_ADJ | INVOICE_HEAD_ADJ | >>> | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | >>> +----------------------+------------------+ >>> 3 rows in set (0.00 sec) >>> >>> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE >>> where INVOICE_ITEM_TYPE_ID = 'PINVOICE_ADJ' OR PARENT_TYPE_ID = >>> 'PINVOICE_ADJ'; >>> +----------------------+------------------+ >>> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | >>> +----------------------+------------------+ >>> | PINVOICE_ADJ | INVOICE_HEAD_ADJ | >>> | PINV_ADD_FEATURE | PINVOICE_ADJ | >>> | PINV_DISCOUNT_ADJ | PINVOICE_ADJ | >>> | PINV_MISC_CHARGE | PINVOICE_ADJ | >>> | PINV_PROMOTION_ADJ | PINVOICE_ADJ | >>> | PINV_SALES_TAX | PINVOICE_ADJ | >>> | PINV_SHIP_CHARGES | PINVOICE_ADJ | >>> | PINV_SURCHARGE_ADJ | PINVOICE_ADJ | >>> | PINV_WARRANTY_ADJ | PINVOICE_ADJ | >>> | P_FEE | PINVOICE_ADJ | >>> +----------------------+------------------+ >>> 10 rows in set (0.00 sec) >>> >>> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE >>> where INVOICE_ITEM_TYPE_ID = 'SINVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = >>> 'SINVOICE_HEAD_ADJ'; >>> +----------------------+-------------------+ >>> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | >>> +----------------------+-------------------+ >>> | FEE | SINVOICE_HEAD_ADJ | >>> | INV_ADD_FEATURE | SINVOICE_HEAD_ADJ | >>> | INV_DISCOUNT_ADJ | SINVOICE_HEAD_ADJ | >>> | INV_INTRST_CHRG | SINVOICE_HEAD_ADJ | >>> | INV_MISC_CHARGE | SINVOICE_HEAD_ADJ | >>> | INV_PROMOTION_ADJ | SINVOICE_HEAD_ADJ | >>> | INV_SALES_TAX | SINVOICE_HEAD_ADJ | >>> | INV_SHIPPING_CHARGES | SINVOICE_HEAD_ADJ | >>> | INV_SURCHARGE_ADJ | SINVOICE_HEAD_ADJ | >>> | INV_WARRANTY_ADJ | SINVOICE_HEAD_ADJ | >>> | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | >>> +----------------------+-------------------+ >>> 11 rows in set (0.00 sec) >>> >>> GetInvoiceItemTypes.groovy: >>> >>> if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { >>> itemTypesCond = exprBldr.OR() { >>> EQUALS(invoiceItemTypeId: "INVOICE_ADJ") >>> EQUALS(parentTypeId: "INVOICE_ADJ") >>> EQUALS(invoiceItemTypeId: "INVOICE_ITM_ADJ") >>> EQUALS(parentTypeId: "INVOICE_ITM_ADJ") >>> EQUALS(invoiceItemTypeId: "INV_PROD_ITEM") >>> EQUALS(parentTypeId: "INV_PROD_ITEM") >>> } >>> invoiceItemTypes = delegator.findList("InvoiceItemType", >>> itemTypesCond, >>> null, ["parentTypeId", "invoiceItemTypeId"], null, false); >>> glAccountOrganizationAndClassList = >>> delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId >>> : >>> invoice.partyIdFrom]); >>> } else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) { >>> itemTypesCond = exprBldr.OR() { >>> EQUALS(invoiceItemTypeId: "PINVOICE_ADJ") >>> EQUALS(parentTypeId: "PINVOICE_ADJ") >>> EQUALS(invoiceItemTypeId: "PINVOICE_ITM_ADJ") >>> EQUALS(parentTypeId: "PINVOICE_ITM_ADJ") >>> EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM") >>> EQUALS(parentTypeId: "PINV_PROD_ITEM") >>> } >>> invoiceItemTypes = delegator.findList("InvoiceItemType", >>> itemTypesCond, >>> null, ["parentTypeId", "invoiceItemTypeId"], null, false); >>> glAccountOrganizationAndClassList = >>> delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId >>> : >>> invoice.partyId]); >>> } >>> >>> In the last query the PARENT_TYPE_ID shouldn't be INVOICE_ADJ instead >>> of INVOICE_HEAD_ADJ >>> and also in the first query the INVOICE_ITEM_TYPE_ID field shouldn't be >>> SINVOICE_ADJ? >>> >>> ------ >>> >>> I want to create a sales item tax manually in a sales invoice for instance >>> so for now I've replaced the OR conditional when invoiceTypeId = >>> 'SALES_INVOICE' with this: >>> >>> if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { >>> itemTypesCond = exprBldr.OR() { >>> EQUALS(invoiceItemTypeId: "SINVOICE_ADJ") >>> EQUALS(parentTypeId: "SINVOICE_ADJ") >>> EQUALS(invoiceItemTypeId: "SINVOICE_ITM_ADJ") >>> EQUALS(parentTypeId: "SINVOICE_ITM_ADJ") >>> EQUALS(invoiceItemTypeId: "SINV_PROD_ITEM") >>> EQUALS(parentTypeId: "SINV_PROD_ITEM") >>> EQUALS(invoiceItemTypeId: "SINVOICE_HEAD_ADJ") --> to be removed >>> if >>> the relation parent -> child is not correct as I suspect >>> EQUALS(parentTypeId: "SINVOICE_HEAD_ADJ") --> to be removed if >>> the >>> relation parent -> child is not correct as I suspect >>> } >>> >>> >>> >>> >> > > |
In reply to this post by jonatan soto
https://issues.apache.org/jira/browse/OFBIZ-3537
Some of the types are a little ambiguous or inconsistent but if you take a browse through the attached txt file you'll see that nothing is missing. Regards Scott HotWax Media http://www.hotwaxmedia.com On 25/09/2010, at 4:51 AM, Jonatan Soto wrote: > What do you mean? > > I am saying that to me there's an error in the seed data and what I did in > order to not alter the current database values for a xxxTYPE table. The code > below Is just a simple hack I did before someone with more experience can > check it out and confirm if I am right or not. > > In case I am right, I think a patch that corrects the seed data wouldn't be > enough because a script that performs the necessary updates for the existing > sales invoices data and everything related is also needed, mostly for the > current production environments. > > > On Fri, Sep 24, 2010 at 6:29 PM, BJ Freeman <[hidden email]> wrote: > >> have you looked at the makecondition method? >> >> Jonatan Soto sent the following on 9/24/2010 2:00 AM: >> >> Given the following queries and code: >>> >>> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE >>> where INVOICE_ITEM_TYPE_ID = 'INVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = >>> 'INVOICE_HEAD_ADJ'; >>> +----------------------+------------------+ >>> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | >>> +----------------------+------------------+ >>> | INVOICE_HEAD_ADJ | INVOICE_ADJ | >>> | PINVOICE_ADJ | INVOICE_HEAD_ADJ | >>> | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | >>> +----------------------+------------------+ >>> 3 rows in set (0.00 sec) >>> >>> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE >>> where INVOICE_ITEM_TYPE_ID = 'PINVOICE_ADJ' OR PARENT_TYPE_ID = >>> 'PINVOICE_ADJ'; >>> +----------------------+------------------+ >>> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | >>> +----------------------+------------------+ >>> | PINVOICE_ADJ | INVOICE_HEAD_ADJ | >>> | PINV_ADD_FEATURE | PINVOICE_ADJ | >>> | PINV_DISCOUNT_ADJ | PINVOICE_ADJ | >>> | PINV_MISC_CHARGE | PINVOICE_ADJ | >>> | PINV_PROMOTION_ADJ | PINVOICE_ADJ | >>> | PINV_SALES_TAX | PINVOICE_ADJ | >>> | PINV_SHIP_CHARGES | PINVOICE_ADJ | >>> | PINV_SURCHARGE_ADJ | PINVOICE_ADJ | >>> | PINV_WARRANTY_ADJ | PINVOICE_ADJ | >>> | P_FEE | PINVOICE_ADJ | >>> +----------------------+------------------+ >>> 10 rows in set (0.00 sec) >>> >>> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from INVOICE_ITEM_TYPE >>> where INVOICE_ITEM_TYPE_ID = 'SINVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = >>> 'SINVOICE_HEAD_ADJ'; >>> +----------------------+-------------------+ >>> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | >>> +----------------------+-------------------+ >>> | FEE | SINVOICE_HEAD_ADJ | >>> | INV_ADD_FEATURE | SINVOICE_HEAD_ADJ | >>> | INV_DISCOUNT_ADJ | SINVOICE_HEAD_ADJ | >>> | INV_INTRST_CHRG | SINVOICE_HEAD_ADJ | >>> | INV_MISC_CHARGE | SINVOICE_HEAD_ADJ | >>> | INV_PROMOTION_ADJ | SINVOICE_HEAD_ADJ | >>> | INV_SALES_TAX | SINVOICE_HEAD_ADJ | >>> | INV_SHIPPING_CHARGES | SINVOICE_HEAD_ADJ | >>> | INV_SURCHARGE_ADJ | SINVOICE_HEAD_ADJ | >>> | INV_WARRANTY_ADJ | SINVOICE_HEAD_ADJ | >>> | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | >>> +----------------------+-------------------+ >>> 11 rows in set (0.00 sec) >>> >>> GetInvoiceItemTypes.groovy: >>> >>> if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { >>> itemTypesCond = exprBldr.OR() { >>> EQUALS(invoiceItemTypeId: "INVOICE_ADJ") >>> EQUALS(parentTypeId: "INVOICE_ADJ") >>> EQUALS(invoiceItemTypeId: "INVOICE_ITM_ADJ") >>> EQUALS(parentTypeId: "INVOICE_ITM_ADJ") >>> EQUALS(invoiceItemTypeId: "INV_PROD_ITEM") >>> EQUALS(parentTypeId: "INV_PROD_ITEM") >>> } >>> invoiceItemTypes = delegator.findList("InvoiceItemType", >>> itemTypesCond, >>> null, ["parentTypeId", "invoiceItemTypeId"], null, false); >>> glAccountOrganizationAndClassList = >>> delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId >>> : >>> invoice.partyIdFrom]); >>> } else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) { >>> itemTypesCond = exprBldr.OR() { >>> EQUALS(invoiceItemTypeId: "PINVOICE_ADJ") >>> EQUALS(parentTypeId: "PINVOICE_ADJ") >>> EQUALS(invoiceItemTypeId: "PINVOICE_ITM_ADJ") >>> EQUALS(parentTypeId: "PINVOICE_ITM_ADJ") >>> EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM") >>> EQUALS(parentTypeId: "PINV_PROD_ITEM") >>> } >>> invoiceItemTypes = delegator.findList("InvoiceItemType", >>> itemTypesCond, >>> null, ["parentTypeId", "invoiceItemTypeId"], null, false); >>> glAccountOrganizationAndClassList = >>> delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId >>> : >>> invoice.partyId]); >>> } >>> >>> In the last query the PARENT_TYPE_ID shouldn't be INVOICE_ADJ instead >>> of INVOICE_HEAD_ADJ >>> and also in the first query the INVOICE_ITEM_TYPE_ID field shouldn't be >>> SINVOICE_ADJ? >>> >>> ------ >>> >>> I want to create a sales item tax manually in a sales invoice for instance >>> so for now I've replaced the OR conditional when invoiceTypeId = >>> 'SALES_INVOICE' with this: >>> >>> if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { >>> itemTypesCond = exprBldr.OR() { >>> EQUALS(invoiceItemTypeId: "SINVOICE_ADJ") >>> EQUALS(parentTypeId: "SINVOICE_ADJ") >>> EQUALS(invoiceItemTypeId: "SINVOICE_ITM_ADJ") >>> EQUALS(parentTypeId: "SINVOICE_ITM_ADJ") >>> EQUALS(invoiceItemTypeId: "SINV_PROD_ITEM") >>> EQUALS(parentTypeId: "SINV_PROD_ITEM") >>> EQUALS(invoiceItemTypeId: "SINVOICE_HEAD_ADJ") --> to be removed >>> if >>> the relation parent -> child is not correct as I suspect >>> EQUALS(parentTypeId: "SINVOICE_HEAD_ADJ") --> to be removed if >>> the >>> relation parent -> child is not correct as I suspect >>> } >>> >>> >>> >>> >> > > > -- > ----- > > Jonatan Soto smime.p7s (3K) Download Attachment |
Thanks Scott.
Ups, sorry I should check the dev ML before. BTW, if you look at the values in the invoice item type drop-down from this page https://demo-trunk.ofbiz.apache.org/accounting/control/listInvoiceItems?invoiceId=demo10000 seems that they are incorrect when it is a sales invoice so I think the changes I did are necessary. GetInvoiceItemTypes.groovy: if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { itemTypesCond = exprBldr.OR() { EQUALS(invoiceItemTypeId: "SINVOICE_ADJ") EQUALS(parentTypeId: "SINVOICE_ADJ") EQUALS(invoiceItemTypeId: "SINVOICE_ITM_ADJ") EQUALS(parentTypeId: "SINVOICE_ITM_ADJ") EQUALS(invoiceItemTypeId: "SINV_PROD_ITEM") EQUALS(parentTypeId: "SINV_PROD_ITEM") EQUALS(invoiceItemTypeId: "SINVOICE_HEAD_ADJ") EQUALS(parentTypeId: "SINVOICE_HEAD_ADJ") } I am right? On Fri, Sep 24, 2010 at 10:45 PM, Scott Gray <[hidden email]>wrote: > https://issues.apache.org/jira/browse/OFBIZ-3537 > Some of the types are a little ambiguous or inconsistent but if you take a > browse through the attached txt file you'll see that nothing is missing. > > Regards > Scott > > HotWax Media > http://www.hotwaxmedia.com > > On 25/09/2010, at 4:51 AM, Jonatan Soto wrote: > > > What do you mean? > > > > I am saying that to me there's an error in the seed data and what I did > in > > order to not alter the current database values for a xxxTYPE table. The > code > > below Is just a simple hack I did before someone with more experience can > > check it out and confirm if I am right or not. > > > > In case I am right, I think a patch that corrects the seed data wouldn't > be > > enough because a script that performs the necessary updates for the > existing > > sales invoices data and everything related is also needed, mostly for the > > current production environments. > > > > > > On Fri, Sep 24, 2010 at 6:29 PM, BJ Freeman <[hidden email]> wrote: > > > >> have you looked at the makecondition method? > >> > >> Jonatan Soto sent the following on 9/24/2010 2:00 AM: > >> > >> Given the following queries and code: > >>> > >>> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from > INVOICE_ITEM_TYPE > >>> where INVOICE_ITEM_TYPE_ID = 'INVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = > >>> 'INVOICE_HEAD_ADJ'; > >>> +----------------------+------------------+ > >>> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | > >>> +----------------------+------------------+ > >>> | INVOICE_HEAD_ADJ | INVOICE_ADJ | > >>> | PINVOICE_ADJ | INVOICE_HEAD_ADJ | > >>> | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | > >>> +----------------------+------------------+ > >>> 3 rows in set (0.00 sec) > >>> > >>> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from > INVOICE_ITEM_TYPE > >>> where INVOICE_ITEM_TYPE_ID = 'PINVOICE_ADJ' OR PARENT_TYPE_ID = > >>> 'PINVOICE_ADJ'; > >>> +----------------------+------------------+ > >>> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | > >>> +----------------------+------------------+ > >>> | PINVOICE_ADJ | INVOICE_HEAD_ADJ | > >>> | PINV_ADD_FEATURE | PINVOICE_ADJ | > >>> | PINV_DISCOUNT_ADJ | PINVOICE_ADJ | > >>> | PINV_MISC_CHARGE | PINVOICE_ADJ | > >>> | PINV_PROMOTION_ADJ | PINVOICE_ADJ | > >>> | PINV_SALES_TAX | PINVOICE_ADJ | > >>> | PINV_SHIP_CHARGES | PINVOICE_ADJ | > >>> | PINV_SURCHARGE_ADJ | PINVOICE_ADJ | > >>> | PINV_WARRANTY_ADJ | PINVOICE_ADJ | > >>> | P_FEE | PINVOICE_ADJ | > >>> +----------------------+------------------+ > >>> 10 rows in set (0.00 sec) > >>> > >>> mysql> select INVOICE_ITEM_TYPE_ID, PARENT_TYPE_ID from > INVOICE_ITEM_TYPE > >>> where INVOICE_ITEM_TYPE_ID = 'SINVOICE_HEAD_ADJ' OR PARENT_TYPE_ID = > >>> 'SINVOICE_HEAD_ADJ'; > >>> +----------------------+-------------------+ > >>> | INVOICE_ITEM_TYPE_ID | PARENT_TYPE_ID | > >>> +----------------------+-------------------+ > >>> | FEE | SINVOICE_HEAD_ADJ | > >>> | INV_ADD_FEATURE | SINVOICE_HEAD_ADJ | > >>> | INV_DISCOUNT_ADJ | SINVOICE_HEAD_ADJ | > >>> | INV_INTRST_CHRG | SINVOICE_HEAD_ADJ | > >>> | INV_MISC_CHARGE | SINVOICE_HEAD_ADJ | > >>> | INV_PROMOTION_ADJ | SINVOICE_HEAD_ADJ | > >>> | INV_SALES_TAX | SINVOICE_HEAD_ADJ | > >>> | INV_SHIPPING_CHARGES | SINVOICE_HEAD_ADJ | > >>> | INV_SURCHARGE_ADJ | SINVOICE_HEAD_ADJ | > >>> | INV_WARRANTY_ADJ | SINVOICE_HEAD_ADJ | > >>> | SINVOICE_HEAD_ADJ | INVOICE_HEAD_ADJ | > >>> +----------------------+-------------------+ > >>> 11 rows in set (0.00 sec) > >>> > >>> GetInvoiceItemTypes.groovy: > >>> > >>> if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { > >>> itemTypesCond = exprBldr.OR() { > >>> EQUALS(invoiceItemTypeId: "INVOICE_ADJ") > >>> EQUALS(parentTypeId: "INVOICE_ADJ") > >>> EQUALS(invoiceItemTypeId: "INVOICE_ITM_ADJ") > >>> EQUALS(parentTypeId: "INVOICE_ITM_ADJ") > >>> EQUALS(invoiceItemTypeId: "INV_PROD_ITEM") > >>> EQUALS(parentTypeId: "INV_PROD_ITEM") > >>> } > >>> invoiceItemTypes = delegator.findList("InvoiceItemType", > >>> itemTypesCond, > >>> null, ["parentTypeId", "invoiceItemTypeId"], null, false); > >>> glAccountOrganizationAndClassList = > >>> delegator.findByAnd("GlAccountOrganizationAndClass", > [organizationPartyId > >>> : > >>> invoice.partyIdFrom]); > >>> } else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) { > >>> itemTypesCond = exprBldr.OR() { > >>> EQUALS(invoiceItemTypeId: "PINVOICE_ADJ") > >>> EQUALS(parentTypeId: "PINVOICE_ADJ") > >>> EQUALS(invoiceItemTypeId: "PINVOICE_ITM_ADJ") > >>> EQUALS(parentTypeId: "PINVOICE_ITM_ADJ") > >>> EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM") > >>> EQUALS(parentTypeId: "PINV_PROD_ITEM") > >>> } > >>> invoiceItemTypes = delegator.findList("InvoiceItemType", > >>> itemTypesCond, > >>> null, ["parentTypeId", "invoiceItemTypeId"], null, false); > >>> glAccountOrganizationAndClassList = > >>> delegator.findByAnd("GlAccountOrganizationAndClass", > [organizationPartyId > >>> : > >>> invoice.partyId]); > >>> } > >>> > >>> In the last query the PARENT_TYPE_ID shouldn't be INVOICE_ADJ instead > >>> of INVOICE_HEAD_ADJ > >>> and also in the first query the INVOICE_ITEM_TYPE_ID field shouldn't be > >>> SINVOICE_ADJ? > >>> > >>> ------ > >>> > >>> I want to create a sales item tax manually in a sales invoice for > instance > >>> so for now I've replaced the OR conditional when invoiceTypeId = > >>> 'SALES_INVOICE' with this: > >>> > >>> if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) { > >>> itemTypesCond = exprBldr.OR() { > >>> EQUALS(invoiceItemTypeId: "SINVOICE_ADJ") > >>> EQUALS(parentTypeId: "SINVOICE_ADJ") > >>> EQUALS(invoiceItemTypeId: "SINVOICE_ITM_ADJ") > >>> EQUALS(parentTypeId: "SINVOICE_ITM_ADJ") > >>> EQUALS(invoiceItemTypeId: "SINV_PROD_ITEM") > >>> EQUALS(parentTypeId: "SINV_PROD_ITEM") > >>> EQUALS(invoiceItemTypeId: "SINVOICE_HEAD_ADJ") --> to be > removed > >>> if > >>> the relation parent -> child is not correct as I suspect > >>> EQUALS(parentTypeId: "SINVOICE_HEAD_ADJ") --> to be removed if > >>> the > >>> relation parent -> child is not correct as I suspect > >>> } > >>> > >>> > >>> > >>> > >> > > > > > > -- > > ----- > > > > Jonatan Soto > > -- ----- Jonatan Soto |
Free forum by Nabble | Edit this page |