Ecosoft/Customization for Bicycle Manufacturer Case Study

From ADempiere
Revision as of 03:21, 20 September 2010 by Kittiu (Talk) (Enhancement Detail)

Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Enhancement List

  • Enable Print & Print Preview Buttons With specific Logic
  • Simple one time credit approval (without the use of workflow)
  • Remove some actions in DocAction list based on DocStatus

Enhancement Detail

1. Enable Print & Print Preview Buttons With specific Logic

As of AD-360LTS, the Print and Print Preview Button is still not capable of enable/disable based on Document Status or other conditions, but only based on 1) report existence for that document type and 2) whether user has right to that report.

In our project, we have the need to prevent Document Forms (i.e., sales order, invoice, receipt) from being printed out when the document is not yet completed (or closed or voided) (DocStatus = CO, CL). There are some other alternative without touching the code, such as, have the status printout in big letters, so that people can spot it by their eye. But this is rejected by the client.

Requirement Summary

  • Use System Configurator window to control whether to use this feature.
  • Print and Print Preview button will be enabled only when the condition set is met. For example, we might want print buttons to enable only when document status is Complete/Closed/Voided, but except MM Shipment and AR Receipt Form that will be enabled in all DocStatus.

Step to deploy

  • 1) org.compiere.model.GridTab.java
    • Modify isPrinted() function to also check for the ENABLE_PRINT_BUTTON_WITH_LOGIC’s logic
	public boolean isPrinted()
	{
		// Start of Modification - Enable Print Buttons with some logics
		/* 
		 * return m_vo.AD_Process_ID != 0; 
		 */
		if (m_vo.AD_Process_ID == 0) {
			return false;
		} 
		else { // Check if Status is on the Enable List
			String docstatuslist = MSysConfig.getValue("ENABLE_PRINT_BUTTON_WITH_LOGIC", null, Env.getAD_Client_ID(m_vo.ctx), Env.getAD_Org_ID(m_vo.ctx));
			if (docstatuslist != null && docstatuslist.toString().length() > 0)
				return Evaluator.evaluateLogic(this, docstatuslist);
			else // No logic defined, back to normal
				return true;
		}
		// End of Modification - Enable Print Buttons with some logics
	}	//	isPrinted
  • 2) org.compiere.apps.APanel.java
    • Modify getTitle() function add 2 lines to also set enable the button,
      • aPrint.setEnabled(m_curTab.isPrinted());
      • aPrintPreview.setEnabled(m_curTab.isPrinted());
	public String getTitle()
	{
		// Start of Modification (add) - Enable Print Buttons with some logics
		aPrint.setEnabled(m_curTab.isPrinted());
		aPrintPreview.setEnabled(m_curTab.isPrinted());
		// End of Modification - Enable Print Buttons with some logics
  • 3) Add new record in System Configurator window
    • Name: ENABLE_PRINT_BUTTON_WITH_LOGIC
    • Search Key: @C_DocType_ID@=120 | @C_DocType_ID@=119 | @DocStatus@='CO' | @DocStatus@='CL' | @DocStatus@='VO'
    • Note: 120, 119 is the c_doctype_id, many change from system to system. Check Document Type window for the current id.

Sysconfig enable print.jpg

Remarks:

  • Discussion about this feature in forum [1]
  • In tracker, but not trunkable, as there is another alternative using rule script (applicable but not same result) [2]