Bill of materials for Opportunities
The purpose of this post is to describe the first customization made on Zurmo Covering the minimal use case “Bill of Materials for Opportunities”.
In this use case, Opportunities will be treated as garments that we need to produce, and the garments are assembled using Materials (Ex: Fabrics, trims, etc…).
In this first iteration we implement a very basic case but with some important requirements:
- Attach images to both Opportunities (Garments) and Materials.
- Thumbnail view of the material in search view.
- Associate materials to opportunities, having the list in the OpportunityEditAndDetailsView.
- Each Time a Material is associated to an Opportunity the total cost of the Materials must be calculated converting to the currency specified in the Opportunity->Amount field.
- We should be able to remove Materials from the opportunity.
- Some extra operations can be realized via CBR (Custom Business Rules) to multiple selected materials in the list.
The following sections will describe how each of these requirements have been implemented.
Attach images to both Opportunities (Garments) and Materials
Using the “Image Gallery” module it has been very easy to add images.
A new customized module has been added to define Materials.
Thumbnail view of the material in search view
To implement this request some changes has been made to the “Image Gallery” in order to return the thumbnail image in the appropriate size, and a new column adapter has been used in the MaterialsListView.
Associate materials to opportunities, having the list in the OpportunityEditAndDetailsView
In order to associate Materials to Opportunities a new module called bomdetails has been customized.
This module holds the information of the link between a Material and an Opportunity.
After the link is done using a new customized view based on the RelatedListView, the data is presented in the Opportunities module.
Field to calculate total price of Materials
Using an action element that has been added to the “toolbar” section of the RelatedListView, some Ajax and a new function in the model, we have been able to add the field that sums the total prices of materials converting to the specified currency
We should be able to remove Materials from the opportunity id required
A new column adapter has been added to allow deletion of individual lines.
Extra operations can be realized via CBR to multiple selected materials in the list
In order to allow the selection of elements the Bom details related ListView inherits from SecuredRelatedSelectableListView, this way we can reuse the standard behavior from Zurmo.
After the elements are selected it’s very easy to retrieve them elements and operate on them using an action element.
This is all for this post, the solution will continue to evolve and we’ll keep you informed on the evolution in new posts.