diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 749816f781..c0e128567f 100755 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -207,7 +207,7 @@ def get_customers_list(pos_profile={}): if pos_profile.get('customer_groups'): # Get customers based on the customer groups defined in the POS profile for d in pos_profile.get('customer_groups'): - customer_groups.extend([d.name for d in get_child_nodes('Customer Group', d.customer_group)]) + customer_groups.extend([d.get('name') for d in get_child_nodes('Customer Group', d.get('customer_group'))]) cond = "customer_group in (%s)" % (', '.join(['%s'] * len(customer_groups))) return frappe.db.sql(""" select name, customer_name, customer_group, @@ -387,7 +387,9 @@ def get_pricing_rule_data(doc): @frappe.whitelist() -def make_invoice(doc_list={}, email_queue_list={}, customers_list={}): +def make_invoice(pos_profile, doc_list={}, email_queue_list={}, customers_list={}): + import json + if isinstance(doc_list, string_types): doc_list = json.loads(doc_list) @@ -421,7 +423,8 @@ def make_invoice(doc_list={}, email_queue_list={}, customers_list={}): name_list.append(name) email_queue = make_email_queue(email_queue_list) - customers = get_customers_list() + pos_profile = json.loads(pos_profile) + customers = get_customers_list(pos_profile) return { 'invoice': name_list, 'email_queue': email_queue, diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 8dc00f3f21..24fcb41a5d 100755 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -1769,6 +1769,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice", freeze: true, args: { + pos_profile: me.pos_profile_data, doc_list: me.si_docs, email_queue_list: me.email_queue_list, customers_list: me.customers_list diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py index 4523f66deb..11f4e0d4e8 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py @@ -54,8 +54,8 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum 'description': d.description, 'invoice': d.parent, 'posting_date': d.posting_date, - 'customer': d.supplier, - 'customer_name': d.supplier_name + 'supplier': d.supplier, + 'supplier_name': d.supplier_name } if additional_query_columns: diff --git a/erpnext/public/js/utils/dimension_tree_filter.js b/erpnext/public/js/utils/dimension_tree_filter.js index 7abe4a7aab..8b6de0f517 100644 --- a/erpnext/public/js/utils/dimension_tree_filter.js +++ b/erpnext/public/js/utils/dimension_tree_filter.js @@ -35,11 +35,13 @@ erpnext.doctypes_with_dimensions.forEach((doctype) => { } } - if (frm.doc.items && frm.doc.items.length) { + if (frm.doc.items && frm.doc.items.length && frm.doc.docstatus === 0 + && (!frm.doc.items[0][dimension['fieldname']])) { frm.doc.items[0][dimension['fieldname']] = erpnext.default_dimensions[frm.doc.company][dimension['document_type']]; } - if (frm.doc.accounts && frm.doc.accounts.length) { + if (frm.doc.accounts && frm.doc.accounts.length && frm.doc.docstatus === 0 + && (!frm.doc.items[0][dimension['fieldname']])) { frm.doc.accounts[0][dimension['fieldname']] = erpnext.default_dimensions[frm.doc.company][dimension['document_type']]; } } diff --git a/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py b/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py index 3ce2547b20..b5948f9952 100644 --- a/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py +++ b/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py @@ -13,9 +13,9 @@ def execute(filters=None): dict(fieldtype='Data', label='GST Category', fieldname="gst_category", width=120), dict(fieldtype='Data', label='Export Type', fieldname="export_type", width=120), dict(fieldtype='Data', label='E-Commerce GSTIN', fieldname="ecommerce_gstin", width=130), - dict(fieldtype='Data', label='HSN Code', fieldname="hsn_code", width=120), - dict(fieldtype='Data', label='Supplier Invoice No', fieldname="supplier_invoice_no", width=120), - dict(fieldtype='Date', label='Supplier Invoice Date', fieldname="supplier_invoice_date", width=100) + dict(fieldtype='Data', label='HSN Code', fieldname="gst_hsn_code", width=120), + dict(fieldtype='Data', label='Supplier Invoice No', fieldname="bill_no", width=120), + dict(fieldtype='Date', label='Supplier Invoice Date', fieldname="bill_date", width=100) ], additional_query_columns=[ 'supplier_gstin', 'company_gstin', diff --git a/erpnext/regional/turkey/setup.py b/erpnext/regional/turkey/setup.py new file mode 100644 index 0000000000..ebf3b2bee1 --- /dev/null +++ b/erpnext/regional/turkey/setup.py @@ -0,0 +1,4 @@ +from __future__ import unicode_literals + +def setup(company=None, patch=True): + pass \ No newline at end of file diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 6aa2c04671..956deef928 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -424,8 +424,13 @@ def install_country_fixtures(company): company_doc = frappe.get_doc("Company", company) path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(company_doc.country)) if os.path.exists(path.encode("utf-8")): - frappe.get_attr("erpnext.regional.{0}.setup.setup" - .format(frappe.scrub(company_doc.country)))(company_doc, False) + try: + module_name = "erpnext.regional.{0}.setup.setup".format(frappe.scrub(company_doc.country)) + frappe.get_attr(module_name)(company_doc, False) + except Exception as e: + frappe.log_error(str(e), frappe.get_traceback()) + frappe.throw(_("Failed to setup defaults for country {0}. Please contact support@erpnext.com").format(frappe.bold(company_doc.country))) + def update_company_current_month_sales(company): current_month_year = formatdate(today(), "MM-yyyy") diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index ca2741ccfb..afa239466b 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -190,6 +190,9 @@ class StockReconciliation(StockController): has_serial_no = True self.get_sle_for_serialized_items(row, sl_entries) else: + if row.serial_no or row.batch_no: + frappe.throw(_("Row #{0}: Item {1} is not a Serialized/Batched Item. It cannot have a Serial No/Batch No against it.") \ + .format(row.idx, frappe.bold(row.item_code))) previous_sle = get_previous_sle({ "item_code": row.item_code, "warehouse": row.warehouse,