def sync_from_quickbooks_to_erp(quickbooks_settings): global realm_id global access_token global access_token_secret global authorize_url global request_token global request_token_secret global QUICKBOOKS_CLIENT_KEY global QUICKBOOKS_CLIENT_SECRET realm_id =quickbooks_settings.realm_id access_token =quickbooks_settings.access_token access_token_secret = quickbooks_settings.access_token_secret QUICKBOOKS_CLIENT_KEY = quickbooks_settings.consumer_key QUICKBOOKS_CLIENT_SECRET = quickbooks_settings.consumer_secret quickbooks_obj = QuickBooks( sandbox=True, consumer_key=quickbooks_settings.consumer_key, consumer_secret=quickbooks_settings.consumer_secret, access_token=quickbooks_settings.access_token, access_token_secret=quickbooks_settings.access_token_secret, company_id=quickbooks_settings.realm_id ) frappe.db.set_value("Quickbooks Settings", None, "last_sync_datetime", frappe.utils.now()) sync_customers(quickbooks_obj) sync_suppliers(quickbooks_obj) create_Employee(quickbooks_obj) create_Item(quickbooks_obj) sync_Account(quickbooks_obj) sync_si_orders(quickbooks_obj) sync_pi_orders(quickbooks_obj) payment_invoice(quickbooks_obj) bill_payment(quickbooks_obj) sync_entry(quickbooks_obj)
def sync_qb(): quickbooks_settings = frappe.get_doc("Quickbooks Settings") quickbooks_objects = QuickBooks( sandbox=False, consumer_key=quickbooks_settings.consumer_key, consumer_secret=quickbooks_settings.consumer_secret, access_token=quickbooks_settings.access_token, access_token_secret=quickbooks_settings.access_token_secret, company_id=quickbooks_settings.realm_id, minorversion=3) creates_qb_accounts_heads_to_erp_chart_of_accounts() sync_taxagency(quickbooks_objects) sync_tax_rate(quickbooks_objects) sync_tax_code(quickbooks_objects) sync_Account(quickbooks_objects) sync_customers(quickbooks_objects) sync_suppliers(quickbooks_objects) sync_terms(quickbooks_objects) create_Employee(quickbooks_objects) sync_items(quickbooks_objects) sync_si_orders(quickbooks_objects) sync_pi_orders(quickbooks_objects) sync_payments(quickbooks_objects) sync_bill_payments(quickbooks_objects) sync_expenses(quickbooks_objects) frappe.db.set_value("Quickbooks Settings", None, "sync_master", 1) frappe.db.set_value("Quickbooks Settings", None, "last_sync_datetime", frappe.utils.now()) frappe.db.commit() return True
def sync_from_quickbooks_to_erp(quickbooks_settings): global realm_id global access_token global access_token_secret global authorize_url global request_token global request_token_secret global QUICKBOOKS_CLIENT_KEY global QUICKBOOKS_CLIENT_SECRET realm_id =quickbooks_settings.realm_id access_token =quickbooks_settings.access_token access_token_secret = quickbooks_settings.access_token_secret QUICKBOOKS_CLIENT_KEY = quickbooks_settings.consumer_key QUICKBOOKS_CLIENT_SECRET = quickbooks_settings.consumer_secret quickbooks_obj = QuickBooks( sandbox=True, consumer_key=quickbooks_settings.consumer_key, consumer_secret=quickbooks_settings.consumer_secret, access_token=quickbooks_settings.access_token, access_token_secret=quickbooks_settings.access_token_secret, company_id=quickbooks_settings.realm_id, minorversion=3 ) print "\n\n\n\n________________________\n\n\n\n" print "quickbooks_obj",quickbooks_obj
def sync_from_erp_to_quickbooks(quickbooks_settings): quickbooks_obj = QuickBooks( sandbox=True, consumer_key=quickbooks_settings.consumer_key, consumer_secret=quickbooks_settings.consumer_secret, access_token=quickbooks_settings.access_token, access_token_secret=quickbooks_settings.access_token_secret, company_id=quickbooks_settings.realm_id) sync_erp_customers(quickbooks_obj) sync_erp_suppliers(quickbooks_obj) # sync_erp_employees() sync_erp_accounts(quickbooks_obj) # sync_erp_items() sync_erp_sales_invoices(quickbooks_obj) sync_erp_purchase_invoices()
def sync_account_masters(): quickbooks_settings = frappe.get_doc("Quickbooks Settings") quickbooks_objects = QuickBooks( sandbox=False, consumer_key=quickbooks_settings.consumer_key, consumer_secret=quickbooks_settings.consumer_secret, access_token=quickbooks_settings.access_token, access_token_secret=quickbooks_settings.access_token_secret, company_id=quickbooks_settings.realm_id, minorversion=3) creates_qb_accounts_heads_to_erp_chart_of_accounts() sync_taxagency(quickbooks_objects) sync_tax_rate(quickbooks_objects) sync_tax_code(quickbooks_objects) sync_Account(quickbooks_objects) frappe.db.set_value("Quickbooks Settings", None, "sync_master", 1) frappe.db.commit() return True
def sync_transaction(): quickbooks_settings = frappe.get_doc("Quickbooks Settings") quickbooks_objects = QuickBooks( sandbox=False, consumer_key=quickbooks_settings.consumer_key, consumer_secret=quickbooks_settings.consumer_secret, access_token=quickbooks_settings.access_token, access_token_secret=quickbooks_settings.access_token_secret, company_id=quickbooks_settings.realm_id, minorversion=3) sync_si_orders(quickbooks_objects) sync_pi_orders(quickbooks_objects) sync_payments(quickbooks_objects) sync_bill_payments(quickbooks_objects) sync_expenses(quickbooks_objects) frappe.db.set_value("Quickbooks Settings", None, "last_sync_datetime", frappe.utils.now()) frappe.db.commit() return True
def sync_from_quickbooks_to_erp(quickbooks_settings): quickbooks_obj = QuickBooks( sandbox=True, client_id=quickbooks_settings.client_id, client_secret=quickbooks_settings.client_secret, access_token=quickbooks_settings.access_token, company_id=quickbooks_settings.realm_id ) sync_customers(quickbooks_obj) sync_suppliers(quickbooks_obj) create_Employee(quickbooks_obj) create_Item(quickbooks_obj) sync_Account(quickbooks_obj) sync_si_orders(quickbooks_obj) sync_pi_orders(quickbooks_obj) payment_invoice(quickbooks_obj) bill_payment(quickbooks_obj) sync_entry(quickbooks_obj) frappe.db.set_value("Quickbooks Settings", None, "last_sync_datetime", frappe.utils.now())