custom primary key for transaction

This commit is contained in:
Min Zeya Phyo
2017-06-04 16:27:14 +06:30
parent 394d2ed938
commit 4fc511d531
19 changed files with 88 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
#primary key - need to be unique generated for multiple shops
class Sale < ApplicationRecord
#primary key - need to be unique generated for multiple shops
#before_create :generate_receipt_no
belongs_to :cashier, :optional => true
belongs_to :customer, :optional => true
@@ -242,4 +242,8 @@ class Sale < ApplicationRecord
end
end
private
def generate_custom_id
self.sale_id = SeedGenerator.generate_id(self.class.name, "SAL")
end
end