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:
2026-03-16 22:59:54 -04:00
parent 7088550184
commit f81fe0ef87
13 changed files with 283 additions and 70 deletions

View File

@@ -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