How to use the Abstract Class for Prepare Action

62 views
Skip to first unread message

shiju01

unread,
Jun 13, 2018, 10:38:36 AM6/13/18
to iDempiere

 Dear Carlos Ruiz

 You have provided the abstract class for implementing Prepare Action for Inventory Move here

 https://idempiere.atlassian.net/browse/IDEMPIERE-3599

 But I don't have any clue how to make use of that code (:

 Would provide the steps to implement it or how should i apply that code.

 Should i create an event handler plugin and just create a new class registerTableEvent and paste the code there ?

 Kindly explain

Carlos Antonio Ruiz Gomez

unread,
Jun 13, 2018, 10:59:59 AM6/13/18
to idem...@googlegroups.com
Hi Shiju,

Yes, the sample code in the ticket is intended for a class extending AbstractEventHandler

Like explained here http://wiki.idempiere.org/en/Developing_Plug-Ins_-_Model_Events

Regards,

Carlos Ruiz

shiju01

unread,
Jun 14, 2018, 1:47:45 AM6/14/18
to iDempiere

Thanks Carlos.  I will make it!

shiju01

unread,
Jun 14, 2018, 5:24:53 AM6/14/18
to iDempiere

Hi Carlos

Sorry to bother you again

Am getting error in line because eventData is not defined ?



    if (eventData.po instanceof MMovement) {





protected
void initialize() { registerTableEvent(IEventTopics.DOCACTION, MMovement.Table_Name); } protected void doHandleEvent(Event event) { String type = event.getTopic(); if (type.equals(IEventTopics.DOCACTION)) { if (eventData.po instanceof MMovement) { MMovement movement = (MMovement) eventData.po; // when the movement document is in Draft status if (movement.getDocStatus().equals(DocumentEngine.STATUS_Drafted)) { if (!eventData.options.contains(DocumentEngine.ACTION_Prepare)) { // add Prepare option to the list eventData.options.set(eventData.indexObj.getAndIncrement(), DocumentEngine.ACTION_Prepare); // set the default option to Prepare eventData.docAction.set(0, DocumentEngine.ACTION_Prepare); } } } } }


Carlos Antonio Ruiz Gomez

unread,
Jun 14, 2018, 8:32:16 AM6/14/18
to idem...@googlegroups.com
Hi Shiju, I fixed the first example in the ticket - there was one missing line (it was OK in the second).

Regards,

Carlos Ruiz

shiju01

unread,
Jun 14, 2018, 10:07:02 AM6/14/18
to iDempiere

Oh.. Thank You.  

I was not able to make out  which class is defining eventdata and i missed to look into the second abstract.    

This fix made it working ...  Thanks.
Reply all
Reply to author
Forward
0 new messages