how to open a filtered product window

  • Andrea

    Andrea - 2006-07-03

    Hi all Compiere Developers,

    I need to create a new form to automate new product creation. In this form I will place some controls to let the user insert some product data, after that I will create the new product with this elements and I would like to open the product window (with a filter to show only the new record created) to let the user enter all the other (not strictly required) field.
    I can create easily the form and create the new product, the hard part is to open the (filtered) product window (much like the "Find Record" form does).

    Any clue in how to do that?

    thanks in advance & best regards


    • Trifon (An ADempiere founder)

      Hi Andrea,

      Yes, this is hard task to do.

      Try to research Find class it could help you to understand how Compiere fitler records. Probably you will have to pass to Find class all M_Product_ID of newly created records.


      • Andrea

        Andrea - 2006-07-03

        Thanks for the clue Trifon!!

        I have already search that and seen that (normally) APanel class, in method initialQuery(..) (or cmd_find()) calls for Find class and gets the user query.

        But maybe I find something...
        when user opens a new windows, Compiere calls AMenuStartItem.startWindow() with the right AD_Window_ID. Later this method calls AWindow.initWindow() passing the AD_Window_ID and null as query.
        I will try to do something like this function does but passing the right query as parameter..
        (I will create just one product at time so it should be easy to create the right query object).

        • Andrea

          Andrea - 2006-08-11

          I got it! Just to share with the others, here it is a piece of code that open Product window filtering on M_Product.Value to select just one product (it can be easly adapted to other requirement..)

          Thanks for the clue Trifon

          // open the Product Window (filtered)
          AWindow frame = new AWindow();
          int AD_Window_ID = getProductWindowID(); /* SELECT AD_Window_ID FROM AD_Window WHERE Name='Product'*/
          MQuery m_query = new MQuery("M_Product");
          m_query.addRestriction("UPPER(Value)", MQuery.LIKE,
          /* enter product value here*/
          "Key", /* enter product value here*/);
          m_query.setRecordCount(1);    /* trust me: this opens just 1 record! */
          boolean OK = frame.initWindow(AD_Window_ID, m_query);
          if (!OK)
              return false;

          • Trifon (An ADempiere founder)

            Hi Andrea,

            >Thanks for the clue Trifon

            you are welcome.

            I would like to thank you for sharing your solution.

            I'm really glad to see that you are community friendly person.

            Kind regards,

    • abhishek pathak

      abhishek pathak - 2008-05-27

      when i click on submit info after puchasing the product and quantity on webstore module
      the file submitInfo.jsp will not show any value in table..
      even database will show correct values inserted
      at the time of display of total values like...(order id,quantity,productid,tax,grand total)
      all are remain 00
      help me urgent./..
      show me the class or method which generate this values from database of salse product
      this is online modules of compier

    • tarnak

      tarnak - 2008-05-27

      Hi Andrea can I please know to which company your working .


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks