OFBiz
  1. OFBiz
  2. OFBIZ-3765

Use CustomMethod for select order, quote and invoice hook to resolve id

    Details

      Description

      Currently the invoiceId resolve process is define on PartyAcctgPreference by a enumeration. The service getNextInvoiceId analyse enumeration to active code correponding to enumeration.

      I propose pass enumeration to CustumMethod that permit to add more easier a new resolve process. Just define a new CusthomMethod and associate to PartyAcctgPreference. It's possible to add this by hot-deploy compenents without change accounting code or add many unreadable function.

      The patch contains :

      • Entity modiication : pass enumeration to deprecated and add custumMethod attribute/relation
      • Add service enforced ans restart define previously by enumeration
      • Implement getNextSeqId service by origin call service to permet analyse and resolve new id by all information present in context
      • Add error message if PartyAcctgPreference not define.
      • Apply on invoice, quote an order

      To test just ant clean-all && ant run-install and create quote, order and invoice

      Thanks to Leila Mekika for the help

      Nicolas

      1. OFBIZ-3765-Missed.patch
        9 kB
        Nicolas Malin
      2. OFBIZ-3765.patch
        46 kB
        Nicolas Malin
      3. hookByPartyAcctgPreference.patch
        46 kB
        Nicolas Malin

        Activity

        Hide
        Bob Morley added a comment -

        I like this concept a lot. However, I wonder if it can be implemented by making use of the overriding nature of services rather than an entity model change? Similar to what you have done, pull out the implementation into a "getNextInvoiceId", "getNextOrderId", and "getNextQuoteId" and have the create service invoke this regardless. Then if you have your own custom implementation, you would just redefine the service definition in your hot-deploy component to point to your new implementation. Services are (generally) in a global space so this overriding behaviour is based on the load sequence dictated by component type (framework, application, special purpose, hot-deploy) and from with-in there the ordering in the component-load.xml file (may have to double check that last statement).

        Would think that the "getNextInvoiceId" would use the acctg preferences to vector off to the "enforced" and "restart" service if you want to keep those two implementations separated (which is a good idea).

        Show
        Bob Morley added a comment - I like this concept a lot. However, I wonder if it can be implemented by making use of the overriding nature of services rather than an entity model change? Similar to what you have done, pull out the implementation into a "getNextInvoiceId", "getNextOrderId", and "getNextQuoteId" and have the create service invoke this regardless. Then if you have your own custom implementation, you would just redefine the service definition in your hot-deploy component to point to your new implementation. Services are (generally) in a global space so this overriding behaviour is based on the load sequence dictated by component type (framework, application, special purpose, hot-deploy) and from with-in there the ordering in the component-load.xml file (may have to double check that last statement). Would think that the "getNextInvoiceId" would use the acctg preferences to vector off to the "enforced" and "restart" service if you want to keep those two implementations separated (which is a good idea).
        Hide
        Nicolas Malin added a comment -

        Thanks bob for your return

        I think, use a service surchage to define a specifc customer resolve Id will be a good idea if you have only one society on your OBiz instance. But with tenant, you will can many society on one OFbiz instance. So if you have a service list to resolve id in your components, you need manage it in database.

        Nicolas

        Show
        Nicolas Malin added a comment - Thanks bob for your return I think, use a service surchage to define a specifc customer resolve Id will be a good idea if you have only one society on your OBiz instance. But with tenant, you will can many society on one OFbiz instance. So if you have a service list to resolve id in your components, you need manage it in database. Nicolas
        Hide
        Bob Morley added a comment -

        Ahh yes that is an excellent point. Unless you can determine the implementation from the enumeration on acctg preference, you certainly have to do it this way.

        Show
        Bob Morley added a comment - Ahh yes that is an excellent point. Unless you can determine the implementation from the enumeration on acctg preference, you certainly have to do it this way.
        Hide
        Erwan de FERRIERES added a comment -

        Any news on this issue ?

        Show
        Erwan de FERRIERES added a comment - Any news on this issue ?
        Hide
        Jacques Le Roux added a comment -

        Hi Erwan,

        From who are you expecting news? Commiters reviews of Nicolas?

        Show
        Jacques Le Roux added a comment - Hi Erwan, From who are you expecting news? Commiters reviews of Nicolas?
        Hide
        Erwan de FERRIERES added a comment -

        Hi Jacques,

        Waiting for comments from devs, and waiting for Nicolas to make the tests pass !

        Cheers,

        Show
        Erwan de FERRIERES added a comment - Hi Jacques, Waiting for comments from devs, and waiting for Nicolas to make the tests pass ! Cheers,
        Hide
        Nicolas Malin added a comment -

        Erwan given me an error on test process generate by the patch. I check it asap to close this jira

        Nicolas

        Show
        Nicolas Malin added a comment - Erwan given me an error on test process generate by the patch. I check it asap to close this jira Nicolas
        Hide
        Nicolas Malin added a comment -

        Test are now OK. When we enter in getNext fonction, I just alerte by log if party not have a partyAcctgPreference. During tests when a purchase invoice was created, the function chexk supplier, not customer.

        I will propose an improvment in a next jira.

        Show
        Nicolas Malin added a comment - Test are now OK. When we enter in getNext fonction, I just alerte by log if party not have a partyAcctgPreference. During tests when a purchase invoice was created, the function chexk supplier, not customer. I will propose an improvment in a next jira.
        Hide
        Nicolas Malin added a comment -

        Tks erwan for the commit at revision 954388

        Show
        Nicolas Malin added a comment - Tks erwan for the commit at revision 954388
        Hide
        Erwan de FERRIERES added a comment -

        Yeah, thanks for closing it... Forgot to do it !

        Show
        Erwan de FERRIERES added a comment - Yeah, thanks for closing it... Forgot to do it !
        Hide
        Scott Gray added a comment -

        Was this tested properly? Sales orders created with OOTB settings now take the form WSCO1 instead of WSCO10000.

        Show
        Scott Gray added a comment - Was this tested properly? Sales orders created with OOTB settings now take the form WSCO1 instead of WSCO10000.
        Hide
        Erwan de FERRIERES added a comment -

        Corrected at rev. 965638. Thanks Scott

        Show
        Erwan de FERRIERES added a comment - Corrected at rev. 965638. Thanks Scott
        Hide
        Jacques Le Roux added a comment -

        Quoting Anne on user ML

        There are still some files that refer to the deprecated

        • invoiceSequenceEnumId,
        • quoteSequenceEnumId
        • orderSequenceEnumId fields of PartyAcctgPreference.

        Files I know of are:

        applications/accounting/servicedef/services_admin.xml
        applications/accounting/widget/GlSetupForms.xml
        applications/commonext/script/org/ofbiz/setup/SetupEvents.xml

        Show
        Jacques Le Roux added a comment - Quoting Anne on user ML There are still some files that refer to the deprecated invoiceSequenceEnumId, quoteSequenceEnumId orderSequenceEnumId fields of PartyAcctgPreference. Files I know of are: applications/accounting/servicedef/services_admin.xml applications/accounting/widget/GlSetupForms.xml applications/commonext/script/org/ofbiz/setup/SetupEvents.xml
        Hide
        Nicolas Malin added a comment -

        I create quick correction to use old attributes.

        Thanks anne and jacques.

        Nicolas

        Show
        Nicolas Malin added a comment - I create quick correction to use old attributes. Thanks anne and jacques. Nicolas
        Hide
        Jacques Le Roux added a comment -

        Thanks Nicolas, Anne,

        Nicolas, your patch is in trunk at r1065014

        Show
        Jacques Le Roux added a comment - Thanks Nicolas, Anne, Nicolas, your patch is in trunk at r1065014

          People

          • Assignee:
            Erwan de FERRIERES
            Reporter:
            Nicolas Malin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development