mirror of
https://github.com/rickbarrette/redmine_qbo_lineitems.git
synced 2026-04-02 07:01:59 -04:00
Create estimate on issue close.
This commit is contained in:
@@ -14,4 +14,17 @@ class LineItem < ApplicationRecord
|
||||
validates :description, presence: true
|
||||
validates :quantity, numericality: { greater_than: 0 }
|
||||
validates :unit_price, numericality: { greater_than_or_equal_to: 0 }
|
||||
before_save :total
|
||||
|
||||
private
|
||||
|
||||
def total
|
||||
log "Updating line total"
|
||||
self.line_total = self.unit_price * self.quantity
|
||||
end
|
||||
|
||||
def log(msg)
|
||||
Rails.logger.info "[LineItem] #{msg}"
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user