product commission transaction in commissioner

This commit is contained in:
Zin Lin Phyo
2017-08-28 18:17:22 +06:30
parent 36b4b15688
commit 1cbea173df
17 changed files with 460 additions and 350 deletions

View File

@@ -1,5 +1,16 @@
class Commission < ApplicationRecord
self.primary_key = 'commission_id'
# primary key - need to be unique
before_create :generate_custom_id
belongs_to :menu_item, foreign_key: 'product_code'
has_many :commissioners
has_many :product_commissions
private
def generate_custom_id
self.commission_id = SeedGenerator.generate_id(self.class.name, 'COM')
end
end