mirror of
https://github.com/rickbarrette/redmine_qbo_lineitems.git
synced 2026-04-02 07:01:59 -04:00
Added accounts to allow for assinging income account to items, and selecting default income account. Also added item type selection
This commit is contained in:
@@ -10,12 +10,20 @@
|
||||
|
||||
class Item < QboBaseModel
|
||||
belongs_to :issue
|
||||
|
||||
belongs_to :account
|
||||
|
||||
validates_presence_of :id, :description
|
||||
validates :unit_price, numericality: { greater_than_or_equal_to: 0 }
|
||||
self.primary_key = :id
|
||||
self.inheritance_column = :_type_disabled
|
||||
qbo_sync push: true
|
||||
|
||||
# Updates Both local & remote DB account ref
|
||||
def account_id=(id)
|
||||
details.income_account_ref = Account.find(id).ref
|
||||
super
|
||||
end
|
||||
|
||||
# Updates Both local & remote DB description
|
||||
def description=(s)
|
||||
details.description = s
|
||||
@@ -34,6 +42,12 @@ class Item < QboBaseModel
|
||||
super
|
||||
end
|
||||
|
||||
# Updates Both local & remote DB type
|
||||
def type=(s)
|
||||
details.type = s.to_s
|
||||
super
|
||||
end
|
||||
|
||||
# Updates Both local & remote DB price
|
||||
def unit_price=(s)
|
||||
details.unit_price = s
|
||||
|
||||
Reference in New Issue
Block a user