diff --git a/erpnext/accounts/doctype/pos_profile/__init__.py b/erpnext/accounts/doctype/pos_profile/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js similarity index 94% rename from erpnext/accounts/doctype/pos_setting/pos_setting.js rename to erpnext/accounts/doctype/pos_profile/pos_profile.js index db5fec128d..83643fe663 100755 --- a/erpnext/accounts/doctype/pos_setting/pos_setting.js +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js @@ -1,13 +1,13 @@ // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt -frappe.ui.form.on("POS Setting", "onload", function(frm) { +frappe.ui.form.on("POS Profile", "onload", function(frm) { frm.set_query("selling_price_list", function() { return { filter: { selling: 1 } }; }); frm.call({ - method: "erpnext.accounts.doctype.pos_setting.pos_setting.get_series", + method: "erpnext.accounts.doctype.pos_profile.pos_profile.get_series", callback: function(r) { if(!r.exc) { set_field_options("naming_series", r.message); diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json new file mode 100644 index 0000000000..ad224f1908 --- /dev/null +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json @@ -0,0 +1,263 @@ +{ + "allow_rename": 0, + "autoname": "hash", + "creation": "2013-05-24 12:15:51", + "docstatus": 0, + "doctype": "DocType", + "fields": [ + { + "fieldname": "user", + "fieldtype": "Link", + "in_list_view": 1, + "label": "User", + "oldfieldname": "user", + "oldfieldtype": "Link", + "options": "User", + "permlevel": 0, + "read_only": 0 + }, + { + "description": "", + "fieldname": "territory", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Territory", + "oldfieldname": "territory", + "oldfieldtype": "Link", + "options": "Territory", + "permlevel": 0, + "read_only": 0, + "reqd": 1 + }, + { + "fieldname": "naming_series", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "[Select]", + "permlevel": 0, + "read_only": 0, + "reqd": 1 + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "in_list_view": 0, + "label": "Currency", + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "permlevel": 0, + "read_only": 0, + "reqd": 1 + }, + { + "fieldname": "selling_price_list", + "fieldtype": "Link", + "label": "Price List", + "oldfieldname": "price_list_name", + "oldfieldtype": "Select", + "options": "Price List", + "permlevel": 0, + "read_only": 0, + "reqd": 0 + }, + { + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "read_only": 0, + "reqd": 1 + }, + { + "fieldname": "column_break0", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0 + }, + { + "default": "1", + "description": "Create Stock Ledger Entries when you submit a Sales Invoice", + "fieldname": "update_stock", + "fieldtype": "Check", + "label": "Update Stock", + "permlevel": 0, + "reqd": 0 + }, + { + "fieldname": "customer", + "fieldtype": "Link", + "in_list_view": 0, + "label": "Customer", + "oldfieldname": "customer_account", + "oldfieldtype": "Link", + "options": "Customer", + "permlevel": 0, + "read_only": 0, + "reqd": 0 + }, + { + "fieldname": "cash_bank_account", + "fieldtype": "Link", + "label": "Cash/Bank Account", + "oldfieldname": "cash_bank_account", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, + "read_only": 0, + "reqd": 1 + }, + { + "fieldname": "income_account", + "fieldtype": "Link", + "label": "Income Account", + "oldfieldname": "income_account", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, + "read_only": 0, + "reqd": 1 + }, + { + "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", + "fieldname": "expense_account", + "fieldtype": "Link", + "hidden": 0, + "label": "Expense Account", + "options": "Account", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 0 + }, + { + "fieldname": "warehouse", + "fieldtype": "Link", + "label": "Warehouse", + "oldfieldname": "warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "permlevel": 0, + "read_only": 0, + "reqd": 0 + }, + { + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "oldfieldname": "cost_center", + "oldfieldtype": "Link", + "options": "Cost Center", + "permlevel": 0, + "read_only": 0, + "reqd": 1 + }, + { + "fieldname": "taxes_and_charges", + "fieldtype": "Link", + "label": "Taxes and Charges", + "oldfieldname": "charge", + "oldfieldtype": "Link", + "options": "Sales Taxes and Charges Template", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "write_off_account", + "fieldtype": "Link", + "label": "Write Off Account", + "options": "Account", + "permlevel": 0, + "precision": "", + "reqd": 1 + }, + { + "fieldname": "write_off_cost_center", + "fieldtype": "Link", + "label": "Write Off Cost Center", + "options": "Cost Center", + "permlevel": 0, + "precision": "", + "reqd": 1 + }, + { + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "oldfieldname": "letter_head", + "oldfieldtype": "Select", + "options": "Letter Head", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms and Conditions", + "oldfieldname": "tc_name", + "oldfieldtype": "Link", + "options": "Terms and Conditions", + "permlevel": 0, + "read_only": 0 + }, + { + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "in_filter": 0, + "label": "Print Heading", + "oldfieldname": "select_print_heading", + "oldfieldtype": "Select", + "options": "Print Heading", + "permlevel": 0, + "read_only": 0 + } + ], + "icon": "icon-cog", + "idx": 1, + "modified": "2015-05-20 05:38:44.482696", + "modified_by": "Administrator", + "module": "Accounts", + "name": "POS Profile", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "share": 1, + "submit": 0, + "write": 1 + }, + { + "apply_user_permissions": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "submit": 0 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "user" +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py old mode 100755 new mode 100644 similarity index 88% rename from erpnext/accounts/doctype/pos_setting/pos_setting.py rename to erpnext/accounts/doctype/pos_profile/pos_profile.py index 0a80061ea6..eeb2bcfc30 --- a/erpnext/accounts/doctype/pos_setting/pos_setting.py +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py @@ -8,22 +8,22 @@ from frappe.utils import cint from frappe.model.document import Document -class POSSetting(Document): +class POSProfile(Document): def validate(self): self.check_for_duplicate() self.validate_expense_account() self.validate_all_link_fields() def check_for_duplicate(self): - res = frappe.db.sql("""select name, user from `tabPOS Setting` + res = frappe.db.sql("""select name, user from `tabPOS Profile` where ifnull(user, '') = %s and name != %s and company = %s""", (self.user, self.name, self.company)) if res: if res[0][1]: - msgprint(_("POS Setting {0} already created for user: {1} and company {2}").format(res[0][0], + msgprint(_("POS Profile {0} already created for user: {1} and company {2}").format(res[0][0], res[0][1], self.company), raise_exception=1) else: - msgprint(_("Global POS Setting {0} already created for company {1}").format(res[0][0], + msgprint(_("Global POS Profile {0} already created for company {1}").format(res[0][0], self.company), raise_exception=1) def validate_expense_account(self): @@ -57,7 +57,7 @@ class POSSetting(Document): condition = "" pos_view_users = frappe.db.sql_list("""select user - from `tabPOS Setting` {0}""".format(condition)) + from `tabPOS Profile` {0}""".format(condition)) for user in pos_view_users: if user: diff --git a/erpnext/accounts/doctype/pos_setting/test_pos_setting.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py similarity index 60% rename from erpnext/accounts/doctype/pos_setting/test_pos_setting.py rename to erpnext/accounts/doctype/pos_profile/test_pos_profile.py index 4f521f0233..62274a332f 100644 --- a/erpnext/accounts/doctype/pos_setting/test_pos_setting.py +++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # See license.txt from __future__ import unicode_literals @@ -5,7 +6,7 @@ from __future__ import unicode_literals import frappe import unittest -test_records = frappe.get_test_records('POS Setting') +# test_records = frappe.get_test_records('POS Profile') -class TestPOSSetting(unittest.TestCase): +class TestPOSProfile(unittest.TestCase): pass diff --git a/erpnext/accounts/doctype/pos_setting/README.md b/erpnext/accounts/doctype/pos_setting/README.md deleted file mode 100644 index 2ddef7893f..0000000000 --- a/erpnext/accounts/doctype/pos_setting/README.md +++ /dev/null @@ -1 +0,0 @@ -Standard settings for Point of Sales (POS) type of Sales Invoice. \ No newline at end of file diff --git a/erpnext/accounts/doctype/pos_setting/__init__.py b/erpnext/accounts/doctype/pos_setting/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/erpnext/accounts/doctype/pos_setting/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.json b/erpnext/accounts/doctype/pos_setting/pos_setting.json deleted file mode 100755 index b18a41156d..0000000000 --- a/erpnext/accounts/doctype/pos_setting/pos_setting.json +++ /dev/null @@ -1,263 +0,0 @@ -{ - "allow_rename": 0, - "autoname": "hash", - "creation": "2013-05-24 12:15:51", - "docstatus": 0, - "doctype": "DocType", - "fields": [ - { - "fieldname": "user", - "fieldtype": "Link", - "in_list_view": 1, - "label": "User", - "oldfieldname": "user", - "oldfieldtype": "Link", - "options": "User", - "permlevel": 0, - "read_only": 0 - }, - { - "description": "", - "fieldname": "territory", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Territory", - "oldfieldname": "territory", - "oldfieldtype": "Link", - "options": "Territory", - "permlevel": 0, - "read_only": 0, - "reqd": 1 - }, - { - "fieldname": "naming_series", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "[Select]", - "permlevel": 0, - "read_only": 0, - "reqd": 1 - }, - { - "fieldname": "currency", - "fieldtype": "Link", - "in_list_view": 0, - "label": "Currency", - "oldfieldname": "currency", - "oldfieldtype": "Select", - "options": "Currency", - "permlevel": 0, - "read_only": 0, - "reqd": 1 - }, - { - "fieldname": "selling_price_list", - "fieldtype": "Link", - "label": "Price List", - "oldfieldname": "price_list_name", - "oldfieldtype": "Select", - "options": "Price List", - "permlevel": 0, - "read_only": 0, - "reqd": 0 - }, - { - "fieldname": "company", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "read_only": 0, - "reqd": 1 - }, - { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0 - }, - { - "default": "1", - "description": "Create Stock Ledger Entries when you submit a Sales Invoice", - "fieldname": "update_stock", - "fieldtype": "Check", - "label": "Update Stock", - "permlevel": 0, - "reqd": 0 - }, - { - "fieldname": "customer", - "fieldtype": "Link", - "in_list_view": 0, - "label": "Customer", - "oldfieldname": "customer_account", - "oldfieldtype": "Link", - "options": "Customer", - "permlevel": 0, - "read_only": 0, - "reqd": 0 - }, - { - "fieldname": "cash_bank_account", - "fieldtype": "Link", - "label": "Cash/Bank Account", - "oldfieldname": "cash_bank_account", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, - "read_only": 0, - "reqd": 1 - }, - { - "fieldname": "income_account", - "fieldtype": "Link", - "label": "Income Account", - "oldfieldname": "income_account", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, - "read_only": 0, - "reqd": 1 - }, - { - "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", - "fieldname": "expense_account", - "fieldtype": "Link", - "hidden": 0, - "label": "Expense Account", - "options": "Account", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 0 - }, - { - "fieldname": "warehouse", - "fieldtype": "Link", - "label": "Warehouse", - "oldfieldname": "warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "permlevel": 0, - "read_only": 0, - "reqd": 0 - }, - { - "fieldname": "cost_center", - "fieldtype": "Link", - "label": "Cost Center", - "oldfieldname": "cost_center", - "oldfieldtype": "Link", - "options": "Cost Center", - "permlevel": 0, - "read_only": 0, - "reqd": 1 - }, - { - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "label": "Taxes and Charges", - "oldfieldname": "charge", - "oldfieldtype": "Link", - "options": "Sales Taxes and Charges Template", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "write_off_account", - "fieldtype": "Link", - "label": "Write Off Account", - "options": "Account", - "permlevel": 0, - "precision": "", - "reqd": 1 - }, - { - "fieldname": "write_off_cost_center", - "fieldtype": "Link", - "label": "Write Off Cost Center", - "options": "Cost Center", - "permlevel": 0, - "precision": "", - "reqd": 1 - }, - { - "allow_on_submit": 1, - "fieldname": "letter_head", - "fieldtype": "Link", - "label": "Letter Head", - "oldfieldname": "letter_head", - "oldfieldtype": "Select", - "options": "Letter Head", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms and Conditions", - "oldfieldname": "tc_name", - "oldfieldtype": "Link", - "options": "Terms and Conditions", - "permlevel": 0, - "read_only": 0 - }, - { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "in_filter": 0, - "label": "Print Heading", - "oldfieldname": "select_print_heading", - "oldfieldtype": "Select", - "options": "Print Heading", - "permlevel": 0, - "read_only": 0 - } - ], - "icon": "icon-cog", - "idx": 1, - "modified": "2015-02-05 05:11:42.344181", - "modified_by": "Administrator", - "module": "Accounts", - "name": "POS Setting", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "share": 1, - "submit": 0, - "write": 1 - }, - { - "apply_user_permissions": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "submit": 0 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "title_field": "user" -} diff --git a/erpnext/accounts/doctype/pos_setting/test_records.json b/erpnext/accounts/doctype/pos_setting/test_records.json deleted file mode 100644 index fe51488c70..0000000000 --- a/erpnext/accounts/doctype/pos_setting/test_records.json +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 7c366c1fd2..e5af1763b1 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -160,12 +160,12 @@ class SalesInvoice(SellingController): frappe.throw(_("Time Log Batch {0} must be 'Submitted'").format(d.time_log_batch)) def set_pos_fields(self, for_validate=False): - """Set retail related fields from pos settings""" + """Set retail related fields from POS Profiles""" if cint(self.is_pos) != 1: return - from erpnext.stock.get_item_details import get_pos_settings_item_details, get_pos_settings - pos = get_pos_settings(self.company) + from erpnext.stock.get_item_details import get_pos_profiles_item_details, get_pos_profiles + pos = get_pos_profiles(self.company) if pos: if not for_validate and not self.customer: @@ -184,7 +184,7 @@ class SalesInvoice(SellingController): # set pos values in items for item in self.get("items"): if item.get('item_code'): - for fname, val in get_pos_settings_item_details(pos, + for fname, val in get_pos_profiles_item_details(pos, frappe._dict(item.as_dict()), pos).items(): if (not for_validate) or (for_validate and not item.get(fname)): @@ -371,24 +371,24 @@ class SalesInvoice(SellingController): def get_warehouse(self): - user_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting` + user_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile` where ifnull(user,'') = %s and company = %s""", (frappe.session['user'], self.company)) - warehouse = user_pos_setting[0][1] if user_pos_setting else None + warehouse = user_pos_profile[0][1] if user_pos_profile else None if not warehouse: - global_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting` + global_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile` where ifnull(user,'') = '' and company = %s""", self.company) - if global_pos_setting: - warehouse = global_pos_setting[0][1] - elif not user_pos_setting: - msgprint(_("POS Setting required to make POS Entry"), raise_exception=True) + if global_pos_profile: + warehouse = global_pos_profile[0][1] + elif not user_pos_profile: + msgprint(_("POS Profile required to make POS Entry"), raise_exception=True) return warehouse def on_update(self): if cint(self.update_stock) == 1: - # Set default warehouse from pos setting + # Set default warehouse from POS Profile if cint(self.is_pos) == 1: w = self.get_warehouse() if w: diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 9db2b3682b..63977b782b 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -462,7 +462,7 @@ class TestSalesInvoice(unittest.TestCase): def test_pos_gl_entry_with_aii(self): set_perpetual_inventory() - self.make_pos_setting() + self.make_pos_profile() self._insert_purchase_receipt() @@ -517,19 +517,19 @@ class TestSalesInvoice(unittest.TestCase): set_perpetual_inventory(0) - frappe.db.sql("delete from `tabPOS Setting`") + frappe.db.sql("delete from `tabPOS Profile`") - def make_pos_setting(self): - pos_setting = frappe.get_doc({ + def make_pos_profile(self): + pos_profile = frappe.get_doc({ "cash_bank_account": "_Test Account Bank Account - _TC", "company": "_Test Company", "cost_center": "_Test Cost Center - _TC", "currency": "INR", - "doctype": "POS Setting", + "doctype": "POS Profile", "expense_account": "_Test Account Cost for Goods Sold - _TC", "income_account": "Sales - _TC", - "name": "_Test POS Setting", - "naming_series": "_T-POS Setting-", + "name": "_Test POS Profile", + "naming_series": "_T-POS Profile-", "selling_price_list": "_Test Price List", "territory": "_Test Territory", "warehouse": "_Test Warehouse - _TC", @@ -537,8 +537,8 @@ class TestSalesInvoice(unittest.TestCase): "write_off_cost_center": "_Test Write Off Cost Center - _TC" }) - if not frappe.db.exists("POS Setting", "_Test POS Setting"): - pos_setting.insert() + if not frappe.db.exists("POS Profile", "_Test POS Profile"): + pos_profile.insert() def test_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self): set_perpetual_inventory() diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 1bc5681231..df7757b842 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -35,7 +35,7 @@ frappe.pages['pos'].on_page_load = function(wrapper) { }); $.ajax({ - url: "/api/resource/POS Setting", + url: "/api/resource/POS Profile", success: function(data) { if(!data.data.length) { page.main.find(".pos-setting-message").removeClass('hide'); diff --git a/erpnext/change_log/current/rename_pos_setting.md b/erpnext/change_log/current/rename_pos_setting.md new file mode 100644 index 0000000000..2705a175d1 --- /dev/null +++ b/erpnext/change_log/current/rename_pos_setting.md @@ -0,0 +1 @@ +- POS Setting is renamed to POS Profile diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py index 6b02c1b64e..1b29002257 100644 --- a/erpnext/config/accounts.py +++ b/erpnext/config/accounts.py @@ -113,7 +113,7 @@ def get_data(): }, { "type": "doctype", - "name": "POS Setting", + "name": "POS Profile", "label": _("Point-of-Sale Setting"), "description": _("Rules to calculate shipping amount for a sale") }, diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 185a91560b..2990ab0f1a 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -155,3 +155,4 @@ erpnext.patches.v5_0.reclculate_planned_operating_cost_in_production_order erpnext.patches.v5_0.repost_requested_qty erpnext.patches.v5_0.fix_taxes_and_totals_in_party_currency erpnext.patches.v5_0.update_tax_amount_after_discount_in_purchase_cycle +erpnext.patches.v5_0.rename_pos_setting diff --git a/erpnext/patches/v5_0/rename_pos_setting.py b/erpnext/patches/v5_0/rename_pos_setting.py new file mode 100644 index 0000000000..ad579b61ff --- /dev/null +++ b/erpnext/patches/v5_0/rename_pos_setting.py @@ -0,0 +1,5 @@ +import frappe + +def execute(): + if frappe.db.table_exists("POS Setting"): + frappe.rename_doc("DocType", "POS Setting", "POS Profile") diff --git a/erpnext/public/js/feature_setup.js b/erpnext/public/js/feature_setup.js index 85f8e054c1..5ab04ddfa2 100644 --- a/erpnext/public/js/feature_setup.js +++ b/erpnext/public/js/feature_setup.js @@ -117,7 +117,7 @@ erpnext.feature_setup.feature_dict = { 'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'], 'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount'] }, - 'POS Setting': {'fields':['conversion_rate','currency']}, + 'POS Profile': {'fields':['conversion_rate','currency']}, 'Quotation': { 'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total', 'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'], diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 3c820fa583..3f73932c5f 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -51,7 +51,7 @@ def get_item_details(args): get_price_list_rate(args, item_doc, out) if args.transaction_type == "selling" and cint(args.is_pos): - out.update(get_pos_settings_item_details(args.company, args)) + out.update(get_pos_profiles_item_details(args.company, args)) # update args with out, if key or value not exists for key, value in out.iteritems(): @@ -267,16 +267,16 @@ def get_party_item_code(args, item_doc, out): item_supplier = item_doc.get("supplier_items", {"supplier": args.supplier}) out.supplier_part_no = item_supplier[0].supplier_part_no if item_supplier else None -def get_pos_settings_item_details(company, args, pos_settings=None): +def get_pos_profiles_item_details(company, args, pos_profiles=None): res = frappe._dict() - if not pos_settings: - pos_settings = get_pos_settings(company) + if not pos_profiles: + pos_profiles = get_pos_profiles(company) - if pos_settings: + if pos_profiles: for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"): - if not args.get(fieldname) and pos_settings.get(fieldname): - res[fieldname] = pos_settings.get(fieldname) + if not args.get(fieldname) and pos_profiles.get(fieldname): + res[fieldname] = pos_profiles.get(fieldname) if res.get("warehouse"): res.actual_qty = get_available_qty(args.item_code, @@ -284,15 +284,15 @@ def get_pos_settings_item_details(company, args, pos_settings=None): return res -def get_pos_settings(company): - pos_settings = frappe.db.sql("""select * from `tabPOS Setting` where user = %s +def get_pos_profiles(company): + pos_profiles = frappe.db.sql("""select * from `tabPOS Profile` where user = %s and company = %s""", (frappe.session['user'], company), as_dict=1) - if not pos_settings: - pos_settings = frappe.db.sql("""select * from `tabPOS Setting` + if not pos_profiles: + pos_profiles = frappe.db.sql("""select * from `tabPOS Profile` where ifnull(user,'') = '' and company = %s""", company, as_dict=1) - return pos_settings and pos_settings[0] or None + return pos_profiles and pos_profiles[0] or None def get_serial_nos_by_fifo(args, item_doc):