Sales Commissions Tests
These tests are used to verify that the commissions feature in opentaps are functioning correctly. They refer to sales orders being created and shipped, but technically commission invoices are created when sales invoices are set to Ready, so the tests should also work just from invoices without corresponding sales orders.
Categories A, B, and C refer to "COMM_CATEGORY_A", "_B", and "_C." Use CRMSFA to create orders, then pack/ship the order using warehouse so that a sales invoice is generated. It might be good to receive inventory for the products in category A, B and C first but it does not seem to be necessary.
The key view is AgreementAndItemAndTerm which will be used to display the agreements and their terms in a UI later on.
- 1 Test Case 1: Commission for Any Product based on Order/Invoice Role
- 2 Test Case 2: Commission for Products in a Specific Category on Order/Invoice Role
- 3 Test Case 3: Negative Test
- 4 Test case 4: Commission based on Customer/Agent Relationship
- 5 Test case 5: No Commission for Zero Value Invoices
- 6 Test case 6: Commission based on Designated Sales Rep
Test Case 1: Commission for Any Product based on Order/Invoice Role
This test verifies that an agreement with a commission agent which covers any order created by the agent will earn a commission.
Create order as DemoSalesRep1 for DemoAccount1, any products. Pack and ship the order.
One commission invoice from DemoSalesRep1 which has 7% commission on everything except the sales tax and shipping.
Test Case 2: Commission for Products in a Specific Category on Order/Invoice Role
This test verifies sales commissions for an agent who earns commissions on certain products he/she sells (creates orders and becomes a "commission agent" on the order.
Create order as DemoSalesRep2 for DemoAccount1 with products from category A, B, C (any qty).
One commission invoice for DemoSalesRep2 with 25% commission on category A products and adjustments, 20% on category B, and 15% on C.
Test Case 3: Negative Test
3. Create order as DemoSalesRep3 for DemoAccount1 with products from category A (any qty). Results: No commission invoices. (This rep can only earn commission for DemoCustCompany orders).
4. Create order as DemoSalesRep3 for DemoCustCompany with 5 products from each category A, B and C. Split them up so that there are two products from category A, two from B and two from C. (2 GZ-1000 and 3 GZ-1001 for instance). Results: One commission invoice for DemoSalesRep3 with 30% commission for category A products, 20% commission for category B, and no commission for C (min qty 10 for that one).
5. Create order as DemoSalesRep2 for DemoCustCompany with 15 products from each category A, B and C. Split them up as in test #4. For instance, order 10 GZ-1000 and 5 GZ-1001 to fulfill category C. Results: Two commission invoices, one for DemoSalesRep2, and one for DemoSalesRep3. The commission for rep 2 should be the same as test #2. The commission for rep 3 is 35% for category A, 25% for category B and 15% for category C.
Test case 4: Commission based on Customer/Agent Relationship
Create a quick order as DemoSalesManager or DemoSalesRep4 or whoever does not have an Agreement. Pick 5 or so products from category A. The customer is DemoCustCompany. Make sure the only commission invoice generated is for DemoSalesRep3.
Test case 5: No Commission for Zero Value Invoices
Create an order as DemoSalesRep1 for 1 product from category A. Set the price of the product so that the line item is 0 (basically a free giveaway). Ensure a non-zero amount of shipping. Results: No commission invoices should be generated, as the invoice totals would be zero.
Test case 6: Commission based on Designated Sales Rep
This test should work on opentaps 1.4 and later versions
# Login as DemoSalesManager # Create a sales order where DemoSalesRep1 is the designated sales rep on the order header form # Approve, pack the order
Verify that there is a commission invoice from DemoSalesRep1 and not DemoSalesManager, because commission agreement 7000 gives DemoSalesRep1 a commission on orders where he is the sales rep.