frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.84k stars 7.33k forks source link

Woocommerce customer company to Erpnext #15275

Open Mata101 opened 6 years ago

Mata101 commented 6 years ago

I am planning to use the current woocoommerce to erpnext integration but there are things that I think it's a problem during my tests. In placing an order in woocommerce shop, the customer can put its company name and when erpnext receives the request through webhooks in woocommerce it fails with an error. Then I found out the cause of the error, the company that the customer inputted is expected to be already existing in erpnext side. And when the customer won't input any company, the process of the request will use the default company in erpnext. Do the devs expected the buyers to be single persons only without company, so they can use the default company? Haven't they considered that the customer might be a company? and that this company do not exist in erpnext? or do they expect only companies that were previously created in erpnext? I also tried to create the company in erpnext side first before I place an order, to assume that the customer will input a company that is already existing in erpnext. But it still gets an error because the accounting details that is already set in Woocommerce settings is from another company (I am talking about the accounts that is used in accounting details), which means these accounts belong to only one company, so if different companies are found for every request when an order is placed, it will still get an error because the accounts that are selected in the accounting details inside Woocommerce Settings is statically set from one company only. Why do they allow the users to input the accounting details inside woocommerce settings even though they are expecting different companies from different orders in woocommerce? Can someone please answer this questions to make this things clear? It will be a great help, thanks! This is the reference of the woocommerce to erpnext integration that I want to use: https://github.com/frappe/erpnext/pull/13217

makeen commented 5 years ago

Why try to save the customer's company as company of the order? I think it's a misunderstanding

company = raw_billing_data.get("company") or default_set_company.default_company
found_company = frappe.get_doc("Company",{"name":company})
company_abbr = found_company.abbr

new_sales_order.company = company
Not Found
The resource you are looking for is not available

the error occurs in this line found_company = frappe.get_doc("Company",{"name":company})

I think woocommerce integration need a company field in the settings or use only the default company: company = default_set_company.default_company