Complex Sales Commission

Commission is something seem easy, yet never easy. What make it difficult is not the calculation method itself, but more into how and when the readily calculated commission can be released too sales people. For example, some company may says, OK, we have SO we have Invoice, commission is calculated, but to release it, the invoice must has been paid first. Some says, not enough, the money must be in the bank too. Some says, need the be paid on time and the selling price must not too low, etc…and guess what, it could be more complex than this especially when deal with SMEs.

We Ecosoft found that, the commission module from OpenERP can not satisfy our customer requirement, and so we build a new module from the ground up. This module is “Sales Commission Calculation” and again with open source spirit, now it is freely available at http://apps.openerp.com (search for sale_commission_calc).

Our commission module is very much focus on the release condition of commissions, which we think is very important for our customer requirement. For the commission calculation, though at the beginning we have 5 method (for most customers, it is enough), but we have make sure that our code is good enough for easy extension.

The concept of Sales Commission Calculation module

Each Salesperson (or Team) will have 1 Worksheet per Period. Each worksheet will list commission lines, each with a calculated commission to be released as Commission Invoice. Commission amount will be created based on the Commission Rule assiged to each Salesperson (or Team). Whether each commission line is “Ready” will be based Release Conditions specified for each salesperson / team. If those conditions are met (e.g., is paid, due date, etc) the commission line status will be changed to “Ready”, and the commission invoice then can be created for that particular salesperson. And whether or not the commission is ready, user can always force release or skip.

sale_commission_calc

 Working Steps

  1. Assign commission rule and release conditions for all salesperson / sales team. Use Configuration > Salesperson (or Sales Team).
  2. In each Sales Order, as salesperson assigned, resulting Customer Invoice will have that salesperson / team in “Salesperson/Team and Commission” section of Other Info tab. This mark this invoices as eligible for commision for this salesperson.
  3. Create Commission Worksheet for Salesperson / Team vs Period of interest.
  4. Click “Calculate Commission” in the worksheet to list all eligible invoices of the period. System check for the commission readiness of each line.
  5. Confirm this worksheet to freeze the commission lines, and make it ready to Create Commission Invoice.
  6. For lines stated as “Ready”, click “Create Commission Invoice” button will create Commission Invoices.
  7. Worksheet state will be “Done” as all lines stated as “Ready” has been created as Commission Invoices.

Possible fix for login error

In some case, you may found a weird Access Denied (Document type: Users, Operation: read) after deep system upgrade. While checking the setting for that user, it seem all correct. This is quite a cumber some for me, at least.

Following is the cause I found after debugging the system.

login_error

Problem caused by Record Rule – “user rule”

You can test it whether this is the problem, by try to inactive this rule. If user can log in then, this is it. I found this problem happen, after I upgrade account module.

The problem was becuase user records for the company in res_company_users_rel table was deleted. I fix it by adding it back using following SQL.

insert into res_company_users_rel (select 1, id from res_users where id not in (1))

That’s it!

OpenERP – Thai Withholding Tax

Withholding Tax is a required feature if you do business in Thailand (and as I know in many other part of the world), yet we found it not available in many standard ERP packages. Ecosoft has developed an extension to accounting module which will make it comply with Thai Withholding Tax rule and is now freely available at http://apps.openerp.com (search for account_thai_wht).

What is Withholding Tax?

When an organisation render Services from vendor or provide services to customer, there will be withholding tax payable or withholding tax receivable occur in business process. The tax will be withheld from the full amount of service price to pay to the Revenue Department on monthly basis in case of Tax Payable and to be credited on Corporate Income Tax at the end of year in case of Tax Receivable.

References: Withholding Tax in Thailand

Sample Case

Following is the sample case we will use to explain how it works in this tutorial.

Service Fee: 1,000, Tax (VAT) 7%: 70, WHT 3%: 30 ==> Total 1,070, Withhold 30

Setup OpenERP for Withholding Tax

  • Install addons account_thai_wht (it also depend on some other modules need to get it seperately from apps.openerp.com)
  • Go to Tax window and create new Withholding Tax. Also note that we can specify minimum threshold amount that this tax will apply

thai_wht_tax_setup

Working Steps:

  • Create Purchase Order for a Service, amount 1,000. As it is Service type it will require 2 kind of taxes 1) VAT 2) Withholding Tax
  • As you will see, for Withholding Tax, although specified, will not deducted yet, as it will be so in Payment.

thai_wht_tax_po

  • Once Purchase Order is confirmed, and Invoice is created, you will see in the invoice all the detail about VAT and Withholding Tax.
  • But again, Withholding Tax is not yet deducted in invoice.

thai_wht_tax_inv

  • And finally for the Supplier Payment, company need not pay full amount of 1,070 but only 1,040 as 30 will be withheld for the Revenue Department

thai_wht_tax_pay

Withholding Tax is a very important feature when implement OpenERP in Thailand.  That’s just the simply example but the same will apply for Sales Cycle, partial payment (and partial WHT) is also supported, account Posting will be done automatically.

Finally we can print out the Withholding Tax Certificate (หนังสือรับรองหัก ณ. ที่จ่าย).

thai_wht_cert

Note: addon jasper_reports is required to print CERT