mirror of
https://github.com/rickbarrette/redmine_qbo_lineitems.git
synced 2026-04-02 07:01:59 -04:00
Compare commits
2 Commits
60a7f769ce
...
ec1ef72267
| Author | SHA1 | Date | |
|---|---|---|---|
| ec1ef72267 | |||
| 564158722d |
@@ -46,7 +46,9 @@ class BillLineItemsJob < ActiveJob::Base
|
||||
|
||||
estimate = Quickbooks::Model::Estimate.new(customer_id: issue.customer.id)
|
||||
estimate_service = Quickbooks::Service::Estimate.new( company_id: qbo.realm_id, access_token: access_token)
|
||||
estimate.line_items << Quickbooks::Model::InvoiceLineItem.new(description: "#{I18n.t(:notice_added_from)}#{issue.id} #{issue.subject}", detail_type: 'DescriptionOnly' )
|
||||
memo = "Added from: #{issue.tracker} ##{issue.id}: #{issue.subject}"
|
||||
estimate.private_note = memo
|
||||
estimate.line_items << Quickbooks::Model::InvoiceLineItem.new(description: memo, detail_type: 'DescriptionOnly' )
|
||||
|
||||
unbilled_entries.each do |item|
|
||||
log "Creating Line Item for #{item.description}"
|
||||
|
||||
@@ -18,29 +18,25 @@ class Item < QboBaseModel
|
||||
|
||||
# Updates Both local & remote DB description
|
||||
def description=(s)
|
||||
details
|
||||
@details.description = s
|
||||
details.description = s
|
||||
super
|
||||
end
|
||||
|
||||
# Updates Both local & remote DB name
|
||||
def name=(s)
|
||||
details
|
||||
@details.name = s
|
||||
details.name = s
|
||||
super
|
||||
end
|
||||
|
||||
# Updates Both local & remote DB sku
|
||||
def sku=(s)
|
||||
details
|
||||
@details.sku = s
|
||||
details.sku = s
|
||||
super
|
||||
end
|
||||
|
||||
# Updates Both local & remote DB price
|
||||
def unit_price=(s)
|
||||
details
|
||||
@details.unit_price = s
|
||||
details.unit_price = s
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
@@ -28,12 +28,7 @@ class ItemService < ServiceBase
|
||||
|
||||
def default_income_account
|
||||
log "Looking up sales income account"
|
||||
qbo = QboConnectionService.current!
|
||||
qbo.perform_authenticated_request do |token|
|
||||
service = Quickbooks::Service::Account.new(
|
||||
company_id: qbo.realm_id,
|
||||
access_token: token
|
||||
)
|
||||
QboConnectionService.with_qbo_service(entity: Invoice) do |service|
|
||||
service.query("SELECT * FROM Account WHERE AccountType='Income' AND Name LIKE '%Sales%'").first
|
||||
end
|
||||
end
|
||||
|
||||
2
init.rb
2
init.rb
@@ -22,7 +22,7 @@ Redmine::Plugin.register :redmine_qbo_lineitems do
|
||||
|
||||
# Ensure redmine_qbo is installed
|
||||
begin
|
||||
requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.3.7'
|
||||
requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.3.9'
|
||||
rescue Redmine::PluginNotFound
|
||||
raise 'Please install the redmine_qbo plugin (https://github.com/rickbarrette/redmine_qbo)'
|
||||
end
|
||||
|
||||
@@ -21,8 +21,8 @@ module RedmineQboLineItems
|
||||
|
||||
# Called by the QboSyncDispatcher
|
||||
def qbo_full_sync (context={})
|
||||
log "Adding ItemSyncJob to QBO sync dispatcher"
|
||||
return ItemSyncJob
|
||||
log "Adding Item to QBO sync dispatcher"
|
||||
return Item
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user