mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Added removal for deleted entery while syncing
Added Invoices & Estimates to QBO#Index
This commit is contained in:
@@ -19,13 +19,24 @@ class QboEstimate < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.update_all
|
||||
service = get_base.service
|
||||
|
||||
# Update the item table
|
||||
get_base.service.all.each { |estimate|
|
||||
service.all.each { |estimate|
|
||||
qbo_estimate = QboEstimate.find_or_create_by(id: estimate.id)
|
||||
qbo_estimate.doc_number = estimate.doc_number
|
||||
qbo_estimate.id = estimate.id
|
||||
qbo_estimate.save!
|
||||
}
|
||||
|
||||
#remove deleted estimates
|
||||
all.each { |estimate|
|
||||
begin
|
||||
service.fetch_by_id(estimate.id)
|
||||
rescue
|
||||
delete_all(id: estimate.id)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def self.update(id)
|
||||
|
||||
Reference in New Issue
Block a user