Plugin: Alternative Output
From iDempiere en
- Creator: Red1 (talk) - RED1.org
- Current Version: 2.1
- License: GPLv2 - Free as in Freedom not Free Lunch
- Source: BitBucket
- Plugin: plugin & 2Pack
- Forum: red1.org
- Sponsor: AulerSipel.
- This is a proof of concept to evolve a sufficient model and validate assumptions
- A progressive version with consolidation feature is at Plugin:_Alt_OrderLine
- This plugin is usable as demonstrated below. (bitbucket.org/red1/OutputMaker)
- There are times when users want to see the display screen output or on print format differently from what is in the records.
- Particularly in Sales Orders, where the Order Lines have too many repetitive items and need to be consolidated.
- Or they need to hide certain details and show another detail instead such as in the case of BOMs where detail pricing is not desired for the customer to know, other than a total summary price.
- Previous workarounds have been to consolidate such lines but that will destroy its tracking information of which line ID came from which source, as in the case of Plugin:_Couple_Product
- The principle here is again the Java O-O maxim, 'Separation of Concern' or 'I don't bother with what happens elsewhere'.
Clever Use of Tab Replacement
- There shall be an extra tab called 'OrderOutput' that is alongside the OrderLine tab that derives info from.
- Plugin Event Validator can populate the text using hash rules set in another model.
- The hash rule model reuses the MProductBOM header record at the DocumentNote field.
- The usual detail tab can be hidden where only the output tab is visible. Otherwise the user can have both but usually refers to the OrderOutput for readability and OrderLine to check source of it.
- During printout, the OrderOutput is referred.
Total separation in plugin
- This window can be a copy of the original so as not to impact the core setting.
- This plugin can house the new window and model validator to populate the new tab.
- Calling back the original window i.e. Sales Order will show absolutely original information.
- (In the example below which is minimal yet sufficient, we are adding a tab made from a new model to the Sales Order window - also no impact.)
Table Model for Display Line
- Name = C_OrderOutput
- Tab Level = 1
- Relationship = One to one - each Order has only one OrderOutput record of text display
- It is only a single table model with one significant field:
- Description - populated according to above hash rules to set:
- GrandTotal and parent header
- Product Description
- Consolidated format
- Likewise a Print Format will be an alternative print format link to this new window.
- The print format will access the output tab for its print out arrangement.
- Event Validator - AFTER_PREPARE in DOCUMENT_C_Order
- According to Rule - format and/or consolidate to C_OrderOutput
- Since it occurs in AFTER_PREPARE event, it can be done repeatedly but previous is overwritten.
Hash Rule Types
- Same Product Line Consolidation
- Add to Qty, Display shows product name remains same
- Same Line Descriptive Consolidation
- Add to Qty, Display repeats how many OrderLine occurrences i.e. (Qty X ProductName + ..)
- Same Line More Descriptive
- No Qty, Full Description Display, i.e. 'Qty of ProductName'+'..'
- BOM Parent
- Display only BOM Parent
- BOM Parent Children
- Display with BOM Parent, Children prices
- BOM Parent Hide Children
- Display BOM without Children prices
- Implemented the last three rules and with only one simple model - C_OrderOutput, triggered when a product is defined in any MProductBOM.
- Config done in Product tab of of the parent
- Parts tab of BOM window
- Using the DocumentNote field only.
- Source committed to http://bitbucket.org/red1/outputmaker
- Setup screen and output screen given on the right here.
- The hash settings are:
- HEADER = false; //consolidated to parent name, no details unless ..
- DESCRIPTION = false; //add description
- COMMENT = false;//add comment
- DETAIL_NO_PRICE = false;//add details no prices ELSE detail original price
- DETAIL_OWN_PRICE = false;//details with prices replaced by BOM children's description or orderline description marked with *PRICE*
- CONSOLIDATED_STATEMENT; //TODO (at another plugin Plugin:_Alt_OrderLine)
- As seen the output follows the setting in the window above it
- This independent plugin as promised has no change to core nor break any data model.
- Its source code is still in progress but it allows very easy changes
- Pending work is the PrintFormat to replace the Sales Order format. (in new plugin)
- The bottom screen shot shows setting at DETAIL_OWN_PRICE where both BOM product Description and OrderLine Description (PRICE#44) sets preferred values.
- The space padding is not accurate due to UI font not been equidistant as in Text mode.
If you want to provide additional comments, please use the Discussion page.