Maxwell Morais A log of everyday life

Introduction to Sales Comissions

For some companies perform and account Sales Comissions is a really hard task! Thinking about this I started developing a small solution to determine the comissions of each member in the Sales Team.

These comissions can be managed like as Pricing Rules, or Tax Rules due a combination of various fields and values:

Sales Comission

  • Reference is a human readable name of the Sales Comission
  • Comission Base indicates if a comission is based in a Item or Item Group
  • Comisson To indicates the record name of the Comission Base
  • Party Type indicates if a comission is based in a Customer or Customer Group
  • Party indicates the record name of the Party Type
  • Sales Person indicates the Person or the Group that the comission will be assigned
  • Comission On indicates the transaction where the comission will be computed, it should be Quotation, Sales Order or Sales Invoice
  • Comission Type indicates the type of the comission, it can be Value for a fixed comission, or Percent to a variant comission.
  • Fieldname indicates the base field to compute the Percent comission
  • Comission Rate (%)/Value indicates the rate or the comission value

These rules are evaluated at the validation method of the Transactions, and it compute the right values in the Sales Team table, under the transaction.

In the given example the comission should be computed based in the PO Amount custom field in the body of the Sales Order

Comission Base

How you can see, the comission is right computed for the Sales Person in the below image

Computed Comission

Don’t matter if the Comission is based on the Transaction Amount, or if it is a Fixed Value, this customization ever will lookup to the right comission and store in the Incentives field, the other fields are filled just to continue using the standard behavior of ERPNext.

The rule to determine the hierarchy of the comission is based from the Group (Customer Group or Item Group) to the Party or Item how more high the level of record that the comission is attached , less important is this! So, a comission attached to a Item overrides a comission to his parent group!