41221

Adempiere - How to design/call 2 CreateLinesFrom button in Same window

Question:

In my customization i want to create 2 <strong>CreateLineFrom</strong> form in same window/Table in WEBUI.

Usually we call our WClass file in WCreateFromFactory (static by giving tableID and Class name) in Zkwebui

My Question is how use another "CreateLineFrom" form in Same Window?

Answer1:

If you need one more <strong>Create Line From</strong> button functionality through only configuration changes then you need follow following point

<ol><li>Drop the <strong>AD_FIELD_COLUMN</strong> index of AD_Field table, </li> <li>Create one more record in Field tab of <em>Window, Tab And field</em> <strong>window</strong>. </li> </ol>

Ex :- Field Name as Crate Lines From2<br /> Column AS CrateFrom And save the record. <br /> Now and by using field sequence tab you can align second Crate Lines From2 button.

This thing you can do without changing the code.

<hr />

If you are ready to change the code then modify <strong>AbstractADWindowPanel.java</strong> class

in <strong>actionButton</strong> method you can find the

else if (col.equals("CreateFrom")) code

just update this code as follows

else if (col.equals("CreateFrom") || col.equals("newFieldName"))

Now you can add above your desired column in following tables and column should be newFieldName (What ever you written in java code) C_Invoice, M_InOut, M_Movement, C_BankStatement.

Steps to show field in a form :-

<ol><li>Open <strong>Table And column</strong> Window And select above any table</li> <li>Crate a System element with newFieldName and save it</li> <li>Enter Database column Name and Name as same</li> <li>Select the length as 1 </li> <li>Reference as button and save the record</li> <li>Now click on the synchronize column button</li> <li>Now open any respective <strong>Window, Tab Field</strong> and select the <strong>Tab</strong> tab</li> <li>Click on the Create Fields button, You will get newly created button </li> <li>You can align the field by using <strong>Field</strong> and <strong>Field sequence</strong> tabs</li> </ol>

let me know why do you need 2 same fields in one tab, is this related to security ? if it is then we can achieve very simple way

Answer2:

In adempiere functionality can't create 2 CLF form in Same Window because hashmap stored the last given value i.e when i execute it call the " WCreateFrom2UI.class"

private static HashMap<Integer, Class<? extends ICreateFrom>> registeredClasses = null; static { s_registeredClasses.put(I_C_Order.Table_ID, WCreateFrom1UI.class); s_registeredClasses.put(I_C_Order.Table_ID, WCreateFrom2UI.class); }

Created New Button named as "CreateFromIM" ,added the action in AbstractADwindowPanel and created new Class WCreateFromIMFactory that is copy of WCreateFromFactory

if (col.equals("CreateFrom") ) { ICreateFrom cf = WCreateFromFactory.create(curTab); } else if (col.equals("CreateFromIM") ) ICreateFrom cf = WCreateFromIMFactory.createIM(curTab); }

Recommend

  • How do I fix “cannot find derive macro in this scope”?
  • iPad Orientations
  • Compiling Rust static library and using it in C++: undefined reference
  • MySQL Query - Sum the Capacity of Multiple Warehouses
  • Interfacing C++ with Rust - returning CString panics
  • Adding the year implementation in c++ using a class
  • Why do I get incorrect values when implementing HMAC-SHA256?
  • What's the best way to have reusable dialog boxes?
  • How do one only submit click event (div), when using jquery live function?
  • Get last insert id of Postgresql
  • Is it possible to generate a unique numeric value for each row in an iSeries table without looping?
  • TCPDF's getNumLines() is sometimes wrong
  • Play Framework nested form errors missing
  • C++ - Is destructor called when a vector holds objects?
  • IOS > Open URL in Safari with POST
  • Primefaces lazy datascroller calling load twice
  • How to access meteor package name inside package?
  • Rest Services conventions
  • How to autopopulate a field in SugarCRM form
  • SonarQube: Cannot deactivate rule with missing quality profile
  • Uncaught TypeError: $(…).select2 is not a function
  • Button click event not firing in jQuery
  • OOP Javascript - Is “get property” method necessary?
  • chrome.tabs.executeScript only fires when the Developer Console is open
  • JSON response opens as a file, but I can't access it with JavaScript
  • Retrieving value from sql ExecuteScalar()
  • Master page gives error
  • Redux, normalised entities and lodash merge
  • Calling of Constructors in a Java
  • Traverse Array and Display in markup
  • Transpose CSV data with awk (pivot transformation)
  • KeystoneJS: Relationships in Admin UI not updating
  • Acquiring multiple attributes from .xml file in c#
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Hits per day in Google Big Query
  • Why joiner is not used after Sequence generator or Update statergy
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • Checking variable from a different class in C#
  • java string with new operator and a literal