Merge branch 'develop' of github.com:frappe/erpnext into feature-pick-list
This commit is contained in:
commit
ca872381a1
@ -66,10 +66,11 @@
|
|||||||
"net_total",
|
"net_total",
|
||||||
"total_net_weight",
|
"total_net_weight",
|
||||||
"taxes_section",
|
"taxes_section",
|
||||||
"taxes_and_charges",
|
"tax_category",
|
||||||
"column_break_50",
|
"column_break_50",
|
||||||
"shipping_rule",
|
"shipping_rule",
|
||||||
"section_break_52",
|
"section_break_52",
|
||||||
|
"taxes_and_charges",
|
||||||
"taxes",
|
"taxes",
|
||||||
"sec_tax_breakup",
|
"sec_tax_breakup",
|
||||||
"other_charges_calculation",
|
"other_charges_calculation",
|
||||||
@ -569,7 +570,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "taxes_and_charges",
|
"fieldname": "taxes_and_charges",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Taxes and Charges",
|
"label": "Purchase Taxes and Charges Template",
|
||||||
"oldfieldname": "purchase_other_charges",
|
"oldfieldname": "purchase_other_charges",
|
||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
"options": "Purchase Taxes and Charges Template",
|
"options": "Purchase Taxes and Charges Template",
|
||||||
@ -1032,12 +1033,18 @@
|
|||||||
"fieldname": "update_auto_repeat_reference",
|
"fieldname": "update_auto_repeat_reference",
|
||||||
"fieldtype": "Button",
|
"fieldtype": "Button",
|
||||||
"label": "Update Auto Repeat Reference"
|
"label": "Update Auto Repeat Reference"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "tax_category",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Tax Category",
|
||||||
|
"options": "Tax Category"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
"idx": 105,
|
"idx": 105,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2019-06-24 21:22:05.483429",
|
"modified": "2019-07-11 18:25:49.509343",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Purchase Order",
|
"name": "Purchase Order",
|
||||||
|
|||||||
@ -281,9 +281,9 @@ def get_data():
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "report",
|
"type": "report",
|
||||||
|
"is_query_report": True,
|
||||||
"name": "Item Shortage Report",
|
"name": "Item Shortage Report",
|
||||||
"route": "#Report/Bin/Item Shortage Report",
|
"doctype": "Bin"
|
||||||
"doctype": "Purchase Receipt"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "report",
|
"type": "report",
|
||||||
|
|||||||
@ -7,7 +7,9 @@ import frappe
|
|||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from requests_oauthlib import OAuth2Session
|
from requests_oauthlib import OAuth2Session
|
||||||
import json, requests
|
import json
|
||||||
|
import requests
|
||||||
|
import traceback
|
||||||
from erpnext import encode_company_abbr
|
from erpnext import encode_company_abbr
|
||||||
|
|
||||||
# QuickBooks requires a redirect URL, User will be redirect to this URL
|
# QuickBooks requires a redirect URL, User will be redirect to this URL
|
||||||
@ -32,7 +34,6 @@ def callback(*args, **kwargs):
|
|||||||
class QuickBooksMigrator(Document):
|
class QuickBooksMigrator(Document):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(QuickBooksMigrator, self).__init__(*args, **kwargs)
|
super(QuickBooksMigrator, self).__init__(*args, **kwargs)
|
||||||
from pprint import pprint
|
|
||||||
self.oauth = OAuth2Session(
|
self.oauth = OAuth2Session(
|
||||||
client_id=self.client_id,
|
client_id=self.client_id,
|
||||||
redirect_uri=self.redirect_url,
|
redirect_uri=self.redirect_url,
|
||||||
@ -46,7 +47,9 @@ class QuickBooksMigrator(Document):
|
|||||||
if self.company:
|
if self.company:
|
||||||
# We need a Cost Center corresponding to the selected erpnext Company
|
# We need a Cost Center corresponding to the selected erpnext Company
|
||||||
self.default_cost_center = frappe.db.get_value('Company', self.company, 'cost_center')
|
self.default_cost_center = frappe.db.get_value('Company', self.company, 'cost_center')
|
||||||
self.default_warehouse = frappe.get_all('Warehouse', filters={"company": self.company, "is_group": 0})[0]["name"]
|
company_warehouses = frappe.get_all('Warehouse', filters={"company": self.company, "is_group": 0})
|
||||||
|
if company_warehouses:
|
||||||
|
self.default_warehouse = company_warehouses[0].name
|
||||||
if self.authorization_endpoint:
|
if self.authorization_endpoint:
|
||||||
self.authorization_url = self.oauth.authorization_url(self.authorization_endpoint)[0]
|
self.authorization_url = self.oauth.authorization_url(self.authorization_endpoint)[0]
|
||||||
|
|
||||||
@ -218,7 +221,7 @@ class QuickBooksMigrator(Document):
|
|||||||
|
|
||||||
def _fetch_general_ledger(self):
|
def _fetch_general_ledger(self):
|
||||||
try:
|
try:
|
||||||
query_uri = "{}/company/{}/reports/GeneralLedger".format(self.api_endpoint ,self.quickbooks_company_id)
|
query_uri = "{}/company/{}/reports/GeneralLedger".format(self.api_endpoint, self.quickbooks_company_id)
|
||||||
response = self._get(query_uri,
|
response = self._get(query_uri,
|
||||||
params={
|
params={
|
||||||
"columns": ",".join(["tx_date", "txn_type", "credit_amt", "debt_amt"]),
|
"columns": ",".join(["tx_date", "txn_type", "credit_amt", "debt_amt"]),
|
||||||
@ -493,17 +496,17 @@ class QuickBooksMigrator(Document):
|
|||||||
"account_currency": customer["CurrencyRef"]["value"],
|
"account_currency": customer["CurrencyRef"]["value"],
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
})[0]["name"]
|
})[0]["name"]
|
||||||
except Exception as e:
|
except Exception:
|
||||||
receivable_account = None
|
receivable_account = None
|
||||||
erpcustomer = frappe.get_doc({
|
erpcustomer = frappe.get_doc({
|
||||||
"doctype": "Customer",
|
"doctype": "Customer",
|
||||||
"quickbooks_id": customer["Id"],
|
"quickbooks_id": customer["Id"],
|
||||||
"customer_name" : encode_company_abbr(customer["DisplayName"], self.company),
|
"customer_name": encode_company_abbr(customer["DisplayName"], self.company),
|
||||||
"customer_type" : "Individual",
|
"customer_type": "Individual",
|
||||||
"customer_group" : "Commercial",
|
"customer_group": "Commercial",
|
||||||
"default_currency": customer["CurrencyRef"]["value"],
|
"default_currency": customer["CurrencyRef"]["value"],
|
||||||
"accounts": [{"company": self.company, "account": receivable_account}],
|
"accounts": [{"company": self.company, "account": receivable_account}],
|
||||||
"territory" : "All Territories",
|
"territory": "All Territories",
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
}).insert()
|
}).insert()
|
||||||
if "BillAddr" in customer:
|
if "BillAddr" in customer:
|
||||||
@ -521,7 +524,7 @@ class QuickBooksMigrator(Document):
|
|||||||
item_dict = {
|
item_dict = {
|
||||||
"doctype": "Item",
|
"doctype": "Item",
|
||||||
"quickbooks_id": item["Id"],
|
"quickbooks_id": item["Id"],
|
||||||
"item_code" : encode_company_abbr(item["Name"], self.company),
|
"item_code": encode_company_abbr(item["Name"], self.company),
|
||||||
"stock_uom": "Unit",
|
"stock_uom": "Unit",
|
||||||
"is_stock_item": 0,
|
"is_stock_item": 0,
|
||||||
"item_group": "All Item Groups",
|
"item_group": "All Item Groups",
|
||||||
@ -549,14 +552,14 @@ class QuickBooksMigrator(Document):
|
|||||||
erpsupplier = frappe.get_doc({
|
erpsupplier = frappe.get_doc({
|
||||||
"doctype": "Supplier",
|
"doctype": "Supplier",
|
||||||
"quickbooks_id": vendor["Id"],
|
"quickbooks_id": vendor["Id"],
|
||||||
"supplier_name" : encode_company_abbr(vendor["DisplayName"], self.company),
|
"supplier_name": encode_company_abbr(vendor["DisplayName"], self.company),
|
||||||
"supplier_group" : "All Supplier Groups",
|
"supplier_group": "All Supplier Groups",
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
}).insert()
|
}).insert()
|
||||||
if "BillAddr" in vendor:
|
if "BillAddr" in vendor:
|
||||||
self._create_address(erpsupplier, "Supplier", vendor["BillAddr"], "Billing")
|
self._create_address(erpsupplier, "Supplier", vendor["BillAddr"], "Billing")
|
||||||
if "ShipAddr" in vendor:
|
if "ShipAddr" in vendor:
|
||||||
self._create_address(erpsupplier, "Supplier",vendor["ShipAddr"], "Shipping")
|
self._create_address(erpsupplier, "Supplier", vendor["ShipAddr"], "Shipping")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._log_error(e)
|
self._log_error(e)
|
||||||
|
|
||||||
@ -829,7 +832,7 @@ class QuickBooksMigrator(Document):
|
|||||||
"currency": invoice["CurrencyRef"]["value"],
|
"currency": invoice["CurrencyRef"]["value"],
|
||||||
"conversion_rate": invoice.get("ExchangeRate", 1),
|
"conversion_rate": invoice.get("ExchangeRate", 1),
|
||||||
"posting_date": invoice["TxnDate"],
|
"posting_date": invoice["TxnDate"],
|
||||||
"due_date": invoice.get("DueDate", invoice["TxnDate"]),
|
"due_date": invoice.get("DueDate", invoice["TxnDate"]),
|
||||||
"credit_to": credit_to_account,
|
"credit_to": credit_to_account,
|
||||||
"supplier": frappe.get_all("Supplier",
|
"supplier": frappe.get_all("Supplier",
|
||||||
filters={
|
filters={
|
||||||
@ -1200,7 +1203,7 @@ class QuickBooksMigrator(Document):
|
|||||||
|
|
||||||
|
|
||||||
def _create_address(self, entity, doctype, address, address_type):
|
def _create_address(self, entity, doctype, address, address_type):
|
||||||
try :
|
try:
|
||||||
if not frappe.db.exists({"doctype": "Address", "quickbooks_id": address["Id"]}):
|
if not frappe.db.exists({"doctype": "Address", "quickbooks_id": address["Id"]}):
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
"doctype": "Address",
|
"doctype": "Address",
|
||||||
@ -1252,8 +1255,6 @@ class QuickBooksMigrator(Document):
|
|||||||
|
|
||||||
|
|
||||||
def _log_error(self, execption, data=""):
|
def _log_error(self, execption, data=""):
|
||||||
import json, traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
frappe.log_error(title="QuickBooks Migration Error",
|
frappe.log_error(title="QuickBooks Migration Error",
|
||||||
message="\n".join([
|
message="\n".join([
|
||||||
"Data",
|
"Data",
|
||||||
|
|||||||
@ -52,3 +52,13 @@ $.extend(frappe.breadcrumbs.preferred, {
|
|||||||
"Sales Partner": "Selling",
|
"Sales Partner": "Selling",
|
||||||
"Brand": "Selling"
|
"Brand": "Selling"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$.extend(frappe.breadcrumbs.module_map, {
|
||||||
|
'ERPNext Integrations': 'Integrations',
|
||||||
|
'Geo': 'Settings',
|
||||||
|
'Accounts': 'Accounting',
|
||||||
|
'Portal': 'Website',
|
||||||
|
'Utilities': 'Settings',
|
||||||
|
'Shopping Cart': 'Website',
|
||||||
|
'Contacts': 'CRM'
|
||||||
|
});
|
||||||
|
|||||||
@ -450,7 +450,7 @@ def make_stock_entry(source_name, target_doc=None):
|
|||||||
"field_map": {
|
"field_map": {
|
||||||
"name": "material_request_item",
|
"name": "material_request_item",
|
||||||
"parent": "material_request",
|
"parent": "material_request",
|
||||||
"uom": "stock_uom",
|
"uom": "stock_uom"
|
||||||
},
|
},
|
||||||
"postprocess": update_item,
|
"postprocess": update_item,
|
||||||
"condition": lambda doc: doc.ordered_qty < doc.stock_qty
|
"condition": lambda doc: doc.ordered_qty < doc.stock_qty
|
||||||
|
|||||||
@ -61,7 +61,8 @@
|
|||||||
"ste_detail",
|
"ste_detail",
|
||||||
"column_break_51",
|
"column_break_51",
|
||||||
"transferred_qty",
|
"transferred_qty",
|
||||||
"reference_purchase_receipt"
|
"reference_purchase_receipt",
|
||||||
|
"project"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@ -472,11 +473,18 @@
|
|||||||
"label": "Reference Purchase Receipt",
|
"label": "Reference Purchase Receipt",
|
||||||
"options": "Purchase Receipt",
|
"options": "Purchase Receipt",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "project",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Project",
|
||||||
|
"options": "Project",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2019-06-14 11:58:41.958144",
|
"modified": "2019-07-12 11:34:53.190749",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Entry Detail",
|
"name": "Stock Entry Detail",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user