Page 1 of 1

Customization jar related issue

PostPosted: Wed Oct 24, 2012 11:29 pm
by vivekjustthink
Hi,

I have a simple issue, but unresolved. Please do take a look at below.

I have added this statement in MOrder.java

Code: Select all
FDialog.info(1, null, "GRN is already made for this Purchase order.")

and exported the MOrder.class file and added this to customization jar. But customization jar showed a dependency to this org.adempiere.webui.apps.AEnv class. so i exported the class file of AEnv and added to customization jar. Now it shows this error

Code: Select all
java.lang.NoClassDefFoundError: org/zkoss/zk/ui/Component

i.e it requires component class. this will be a big cycle and i think some library is missing. Everything is fine when running from code. Could you help me to resolve this please?

Thank You for your time and help..

regards
vivek

Re: Customization jar related issue

PostPosted: Wed Oct 24, 2012 11:46 pm
by globalqss
FDialog is a view class - and MOrder is a model class - you must avoid using that.

Most of the times what you need is to return the string and the dialog will be shown, on the case of beforeSave you can use log.saveError (check other classes for examples).

Regards,

Carlos Ruiz

Re: Customization jar related issue

PostPosted: Thu Oct 25, 2012 12:35 pm
by vivekjustthink
Hi carlos,

ya u are right. since that model validator didn't work for me i did the below in function reActivateIt() in class MOrder.java

Code: Select all
//Reactivate po only if grn not made
      String sql = "select m_inout_id from adempiere.m_inout where c_order_id in (select c_order_id from adempiere.c_order where c_order_id=?)";
      int grn = DB.getSQLValue(get_TrxName(), sql, get_ID());
      if(grn != -1){
         FDialog.info(1, null, "GRN is already made for this Purchase order.");
         out.append(Msg.getMsg(Env.getCtx(), "GRN is already made for this Purchase order."));
         m_processMsg=null;
         return false;
      }

if i use log.saveError it will print only in console. and in above case returning false become mandatory to prevent the class from re-activating PO. So in this case for message i can't use another return statement. And also it's mandatory to intimate the user about the error. Please suggest me a way-out to intimate the user in gui mode or any other way to do the above task. Thank You!!

regards
vivek

Re: Customization jar related issue

PostPosted: Fri Oct 26, 2012 12:33 am
by globalqss
Hi Vivek - on MOrder try setting the value of variable m_processMsg.

Regards,

Carlos Ruiz

Re: Customization jar related issue

PostPosted: Fri Oct 26, 2012 12:49 pm
by vivekjustthink
Hi carlos,

Thank you so much, the problem is resolved by setting the text to m_processMsg. But isn't there any way to pop up a warning window from that model class.

regards
vivek

Re: Customization jar related issue

PostPosted: Sat Oct 27, 2012 12:17 am
by globalqss
Hi Vivek, popup warning windows is achieved using Callouts.