update for order process

Add activereocrd-import gem for bulk insert
This commit is contained in:
Thein Lin Kyaw
2019-12-09 10:33:10 +06:30
parent 67e7658e56
commit 3a99e1bb09
22 changed files with 441 additions and 959 deletions

View File

@@ -5,8 +5,8 @@ class OrderItem < ApplicationRecord
before_create :generate_custom_id
#Associations
belongs_to :order, autosave: true
# belongs_to :order, counter_cache: true
belongs_to :order, autosave: true
# belongs_to :order, counter_cache: true
#Validation
validates_presence_of :item_code, :item_name, :qty
@@ -102,7 +102,13 @@ class OrderItem < ApplicationRecord
end
end
protected
def self.generate_ids(count = 1)
SeedGenerator.generate_ids(self.name, "ODI", count)
end
private
def generate_custom_id
if self.order_items_id.nil?
self.order_items_id = SeedGenerator.generate_id(self.class.name, "ODI")