Projects:Filter Product Categories Definition
When logging into WebPOS the system retrieves the valid/applicable product categories from the server by doing a query for the valid products and identifying their unique list of product categories.
In high volume environments with millions of products, this query can take a very long time to run and is very resource intensive.
To solve this the proposal is to keep an explicit list of product categories by assortment. This list is computed from the products of an assortment. So no manual actions. The product category list is stored in a table: filter product categories. This table is a child table of assortment.
If the filter product categories are present in an assortment then the system should use these product categories when loading the product categories in WebPOS.
For backward compatibility: if there are no filter product categories for an assortment then the system should work in the same way as now.
Filter categories are to be defined as a child-tab (and table) of the assortment tab. The tab should be completely read only.
The new Filter Product Category table has the following columns:
- primary key
- standard columns: clien/org/audit columns
- mandatory foreign key to assortment (parent)
- mandatory foreign key to product category (which is also the identifier)
There should be a unique key on the combination of assortment and product category.
The product categories filter table should be used when: the high volume product preference is set to Y
The java/logic changes are to be made here: https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/tip/src/org/openbravo/retail/posterminal/master/Category.java
Computing the filter product categories
The following code has to be implemented:
- EntityEventHandler: an entity event handler should be created which is run when a new record is created in the product list table (product by assortment). If the product category of the product is not yet in the filter product category table then it should be added
- Periodical process: a process should be implemented which can be run periodically (daily). For each assortment it should:
- clear the filter product categories of the assortment (is necessary as also products can be removed from the assortment)
- check all products of an assortment and compute the set of product categories used in the assortment (group by product category of the active products in an assortment).
- create the new unique filter product categories in the assortment from this list.
After the development is done (when screenshots are available), update the user documentation here: