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 <bjf...@free-man.net> 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