mirror of
https://github.com/rickbarrette/redmine_qbo_lineitems.git
synced 2026-04-02 07:01:59 -04:00
Added taxable flag
This commit is contained in:
@@ -66,6 +66,7 @@ class ItemsController < ApplicationController
|
||||
|
||||
def new
|
||||
@item = Item.new
|
||||
@item.taxable.nil? ? true : @item.taxable
|
||||
end
|
||||
|
||||
def show
|
||||
@@ -95,7 +96,7 @@ class ItemsController < ApplicationController
|
||||
end
|
||||
|
||||
def item_params
|
||||
params.require(:item).permit(:name, :description, :sku, :unit_price, :active, :account_id, :type)
|
||||
params.require(:item).permit(:name, :description, :sku, :unit_price, :active, :account_id, :type, :taxable)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -17,6 +17,7 @@ class Item < QboBaseModel
|
||||
self.primary_key = :id
|
||||
self.inheritance_column = :_type_disabled
|
||||
qbo_sync push: true
|
||||
after_initialize :set_defaults, if: :new_record?
|
||||
|
||||
# Updates Both local & remote DB account ref
|
||||
def account_id=(id)
|
||||
@@ -35,7 +36,15 @@ class Item < QboBaseModel
|
||||
details.name = s
|
||||
super
|
||||
end
|
||||
|
||||
def ref
|
||||
Quickbooks::Model::BaseReference.new
|
||||
end
|
||||
|
||||
def set_defaults
|
||||
self.taxable = true if taxable.nil?
|
||||
end
|
||||
|
||||
# Updates Both local & remote DB sku
|
||||
def sku=(s)
|
||||
details.sku = s
|
||||
|
||||
@@ -23,6 +23,7 @@ class ItemSyncService < SyncServiceBase
|
||||
end
|
||||
|
||||
map_attribute :active, :active?
|
||||
map_attribute :taxable, :taxable?
|
||||
map_attributes :description, :id, :name, :sku, :type, :unit_price
|
||||
|
||||
end
|
||||
@@ -33,6 +33,13 @@
|
||||
<td style="padding: 8px;"><%= f.number_field :unit_price, step: 0.01, style: "width: 100%;" %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="padding: 8px; vertical-align: middle;"><%= f.label :taxable %></td>
|
||||
<td style="padding: 8px; vertical-align: middle;">
|
||||
<%= f.check_box :taxable %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="padding: 8px; vertical-align: top;"><%= f.label :account %></td>
|
||||
<td style="padding: 8px;">
|
||||
|
||||
Reference in New Issue
Block a user