diff --git a/.travis.yml b/.travis.yml index f6c4eeecd91..cb3dd5e4b2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ install: - wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh - sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis - sudo pip install --upgrade pip - - sudo service redis-server start - rm $TRAVIS_BUILD_DIR/.git/shallow - cd ~/ && bench init frappe-bench --frappe-path https://github.com/frappe/frappe.git --frappe-branch develop - cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/ @@ -24,9 +23,13 @@ script: - cd ~/frappe-bench - bench get-app erpnext $TRAVIS_BUILD_DIR - bench use test_site + - bench setup redis-cache + - bench setup redis-async-broker + - bench setup procfile --with-celery-broker - bench reinstall + - bench build - bench build-website - - bench serve & + - bench start & - sleep 10 - bench --verbose run-tests --driver Firefox diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 99604dc06c1..90d02c924b2 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '5.6.4' +__version__ = '5.7.0' diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js index 83643fe6638..da49036973f 100755 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.js +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js @@ -6,6 +6,14 @@ frappe.ui.form.on("POS Profile", "onload", function(frm) { return { filter: { selling: 1 } }; }); + frm.set_query("print_format", function() { + return { filter: { doc_type: "Sales Invoice" } }; + }); + + erpnext.queries.setup_queries(frm, "Warehouse", function() { + return erpnext.queries.warehouse(frm.doc); + }); + frm.call({ method: "erpnext.accounts.doctype.pos_profile.pos_profile.get_series", callback: function(r) { diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json index 9e795901165..084c102345c 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.json +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json @@ -1,37 +1,42 @@ { + "allow_copy": 0, + "allow_import": 0, "allow_rename": 0, "autoname": "hash", "creation": "2013-05-24 12:15:51", + "custom": 0, "docstatus": 0, "doctype": "DocType", "fields": [ { + "allow_on_submit": 0, "fieldname": "user", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, - "label": "User", + "label": "Applicable for User", + "no_copy": 0, "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, + "print_hide": 0, "read_only": 0, - "reqd": 0 + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "naming_series", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Series", "no_copy": 1, @@ -39,232 +44,581 @@ "oldfieldtype": "Select", "options": "[Select]", "permlevel": 0, + "print_hide": 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 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "warehouse", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Warehouse", + "no_copy": 0, "oldfieldname": "warehouse", "oldfieldtype": "Link", "options": "Warehouse", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 0 + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "default": "1", + "description": "", + "fieldname": "update_stock", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Update Stock", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Customer", + "no_copy": 0, + "oldfieldname": "customer_account", + "oldfieldtype": "Link", + "options": "Customer", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Company", + "no_copy": 0, + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Currency", + "no_copy": 0, + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "mode_of_payment", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Mode of Payment", + "no_copy": 0, + "options": "Mode of Payment", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "section_break_16", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "print_format", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Print Format", + "no_copy": 0, + "options": "Print Format", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { "allow_on_submit": 1, "fieldname": "letter_head", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Letter Head", + "no_copy": 0, "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 + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { "allow_on_submit": 1, "fieldname": "select_print_heading", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 0, + "in_list_view": 0, "label": "Print Heading", + "no_copy": 0, "oldfieldname": "select_print_heading", "oldfieldtype": "Select", "options": "Print Heading", "permlevel": 0, - "read_only": 0 - }, - { - "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, + "print_hide": 0, "read_only": 0, - "reqd": 0 + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { - "fieldname": "mode_of_payment", - "fieldtype": "Link", - "label": "Mode of Payment", - "options": "Mode of Payment", - "permlevel": 0, - "precision": "" - }, - { - "fieldname": "cash_bank_account", - "fieldtype": "Link", - "label": "Cash/Bank Account", - "oldfieldname": "cash_bank_account", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, - "read_only": 0, - "reqd": 0 - }, - { - "fieldname": "income_account", - "fieldtype": "Link", - "label": "Income Account", - "oldfieldname": "income_account", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, - "read_only": 0, - "reqd": 0 - }, - { - "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", - "fieldname": "expense_account", + "allow_on_submit": 0, + "fieldname": "tc_name", "fieldtype": "Link", "hidden": 0, - "label": "Expense Account", - "options": "Account", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 0 - }, - { - "fieldname": "cost_center", - "fieldtype": "Link", - "label": "Cost Center", - "oldfieldname": "cost_center", + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Terms and Conditions", + "no_copy": 0, + "oldfieldname": "tc_name", "oldfieldtype": "Link", - "options": "Cost Center", + "options": "Terms and Conditions", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 0 + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "description": "", + "fieldname": "territory", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Territory", + "no_copy": 0, + "oldfieldname": "territory", + "oldfieldtype": "Link", + "options": "Territory", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "selling_price_list", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Price List", + "no_copy": 0, + "oldfieldname": "price_list_name", + "oldfieldtype": "Select", + "options": "Price List", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "section_break_19", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, "fieldname": "write_off_account", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Write Off Account", + "no_copy": 0, "options": "Account", "permlevel": 0, "precision": "", - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "write_off_cost_center", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Write Off Cost Center", + "no_copy": 0, "options": "Cost Center", "permlevel": 0, "precision": "", - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "taxes_and_charges", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Taxes and Charges", + "no_copy": 0, "oldfieldname": "charge", "oldfieldtype": "Link", "options": "Sales Taxes and Charges Template", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "column_break_23", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "cash_bank_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Cash/Bank Account", + "no_copy": 0, + "oldfieldname": "cash_bank_account", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "income_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Income Account", + "no_copy": 0, + "oldfieldname": "income_account", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", + "fieldname": "expense_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Expense Account", + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "cost_center", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Cost Center", + "no_copy": 0, + "oldfieldname": "cost_center", + "oldfieldtype": "Link", + "options": "Cost Center", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], + "hide_heading": 0, + "hide_toolbar": 0, "icon": "icon-cog", "idx": 1, - "modified": "2015-07-28 15:07:14.417200", + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "modified": "2015-08-18 17:49:09.098876", "modified_by": "Administrator", "module": "Accounts", "name": "POS Profile", "owner": "Administrator", "permissions": [ { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, "create": 1, "delete": 1, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Accounts Manager", + "set_user_permissions": 0, "share": 1, "submit": 0, "write": 1 }, { + "amend": 0, "apply_user_permissions": 1, + "cancel": 0, + "create": 0, "delete": 0, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Accounts User", - "submit": 0 + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 } ], + "read_only": 0, + "read_only_onload": 0, "sort_field": "modified", "sort_order": "DESC", "title_field": "user" diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index d12b2d7ca91..0b74948d0e1 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -232,45 +232,24 @@ class TestPurchaseInvoice(unittest.TestCase): test_recurring_document(self, test_records) def test_total_purchase_cost_for_project(self): - purchase_invoice = frappe.new_doc('Purchase Invoice') - purchase_invoice.update({ - "credit_to": "_Test Payable - _TC", - "supplier": "_Test Supplier", - "company": "_Test Company", - "items": [ - { - "rate": 500, - "qty": 1, - "project_name": "_Test Project", - "item_code": "_Test Item Home Desktop 100", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "cost_center": "_Test Cost Center - _TC" - }, - { - "rate": 1500, - "qty": 1, - "project_name": "_Test Project", - "item_code": "_Test Item Home Desktop 200", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "cost_center": "_Test Cost Center - _TC" - } - ] - }) - purchase_invoice.save() - purchase_invoice.submit() - self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 2000) + existing_purchase_cost = frappe.db.sql("""select sum(ifnull(base_net_amount, 0)) + from `tabPurchase Invoice Item` where project_name = '_Test Project' and docstatus=1""") + existing_purchase_cost = existing_purchase_cost and existing_purchase_cost[0][0] or 0 + + pi = make_purchase_invoice(currency="USD", conversion_rate=60, project_name="_Test Project") + self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), + existing_purchase_cost + 15000) - purchase_invoice1 = frappe.copy_doc(purchase_invoice) - purchase_invoice1.save() - purchase_invoice1.submit() + pi1 = make_purchase_invoice(qty=10, project_name="_Test Project") + self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), + existing_purchase_cost + 15500) - self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 4000) + pi1.cancel() + self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), + existing_purchase_cost + 15000) - purchase_invoice1.cancel() - self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 2000) - - purchase_invoice.cancel() - self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 0) + pi.cancel() + self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), existing_purchase_cost) def test_return_purchase_invoice(self): set_perpetual_inventory() @@ -308,6 +287,7 @@ def make_purchase_invoice(**args): pi.company = args.company or "_Test Company" pi.supplier = args.supplier or "_Test Supplier" pi.currency = args.currency or "INR" + pi.conversion_rate = args.conversion_rate or 1 pi.is_return = args.is_return pi.return_against = args.return_against @@ -318,7 +298,9 @@ def make_purchase_invoice(**args): "rate": args.rate or 50, "conversion_factor": 1.0, "serial_no": args.serial_no, - "stock_uom": "_Test UOM" + "stock_uom": "_Test UOM", + "cost_center": "_Test Cost Center - _TC", + "project_name": args.project_name }) if not args.do_not_save: pi.insert() diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index caf741e578d..734684f69d9 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -28,12 +28,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } } - // if document is POS then change default print format to "POS Invoice" if no default is specified - if(cur_frm.doc.is_pos && cur_frm.doc.docstatus===1 && cint(frappe.defaults.get_user_defaults("fs_pos_view"))===1 - && !locals.DocType[cur_frm.doctype].default_print_format) { - locals.DocType[cur_frm.doctype].default_print_format = "POS Invoice"; - cur_frm.setup_print_layout(); - } + erpnext.queries.setup_queries(this.frm, "Warehouse", function() { + return erpnext.queries.warehouse(me.frm.doc); + }); }, refresh: function(doc, dt, dn) { @@ -74,6 +71,23 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte cur_frm.cscript.sales_order_btn(); cur_frm.cscript.delivery_note_btn(); } + + this.set_default_print_format(); + }, + + set_default_print_format: function() { + // set default print format to POS type + if(cur_frm.doc.is_pos) { + if(cur_frm.pos_print_format) { + cur_frm.meta._default_print_format = cur_frm.meta.default_print_format; + cur_frm.meta.default_print_format = cur_frm.pos_print_format; + } + } else { + if(cur_frm.meta._default_print_format) { + cur_frm.meta.default_print_format = cur_frm.meta._default_print_format; + cur_frm.meta._default_print_format = null; + } + } }, sales_order_btn: function() { @@ -118,6 +132,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }, is_pos: function(doc, dt, dn, callback_fn) { + if(cur_frm.doc.__missing_values_set) return; cur_frm.cscript.hide_fields(this.frm.doc); if(cint(this.frm.doc.is_pos)) { if(!this.frm.doc.company) { @@ -130,6 +145,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte method: "set_missing_values", callback: function(r) { if(!r.exc) { + cur_frm.pos_print_format = r.message.print_format; + cur_frm.doc.__missing_values_set = true; me.frm.script_manager.trigger("update_stock"); frappe.model.set_default_values(me.frm.doc); me.set_dynamic_labels(); @@ -376,10 +393,13 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { if(row.delivery_note) frappe.model.clear_doc("Delivery Note", row.delivery_note) }) - if(cint(frappe.boot.notification_settings.sales_invoice)) { + if(cur_frm.doc.is_pos) { + frappe.msgprint('Print\ + New'); + + } else if(cint(frappe.boot.notification_settings.sales_invoice)) { cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message); - } else if(cur_frm.doc.is_pos) { - new_doc("Sales Invoice"); } } diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 4285eb8b14b..f82590a6094 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -139,7 +139,7 @@ class SalesInvoice(SellingController): }) def set_missing_values(self, for_validate=False): - self.set_pos_fields(for_validate) + pos = self.set_pos_fields(for_validate) if not self.debit_to: self.debit_to = get_party_account(self.company, self.customer, "Customer") @@ -148,6 +148,9 @@ class SalesInvoice(SellingController): super(SalesInvoice, self).set_missing_values(for_validate) + if pos: + return {"print_format": pos.get("print_format") } + def update_time_log_batch(self, sales_invoice): for d in self.get("items"): if d.time_log_batch: @@ -168,8 +171,8 @@ class SalesInvoice(SellingController): if cint(self.is_pos) != 1: return - from erpnext.stock.get_item_details import get_pos_profiles_item_details, get_pos_profiles - pos = get_pos_profiles(self.company) + from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile + pos = get_pos_profile(self.company) if pos: if not for_validate and not self.customer: @@ -189,7 +192,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_profiles_item_details(pos, + for fname, val in get_pos_profile_item_details(pos, frappe._dict(item.as_dict()), pos).items(): if (not for_validate) or (for_validate and not item.get(fname)): @@ -203,6 +206,8 @@ class SalesInvoice(SellingController): if self.taxes_and_charges and not len(self.get("taxes")): self.set_taxes() + return pos + def get_advances(self): if not self.is_return: super(SalesInvoice, self).get_advances(self.debit_to, "Customer", self.customer, diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 6756e47d0e5..9887ddb4168 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -248,6 +248,8 @@ def stop_or_unstop_purchase_orders(names, status): if po.status == "Stopped": po.update_status("Submitted") + po.notify_modified() + frappe.local.message_log = [] diff --git a/erpnext/change_log/v5/v5_1_0.md b/erpnext/change_log/v5/v5_1_0.md index 3ed2227f826..bf869a0a684 100644 --- a/erpnext/change_log/v5/v5_1_0.md +++ b/erpnext/change_log/v5/v5_1_0.md @@ -1,4 +1,3 @@ -- Item variants is now manageable via dedicated tool **Manage Variants**. To learn about it, check [Manual Page for Item variants](https://manual.erpnext.com/contents/stock/item/item-variants) - Against account in General Ledger will show Party instead of Account (which is not useful) - Print format for recurring documents can be set by the users - Recurring documents won't be created for Stopped Sales / Purchase Orders. diff --git a/erpnext/change_log/v5/v5_1_3.md b/erpnext/change_log/v5/v5_1_3.md index 9825a10ffb3..d6fbb7bb3a5 100644 --- a/erpnext/change_log/v5/v5_1_3.md +++ b/erpnext/change_log/v5/v5_1_3.md @@ -1,3 +1,2 @@ - Hide zero balance rows in batch-wise balance history report -- Autocomplete issue fixed in Manage Variants - Remove user permission (Employee role) if user id is unset from Employee record \ No newline at end of file diff --git a/erpnext/change_log/v5/v5_7_0.md b/erpnext/change_log/v5/v5_7_0.md new file mode 100644 index 00000000000..c76eb601e50 --- /dev/null +++ b/erpnext/change_log/v5/v5_7_0.md @@ -0,0 +1,7 @@ +- **Item Variants** + - Removed **Manage Variants** tool + - Use **Make Variant** button in the Item form to create new variants based on a template Item + - Added ability to specify Range of Numeric Values in Item Attribute +- Set default Print Format for Point-of-Sale (POS) via **POS Profile** +- Option to automatically print after submitting POS **Sales Invoice** +- **Communication** added to CRM module diff --git a/erpnext/config/crm.py b/erpnext/config/crm.py index d7a6b2e2be3..7b015c75f26 100644 --- a/erpnext/config/crm.py +++ b/erpnext/config/crm.py @@ -31,6 +31,11 @@ def get_data(): "name": "Newsletter", "description": _("Newsletters to contacts, leads."), }, + { + "type": "doctype", + "name": "Communication", + "description": _("Record of all communications of type email, phone, chat, visit, etc."), + }, ] }, { diff --git a/erpnext/config/learn.py b/erpnext/config/learn.py index 0b5f2d59a2f..e0f1c06ddd0 100644 --- a/erpnext/config/learn.py +++ b/erpnext/config/learn.py @@ -87,6 +87,11 @@ def get_data(): "label": _("Lead to Quotation"), "youtube_id": "TxYX4r4JAKA" }, + { + "type": "help", + "label": _("Newsletters"), + "youtube_id": "muLKsCrrDRo" + }, ] }, { @@ -122,6 +127,26 @@ def get_data(): "label": _("Opening Stock Balance"), "youtube_id": "0yPgrtfeCTs" }, + { + "type": "help", + "label": _("Making Stock Entries"), + "youtube_id": "Njt107hlY3I" + }, + { + "type": "help", + "label": _("Serialized Inventory"), + "youtube_id": "gvOVlEwFDAk" + }, + { + "type": "help", + "label": _("Batch Inventory"), + "youtube_id": "J0QKl7ABPKM" + }, + { + "type": "help", + "label": _("Managing Subcontracting"), + "youtube_id": "ThiMCC2DtKo" + }, ] }, { @@ -137,7 +162,16 @@ def get_data(): "label": _("Material Request to Purchase Order"), "youtube_id": "4TN9kPyfIqM" }, - + { + "type": "help", + "label": _("Purchase Order to Payment"), + "youtube_id": "EK65tLdVUDk" + }, + { + "type": "help", + "label": _("Managing Subcontracting"), + "youtube_id": "ThiMCC2DtKo" + }, ] }, { @@ -179,6 +213,11 @@ def get_data(): "label": _("Expense Claims"), "youtube_id": "5SZHJF--ZFY" }, + { + "type": "help", + "label": _("Processing Payroll"), + "youtube_id": "apgE-f25Rm0" + }, ] }, { diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index f4ec6f087c1..f5ecba0458a 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -82,12 +82,7 @@ def get_data(): "type": "doctype", "name": "Stock UOM Replace Utility", "description": _("Change UOM for an Item."), - }, - { - "type": "doctype", - "name": "Manage Variants", - "description": _("Manage Item Variants."), - }, + } ] }, { diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index a1468e13b67..9e2bf1d76be 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -188,7 +188,7 @@ class SellingController(StockController): reserved_qty_for_main_item = -(so_qty - already_delivered_qty) else: reserved_qty_for_main_item = -flt(d.qty) - + if self.has_product_bundle(d.item_code): for p in self.get("packed_items"): if p.parent_detail_docname == d.name and p.parent_item == d.item_code: @@ -229,10 +229,12 @@ class SellingController(StockController): and against_sales_order = %s and parent != %s""", (so_detail, so, current_docname)) - delivered_via_si = frappe.db.sql("""select sum(qty) from `tabSales Invoice Item` - where so_detail = %s and docstatus = 1 - and sales_order = %s - and parent != %s""", (so_detail, so, current_docname)) + delivered_via_si = frappe.db.sql("""select sum(si_item.qty) + from `tabSales Invoice Item` si_item, `tabSales Invoice` si + where si_item.parent = si.name and ifnull(si.update_stock, 0) = 1 + and si_item.so_detail = %s and si.docstatus = 1 + and si_item.sales_order = %s + and si.name != %s""", (so_detail, so, current_docname)) total_delivered_qty = (flt(delivered_via_dn[0][0]) if delivered_via_dn else 0) \ + (flt(delivered_via_si[0][0]) if delivered_via_si else 0) diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json index df0438722a7..7bf69f3e585 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.json +++ b/erpnext/crm/doctype/opportunity/opportunity.json @@ -1,36 +1,67 @@ { + "allow_copy": 0, "allow_import": 1, + "allow_rename": 0, "autoname": "naming_series:", "creation": "2013-03-07 18:50:30", + "custom": 0, "description": "Potential Sales Deal", "docstatus": 0, "doctype": "DocType", - "document_type": "Transaction", + "document_type": "Document", "fields": [ { + "allow_on_submit": 0, "fieldname": "from_section", "fieldtype": "Section Break", - "label": "From", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "", + "no_copy": 0, "options": "icon-user", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "naming_series", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Series", "no_copy": 1, "oldfieldname": "naming_series", "oldfieldtype": "Select", "options": "OPTY-", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "enquiry_from", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Opportunity From", + "no_copy": 0, "oldfieldname": "enquiry_from", "oldfieldtype": "Select", "options": "\nLead\nCustomer", @@ -38,13 +69,18 @@ "print_hide": 1, "read_only": 0, "report_hide": 0, - "reqd": 1 + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.enquiry_from===\"Customer\"", "fieldname": "customer", "fieldtype": "Link", "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 0, "label": "Customer", @@ -55,65 +91,126 @@ "permlevel": 0, "print_hide": 1, "read_only": 0, + "report_hide": 0, "reqd": 0, - "search_index": 0 + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.enquiry_from===\"Lead\"", "fieldname": "lead", "fieldtype": "Link", "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 0, "label": "Lead", + "no_copy": 0, "oldfieldname": "lead", "oldfieldtype": "Link", "options": "Lead", "permlevel": 0, "print_hide": 1, - "read_only": 0 + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "", "fieldname": "customer_name", "fieldtype": "Data", "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Customer / Lead Name", + "no_copy": 0, "permlevel": 0, "print_hide": 0, - "read_only": 1 + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break0", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "oldfieldtype": "Column Break", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" }, { + "allow_on_submit": 0, "fieldname": "title", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Title", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "Sales", "fieldname": "enquiry_type", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Opportunity Type", + "no_copy": 0, "oldfieldname": "enquiry_type", "oldfieldtype": "Select", "options": "Sales\nMaintenance", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "Open", "fieldname": "status", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Status", "no_copy": 1, @@ -123,276 +220,571 @@ "permlevel": 0, "print_hide": 1, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "with_items", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "With Items", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "with_items", "fieldname": "items_section", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-shopping-cart", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "", "fieldname": "items", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Items", + "no_copy": 0, "oldfieldname": "enquiry_details", "oldfieldtype": "Table", "options": "Opportunity Item", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "fold", "fieldtype": "Fold", - "permlevel": 0 + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.lead || doc.customer", "fieldname": "contact_info", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Contact Info", + "no_copy": 0, "options": "icon-bullhorn", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.customer || doc.lead", "fieldname": "customer_address", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Customer / Lead Address", + "no_copy": 0, "options": "Address", "permlevel": 0, "print_hide": 1, - "read_only": 0 + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "address_display", "fieldtype": "Small Text", "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Address", + "no_copy": 0, "oldfieldname": "address", "oldfieldtype": "Small Text", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "customer", "description": "", "fieldname": "territory", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 1, "label": "Territory", + "no_copy": 0, "options": "Territory", "permlevel": 0, "print_hide": 1, "read_only": 0, + "report_hide": 0, "reqd": 0, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "customer", "description": "", "fieldname": "customer_group", "fieldtype": "Link", "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Customer Group", + "no_copy": 0, "oldfieldname": "customer_group", "oldfieldtype": "Link", "options": "Customer Group", "permlevel": 0, "print_hide": 1, "read_only": 0, + "report_hide": 0, "reqd": 0, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break3", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.lead || doc.customer", "fieldname": "contact_person", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Contact Person", + "no_copy": 0, "options": "Contact", "permlevel": 0, "print_hide": 1, - "read_only": 0 + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "customer", "fieldname": "contact_display", "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Contact", + "no_copy": 0, "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.lead || doc.customer", "fieldname": "contact_email", "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Contact Email", + "no_copy": 0, "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.lead || doc.customer", "fieldname": "contact_mobile", "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Contact Mobile No", + "no_copy": 0, "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "more_info", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "More Info", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-file-text", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break1", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "oldfieldtype": "Column Break", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" }, { + "allow_on_submit": 0, "default": "Today", "fieldname": "transaction_date", "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Opportunity Date", + "no_copy": 0, "oldfieldname": "transaction_date", "oldfieldtype": "Date", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50px" }, { + "allow_on_submit": 0, "fieldname": "company", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Company", + "no_copy": 0, "oldfieldname": "company", "oldfieldtype": "Link", "options": "Company", "permlevel": 0, "print_hide": 1, "read_only": 0, + "report_hide": 0, "reqd": 1, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "source", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Source", + "no_copy": 0, "oldfieldname": "source", "oldfieldtype": "Select", "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "Enter name of campaign if source of enquiry is campaign", "fieldname": "campaign", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Campaign", + "no_copy": 0, "oldfieldname": "campaign", "oldfieldtype": "Link", "options": "Campaign", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "fiscal_year", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Fiscal Year", + "no_copy": 0, "oldfieldname": "fiscal_year", "oldfieldtype": "Select", "options": "Fiscal Year", "permlevel": 0, "print_hide": 1, "read_only": 0, + "report_hide": 0, "reqd": 1, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:!doc.__islocal", "fieldname": "order_lost_reason", "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Lost Reason", "no_copy": 1, "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break2", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "oldfieldtype": "Column Break", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" }, { + "allow_on_submit": 0, "description": "Your sales person who will contact the customer in future", "fieldname": "contact_by", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Next Contact By", + "no_copy": 0, "oldfieldname": "contact_by", "oldfieldtype": "Link", "options": "User", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "75px" }, { + "allow_on_submit": 0, "description": "Your sales person will get a reminder on this date to contact the customer", "fieldname": "contact_date", "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Next Contact Date", + "no_copy": 0, "oldfieldname": "contact_date", "oldfieldtype": "Date", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "to_discuss", "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "To Discuss", "no_copy": 1, "oldfieldname": "to_discuss", "oldfieldtype": "Small Text", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "amended_from", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Amended From", "no_copy": 1, "oldfieldname": "amended_from", @@ -401,13 +793,24 @@ "permlevel": 0, "print_hide": 1, "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "150px" } ], + "hide_heading": 0, + "hide_toolbar": 0, "icon": "icon-info-sign", "idx": 1, + "in_create": 0, + "in_dialog": 0, "is_submittable": 0, - "modified": "2015-04-13 12:53:43.490817", + "issingle": 0, + "istable": 0, + "modified": "2015-08-07 17:11:33.955441", "modified_by": "Administrator", "module": "CRM", "name": "Opportunity", @@ -420,31 +823,42 @@ "create": 1, "delete": 1, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Sales User", + "set_user_permissions": 0, "share": 1, "submit": 0, "write": 1 }, { "amend": 0, + "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Sales Manager", + "set_user_permissions": 0, "share": 1, "submit": 0, "write": 1 } ], + "read_only": 0, + "read_only_onload": 0, "search_fields": "status,transaction_date,customer,lead,enquiry_type,territory,company", "sort_field": "modified", "sort_order": "DESC", diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 1609b87cab5..0fdbda1720b 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -27,7 +27,7 @@ blogs. """ app_icon = "icon-th" app_color = "#e74c3c" -app_version = "5.6.4" +app_version = "5.7.0" github_link = "https://github.com/frappe/erpnext" error_report_email = "support@erpnext.com" diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json index 67e2b78bbb4..b1ffd4d6425 100644 --- a/erpnext/manufacturing/doctype/bom/bom.json +++ b/erpnext/manufacturing/doctype/bom/bom.json @@ -3,50 +3,112 @@ "allow_import": 1, "allow_rename": 0, "creation": "2013-01-22 15:11:38", + "custom": 0, "docstatus": 0, "doctype": "DocType", "document_type": "Master", "fields": [ { + "allow_on_submit": 0, "description": "Item to be manufactured or repacked", "fieldname": "item", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 1, "label": "Item", + "no_copy": 0, "oldfieldname": "item", "oldfieldtype": "Link", "options": "Item", "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, "reqd": 1, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "item_name", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Item Name", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "rm_cost_as_per", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Rate Of Materials Based On", + "no_copy": 0, "options": "Valuation Rate\nLast Purchase Rate\nPrice List", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.rm_cost_as_per===\"Price List\"", "fieldname": "buying_price_list", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Price List", + "no_copy": 0, "options": "Price List", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "cb0", "fieldtype": "Column Break", - "permlevel": 0 + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { "allow_on_submit": 1, @@ -54,213 +116,517 @@ "fieldname": "is_active", "fieldtype": "Check", "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Is Active", "no_copy": 1, "oldfieldname": "is_active", "oldfieldtype": "Select", "permlevel": 0, - "reqd": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { "allow_on_submit": 1, "default": "1", "fieldname": "is_default", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Is Default", "no_copy": 1, "oldfieldname": "is_default", "oldfieldtype": "Check", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "Manage cost of operations", "fieldname": "with_operations", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "With Operations", - "permlevel": 0 + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "", "description": "Specify the operations, operating cost and give a unique Operation no to your operations.", "fieldname": "operations_section", "fieldtype": "Section Break", - "label": "Operations", - "oldfieldtype": "Section Break", - "permlevel": 0 - }, - { - "fieldname": "operations", - "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Operations", + "no_copy": 0, + "oldfieldtype": "Section Break", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "operations", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Operations", + "no_copy": 0, "oldfieldname": "bom_operations", "oldfieldtype": "Table", "options": "BOM Operation", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "materials_section", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Materials", + "no_copy": 0, "oldfieldtype": "Section Break", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "items", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Items", + "no_copy": 0, "oldfieldname": "bom_materials", "oldfieldtype": "Table", "options": "BOM Item", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "1", "description": "Quantity of item obtained after manufacturing / repacking from given quantities of raw materials", "fieldname": "quantity", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Quantity", + "no_copy": 0, "oldfieldname": "quantity", "oldfieldtype": "Currency", "permlevel": 0, - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "costing", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Costing", + "no_copy": 0, "oldfieldtype": "Section Break", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "operating_cost", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Operating Cost", + "no_copy": 0, "options": "Company:company:default_currency", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "raw_material_cost", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Raw Material Cost", + "no_copy": 0, "options": "Company:company:default_currency", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "cb1", "fieldtype": "Column Break", - "permlevel": 0 + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "total_cost", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Total Cost", + "no_copy": 0, "options": "Company:company:default_currency", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "more_info_section", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "", - "permlevel": 0 + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "project_name", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Project Name", + "no_copy": 0, "oldfieldname": "project_name", "oldfieldtype": "Link", "options": "Project", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "company", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Company", + "no_copy": 0, "options": "Company", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "amended_from", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Amended From", "no_copy": 1, "options": "BOM", "permlevel": 0, "print_hide": 1, - "read_only": 1 + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "col_break23", "fieldtype": "Column Break", - "permlevel": 0 + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "uom", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Item UOM", + "no_copy": 0, "options": "UOM", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "section_break_25", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "description", "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Item Desription", + "no_copy": 0, "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_27", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "image", "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Image", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { - "fieldname": "Image_view", + "allow_on_submit": 0, + "fieldname": "image_view", "fieldtype": "Image", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Image View", + "no_copy": 0, "options": "image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:!doc.__islocal", "fieldname": "section_break0", "fieldtype": "Section Break", "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Materials Required (Exploded)", + "no_copy": 0, "permlevel": 0, - "print_hide": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "exploded_items", "fieldtype": "Table", "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Exploded_items", "no_copy": 1, "oldfieldname": "flat_bom_details", @@ -268,7 +634,12 @@ "options": "BOM Explosion Item", "permlevel": 0, "print_hide": 1, - "read_only": 1 + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "hide_heading": 0, @@ -276,46 +647,59 @@ "icon": "icon-sitemap", "idx": 1, "in_create": 0, + "in_dialog": 0, "is_submittable": 1, "issingle": 0, "istable": 0, - "modified": "2015-06-26 02:02:30.705279", + "modified": "2015-08-12 08:52:36.656865", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM", "owner": "Administrator", "permissions": [ { + "amend": 0, + "apply_user_permissions": 0, "cancel": 1, "create": 1, "delete": 1, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Manufacturing Manager", + "set_user_permissions": 0, "share": 1, "submit": 1, "write": 1 }, { + "amend": 0, "apply_user_permissions": 1, "cancel": 1, "create": 1, "delete": 1, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Manufacturing User", + "set_user_permissions": 0, "share": 1, "submit": 1, "write": 1 } ], "read_only": 0, + "read_only_onload": 0, "search_fields": "item", "sort_field": "modified", "sort_order": "DESC" diff --git a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json index 14f091a068c..a05113df4d0 100644 --- a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json +++ b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json @@ -1,150 +1,336 @@ { + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, "autoname": "hash", "creation": "2013-03-07 11:42:57", + "custom": 0, "default_print_format": "Standard", "docstatus": 0, "doctype": "DocType", "fields": [ { + "allow_on_submit": 0, "fieldname": "item_code", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Item Code", + "no_copy": 0, "oldfieldname": "item_code", "oldfieldtype": "Link", "options": "Item", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "cb", "fieldtype": "Column Break", - "permlevel": 0, - "precision": "" - }, - { - "fieldname": "item_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Item Name", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, + "fieldname": "item_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Item Name", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, "fieldname": "section_break_3", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "description", "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Description", + "no_copy": 0, "oldfieldname": "description", "oldfieldtype": "Text", "permlevel": 0, + "print_hide": 0, "print_width": "300px", "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "300px" }, { + "allow_on_submit": 0, "fieldname": "column_break_2", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "image", "fieldtype": "Attach", "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Image", + "no_copy": 0, "permlevel": 0, "precision": "", - "print_hide": 1 + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "image_view", "fieldtype": "Image", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Image View", + "no_copy": 0, "options": "image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "section_break_4", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "qty", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Qty", + "no_copy": 0, "oldfieldname": "qty", "oldfieldtype": "Currency", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "rate", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Rate", + "no_copy": 0, "oldfieldname": "standard_rate", "oldfieldtype": "Currency", "options": "Company:company:default_currency", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "qty_consumed_per_unit", "fieldtype": "Float", "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Qty Consumed Per Unit", "no_copy": 0, "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_8", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "stock_uom", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Stock UOM", + "no_copy": 0, "oldfieldname": "stock_uom", "oldfieldtype": "Link", "options": "UOM", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "amount", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Amount", + "no_copy": 0, "oldfieldname": "amount_as_per_sr", "oldfieldtype": "Currency", "options": "Company:company:default_currency", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], + "hide_heading": 0, + "hide_toolbar": 0, "idx": 1, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, "istable": 1, - "modified": "2015-02-19 01:06:59.399382", + "modified": "2015-08-12 08:52:39.190103", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Explosion Item", "owner": "Administrator", "permissions": [], - "read_only": 0 + "read_only": 0, + "read_only_onload": 0 } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.json b/erpnext/manufacturing/doctype/bom_item/bom_item.json index 4870241836a..06d83503618 100644 --- a/erpnext/manufacturing/doctype/bom_item/bom_item.json +++ b/erpnext/manufacturing/doctype/bom_item/bom_item.json @@ -1,174 +1,382 @@ { + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, "creation": "2013-02-22 01:27:49", + "custom": 0, "docstatus": 0, "doctype": "DocType", "fields": [ { + "allow_on_submit": 0, "fieldname": "item_code", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 1, "label": "Item Code", + "no_copy": 0, "oldfieldname": "item_code", "oldfieldtype": "Link", "options": "Item", "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, "reqd": 1, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "item_name", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Item Name", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_3", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "bom_no", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 0, "label": "BOM No", + "no_copy": 0, "oldfieldname": "bom_no", "oldfieldtype": "Link", "options": "BOM", "permlevel": 0, + "print_hide": 0, "print_width": "150px", + "read_only": 0, + "report_hide": 0, "reqd": 0, "search_index": 1, + "set_only_once": 0, + "unique": 0, "width": "150px" }, { + "allow_on_submit": 0, "fieldname": "section_break_5", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "description", "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Item Description", + "no_copy": 0, "oldfieldname": "description", "oldfieldtype": "Text", "permlevel": 0, + "print_hide": 0, "print_width": "250px", + "read_only": 0, + "report_hide": 0, "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "250px" }, { + "allow_on_submit": 0, "fieldname": "col_break1", "fieldtype": "Column Break", - "permlevel": 0 + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "image", "fieldtype": "Attach", "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Image", + "no_copy": 0, "permlevel": 0, "precision": "", - "print_hide": 1 + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "image_view", "fieldtype": "Image", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Image View", + "no_copy": 0, "options": "image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "quantity_and_rate", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Quantity and Rate", - "permlevel": 0 + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "qty", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Qty", + "no_copy": 0, "oldfieldname": "qty", "oldfieldtype": "Currency", "permlevel": 0, - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "See \"Rate Of Materials Based On\" in Costing Section", "fieldname": "rate", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Rate", + "no_copy": 0, "options": "Company:company:default_currency", "permlevel": 0, - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "col_break2", "fieldtype": "Column Break", - "permlevel": 0 + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "stock_uom", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Stock UOM", + "no_copy": 0, "oldfieldname": "stock_uom", "oldfieldtype": "Data", "options": "UOM", "permlevel": 0, + "print_hide": 0, "read_only": 1, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "amount", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Amount", + "no_copy": 0, "oldfieldname": "amount_as_per_mar", "oldfieldtype": "Currency", "options": "Company:company:default_currency", "permlevel": 0, + "print_hide": 0, "print_width": "150px", "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "150px" }, { + "allow_on_submit": 0, "fieldname": "scrap", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Scrap %", + "no_copy": 0, "oldfieldname": "scrap", "oldfieldtype": "Currency", "permlevel": 0, - "print_hide": 1 + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "qty_consumed_per_unit", "fieldtype": "Float", "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Qty Consumed Per Unit", + "no_copy": 0, "oldfieldname": "qty_consumed_per_unit", "oldfieldtype": "Float", "permlevel": 0, "print_hide": 1, - "read_only": 1 + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], + "hide_heading": 0, + "hide_toolbar": 0, "idx": 1, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, "istable": 1, - "modified": "2015-02-12 15:17:18.324810", + "modified": "2015-08-12 08:52:41.512788", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Item", "owner": "Administrator", "permissions": [], + "read_only": 0, + "read_only_onload": 0, "sort_field": "modified", "sort_order": "DESC" } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json index 0c25e8fcc20..59f0eb1e1cc 100644 --- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json +++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json @@ -1,86 +1,175 @@ { + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, "creation": "2013-02-22 01:27:49", + "custom": 0, "docstatus": 0, "doctype": "DocType", "fields": [ { + "allow_on_submit": 0, "fieldname": "operation", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Operation", + "no_copy": 0, "oldfieldname": "operation_no", "oldfieldtype": "Data", "options": "Operation", "permlevel": 0, - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "workstation", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Workstation", + "no_copy": 0, "oldfieldname": "workstation", "oldfieldtype": "Link", "options": "Workstation", "permlevel": 0, - "reqd": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "description", "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Operation Description", + "no_copy": 0, "oldfieldname": "opn_description", "oldfieldtype": "Text", "permlevel": 0, - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "col_break1", "fieldtype": "Column Break", - "permlevel": 0 + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "hour_rate", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Hour Rate", + "no_copy": 0, "oldfieldname": "hour_rate", "oldfieldtype": "Currency", "permlevel": 0, - "reqd": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "In minutes", "fieldname": "time_in_mins", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Operation Time ", + "no_copy": 0, "oldfieldname": "time_in_mins", "oldfieldtype": "Currency", "options": "", "permlevel": 0, - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { "allow_on_submit": 0, "fieldname": "operating_cost", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Operating Cost", + "no_copy": 0, "oldfieldname": "operating_cost", "oldfieldtype": "Currency", "permlevel": 0, + "print_hide": 0, "read_only": 1, - "reqd": 0 + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], + "hide_heading": 0, + "hide_toolbar": 0, "idx": 1, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, "istable": 1, - "modified": "2015-04-22 03:24:47.809532", + "modified": "2015-08-12 08:52:43.922881", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Operation", "owner": "Administrator", - "permissions": [] + "permissions": [], + "read_only": 0, + "read_only_onload": 0 } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.json b/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.json index a1e215dd054..91ee189d7ea 100644 --- a/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.json +++ b/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.json @@ -1,40 +1,77 @@ { "allow_copy": 1, "allow_email": 1, + "allow_import": 0, "allow_print": 1, + "allow_rename": 0, "creation": "2012-12-06 12:10:10", + "custom": 0, "description": "Replace a particular BOM in all other BOMs where it is used. It will replace the old BOM link, update cost and regenerate \"BOM Explosion Item\" table as per new BOM", "docstatus": 0, "doctype": "DocType", "document_type": "Other", "fields": [ { + "allow_on_submit": 0, "description": "The BOM which will be replaced", "fieldname": "current_bom", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Current BOM", + "no_copy": 0, "options": "BOM", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "The new BOM after replacement", "fieldname": "new_bom", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "New BOM", + "no_copy": 0, "options": "BOM", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "replace", "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Replace", + "no_copy": 0, "options": "replace_bom", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "hide_heading": 1, @@ -42,23 +79,37 @@ "icon": "icon-magic", "idx": 1, "in_create": 1, + "in_dialog": 0, + "is_submittable": 0, "issingle": 1, - "modified": "2015-02-05 05:11:35.233845", + "istable": 0, + "modified": "2015-08-12 08:52:46.035343", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Replace Tool", "owner": "Administrator", "permissions": [ { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, + "print": 0, "read": 1, "report": 0, "role": "Manufacturing Manager", + "set_user_permissions": 0, "share": 1, "submit": 0, "write": 1 } ], - "read_only": 1 + "read_only": 1, + "read_only_onload": 0 } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json index e07ac5bf97c..19107668aaf 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.json +++ b/erpnext/manufacturing/doctype/production_order/production_order.json @@ -1,31 +1,62 @@ { + "allow_copy": 0, "allow_import": 1, + "allow_rename": 0, "autoname": "naming_series:", "creation": "2013-01-10 16:34:16", + "custom": 0, "docstatus": 0, "doctype": "DocType", "fields": [ { + "allow_on_submit": 0, "fieldname": "item", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "", + "no_copy": 0, "options": "icon-gift", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "PRO-", "fieldname": "naming_series", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Series", + "no_copy": 0, "options": "PRO-", "permlevel": 0, - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "Draft", "depends_on": "eval:!doc.__islocal", "fieldname": "status", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 0, "label": "Status", @@ -34,333 +65,739 @@ "oldfieldtype": "Select", "options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled", "permlevel": 0, + "print_hide": 0, "read_only": 1, + "report_hide": 0, "reqd": 1, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "production_item", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 1, "label": "Item To Manufacture", + "no_copy": 0, "oldfieldname": "production_item", "oldfieldtype": "Link", "options": "Item", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "", "description": "", "fieldname": "bom_no", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "BOM No", + "no_copy": 0, "oldfieldname": "bom_no", "oldfieldtype": "Link", "options": "BOM", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "1", "description": "Plan material for sub-assemblies", "fieldname": "use_multi_level_bom", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Use Multi-Level BOM", - "permlevel": 0 + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break1", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "oldfieldtype": "Column Break", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" }, { + "allow_on_submit": 0, "depends_on": "", "fieldname": "qty", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Qty To Manufacture", + "no_copy": 0, "oldfieldname": "qty", "oldfieldtype": "Currency", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "0", "depends_on": "eval:doc.docstatus==1", "description": "", "fieldname": "material_transferred_for_manufacturing", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Material Transferred for Manufacturing", "no_copy": 1, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "0", "depends_on": "eval:doc.docstatus==1", "description": "", "fieldname": "produced_qty", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Manufactured Qty", "no_copy": 1, "oldfieldname": "produced_qty", "oldfieldtype": "Currency", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "warehouses", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Warehouses", + "no_copy": 0, "options": "icon-building", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "wip_warehouse", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Work-in-Progress Warehouse", + "no_copy": 0, "options": "Warehouse", "permlevel": 0, - "reqd": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_12", "fieldtype": "Column Break", - "permlevel": 0 + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "", "description": "", "fieldname": "fg_warehouse", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Target Warehouse", + "no_copy": 0, "options": "Warehouse", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 0 + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "time", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Time", + "no_copy": 0, "options": "icon-time", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "", "fieldname": "expected_delivery_date", "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Expected Delivery Date", + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "now", "fieldname": "planned_start_date", "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Planned Start Date", + "no_copy": 0, "permlevel": 0, "precision": "", - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "planned_end_date", "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Planned End Date", "no_copy": 1, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_13", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "actual_start_date", "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Actual Start Date", + "no_copy": 0, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "actual_end_date", "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Actual End Date", + "no_copy": 0, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "", "fieldname": "operations_section", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Operations", + "no_copy": 0, "options": "icon-wrench", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "", "fieldname": "operations", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Operations", + "no_copy": 0, "options": "Production Order Operation", "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "operations", "fieldname": "section_break_22", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Operation Cost", + "no_copy": 0, "options": "", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "planned_operating_cost", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Planned Operating Cost", "no_copy": 0, "options": "Company:company:default_currency", "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "actual_operating_cost", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Actual Operating Cost", "no_copy": 1, "options": "Company:company:default_currency", "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "additional_operating_cost", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Additional Operating Cost", "no_copy": 1, "options": "Company:company:default_currency", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_24", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "total_operating_cost", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Total Operating Cost", "no_copy": 1, "options": "Company:company:default_currency", "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "more_info", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "More Info", + "no_copy": 0, "options": "icon-file-text", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "description", "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Item Description", + "no_copy": 0, "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "", "fieldname": "stock_uom", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Stock UOM", + "no_copy": 0, "oldfieldname": "stock_uom", "oldfieldtype": "Data", "options": "UOM", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break2", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" }, { + "allow_on_submit": 0, "fieldname": "project_name", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Project Name", + "no_copy": 0, "oldfieldname": "project_name", "oldfieldtype": "Link", "options": "Project", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "Manufacture against Sales Order", "fieldname": "sales_order", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Sales Order", + "no_copy": 0, "options": "Sales Order", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "company", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Company", + "no_copy": 0, "oldfieldname": "company", "oldfieldtype": "Link", "options": "Company", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "amended_from", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Amended From", "no_copy": 1, "oldfieldname": "amended_from", "oldfieldtype": "Data", "options": "Production Order", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], + "hide_heading": 0, + "hide_toolbar": 0, "icon": "icon-cogs", "idx": 1, "in_create": 0, + "in_dialog": 0, "is_submittable": 1, - "modified": "2015-07-21 07:45:53.206902", + "issingle": 0, + "istable": 0, + "modified": "2015-08-12 08:50:32.803526", "modified_by": "Administrator", "module": "Manufacturing", "name": "Production Order", @@ -373,22 +810,41 @@ "create": 1, "delete": 1, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Manufacturing User", + "set_user_permissions": 0, "share": 1, "submit": 1, "write": 1 }, { + "amend": 0, "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, + "print": 0, "read": 1, "report": 1, - "role": "Stock User" + "role": "Stock User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 } ], + "read_only": 0, + "read_only_onload": 0, "title_field": "production_item" } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index b6befe08673..6a6e6ed8d20 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -107,6 +107,7 @@ class ProductionOrder(Document): qty = (flt(self.qty)-flt(self.produced_qty)) * ((status == 'Stopped') and -1 or 1) self.update_planned_qty(qty) frappe.msgprint(_("Production Order status is {0}").format(status)) + self.notify_modified() def update_status(self, status=None): diff --git a/erpnext/patches.txt b/erpnext/patches.txt index d5ba353191e..551518e6e87 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -47,6 +47,7 @@ erpnext.patches.v4_0.update_account_root_type execute:frappe.delete_doc("Report", "Purchase In Transit") erpnext.patches.v4_0.new_address_template execute:frappe.delete_doc("DocType", "SMS Control") +execute:frappe.delete_doc_if_exists("DocType", "Bulk SMS") #2015-08-18 erpnext.patches.v4_0.fix_case_of_hr_module_def erpnext.patches.v4_0.fix_address_template @@ -136,7 +137,6 @@ erpnext.patches.v5_0.update_account_types erpnext.patches.v5_0.update_sms_sender erpnext.patches.v5_0.set_appraisal_remarks erpnext.patches.v5_0.update_time_log_title -erpnext.patches.v4_2.repost_reserved_qty erpnext.patches.v4_2.repost_sle_for_si_with_no_warehouse erpnext.patches.v5_0.newsletter execute:frappe.delete_doc("DocType", "Chart of Accounts") @@ -171,7 +171,6 @@ execute:frappe.delete_doc("Page", "users") erpnext.patches.v5_0.update_material_transferred_for_manufacturing_again erpnext.patches.v5_0.index_on_account_and_gl_entry execute:frappe.db.sql("""delete from `tabProject Task`""") -erpnext.patches.v5_0.item_variants erpnext.patches.v5_0.update_item_desc_in_invoice erpnext.patches.v5_1.fix_against_account erpnext.patches.v5_1.fix_credit_days_based_on @@ -191,3 +190,6 @@ erpnext.patches.v5_4.fix_missing_item_images erpnext.patches.v5_4.stock_entry_additional_costs erpnext.patches.v5_4.cleanup_journal_entry #2015-08-14 execute:frappe.db.sql("update `tabProduction Order` pro set description = (select description from tabItem where name=pro.production_item) where ifnull(description, '') = ''") +erpnext.patches.v5_7.item_template_attributes +erpnext.patches.v4_2.repost_reserved_qty #2015-08-17 +erpnext.patches.v5_4.update_purchase_cost_against_project diff --git a/erpnext/patches/v4_2/repost_reserved_qty.py b/erpnext/patches/v4_2/repost_reserved_qty.py index 04dfb77bfa2..f91968c2d49 100644 --- a/erpnext/patches/v4_2/repost_reserved_qty.py +++ b/erpnext/patches/v4_2/repost_reserved_qty.py @@ -6,7 +6,22 @@ import frappe from erpnext.utilities.repost_stock import update_bin_qty, get_reserved_qty def execute(): - for item_code, warehouse in frappe.db.sql("select item_code, warehouse from tabBin where ifnull(reserved_qty, 0) < 0"): - update_bin_qty(item_code, warehouse, { - "reserved_qty": get_reserved_qty(item_code, warehouse) - }) \ No newline at end of file + repost_for = frappe.db.sql(""" + select + distinct item_code, warehouse + from + ( + ( + select distinct item_code, warehouse + from `tabSales Order Item` where docstatus=1 + ) UNION ( + select distinct item_code, warehouse + from `tabPacked Item` where docstatus=1 and parenttype='Sales Order' + ) + ) items + """) + + for item_code, warehouse in repost_for: + update_bin_qty(item_code, warehouse, { + "reserved_qty": get_reserved_qty(item_code, warehouse) + }) \ No newline at end of file diff --git a/erpnext/patches/v5_0/item_variants.py b/erpnext/patches/v5_0/item_variants.py deleted file mode 100644 index 66300be671e..00000000000 --- a/erpnext/patches/v5_0/item_variants.py +++ /dev/null @@ -1,19 +0,0 @@ -import frappe - -def execute(): - frappe.reload_doctype("Item") - for dt in ["manage_variants", "manage_variants_item", "variant_attribute"]: - frappe.reload_doc("stock", "doctype", dt) - - for d in frappe.get_list("Item", filters={"has_variants":1}): - manage_variant = frappe.new_doc("Manage Variants") - manage_variant.item_code = d.name - manage_variant.attributes = frappe.db.sql("select item_attribute as attribute, item_attribute_value as attribute_value \ - from `tabItem Variant` where parent = %s", d.name, as_dict=1) - if manage_variant.attributes: - if not frappe.get_list("Item", filters={"variant_of": d.name}, limit_page_length=1): - frappe.db.sql("delete from `tabItem Variant` where parent=%s", d.name) - else: - manage_variant.generate_combinations() - manage_variant.create_variants() - frappe.delete_doc("DocType", "Item Variant") \ No newline at end of file diff --git a/erpnext/patches/v5_4/fix_reserved_qty_and_sle_for_packed_items.py b/erpnext/patches/v5_4/fix_reserved_qty_and_sle_for_packed_items.py index f1632abd5ac..251dd56acbe 100644 --- a/erpnext/patches/v5_4/fix_reserved_qty_and_sle_for_packed_items.py +++ b/erpnext/patches/v5_4/fix_reserved_qty_and_sle_for_packed_items.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from erpnext.utilities.repost_stock import update_bin_qty, get_reserved_qty, repost_actual_qty +from erpnext.utilities.repost_stock import repost_actual_qty def execute(): cancelled_invoices = frappe.db.sql_list("""select name from `tabSales Invoice` @@ -19,10 +19,4 @@ def execute(): % (', '.join(['%s']*len(cancelled_invoices))), tuple(cancelled_invoices)) for item_code, warehouse in repost_for: - repost_actual_qty(item_code, warehouse) - - for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse - from `tabPacked Item` where parenttype = 'Sales Invoice' and docstatus = 1"""): - update_bin_qty(item_code, warehouse, { - "reserved_qty": get_reserved_qty(item_code, warehouse) - }) \ No newline at end of file + repost_actual_qty(item_code, warehouse) \ No newline at end of file diff --git a/erpnext/patches/v5_4/update_purchase_cost_against_project.py b/erpnext/patches/v5_4/update_purchase_cost_against_project.py new file mode 100644 index 00000000000..3a02eb76f9c --- /dev/null +++ b/erpnext/patches/v5_4/update_purchase_cost_against_project.py @@ -0,0 +1,13 @@ +# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + for p in frappe.get_all("Project"): + purchase_cost = frappe.db.sql("""select sum(ifnull(base_net_amount, 0)) + from `tabPurchase Invoice Item` where project_name = %s and docstatus=1""", p.name) + purchase_cost = purchase_cost and purchase_cost[0][0] or 0 + + frappe.db.set_value("Project", p.name, "total_purchase_cost", purchase_cost) \ No newline at end of file diff --git a/erpnext/patches/v5_7/__init__.py b/erpnext/patches/v5_7/__init__.py new file mode 100644 index 00000000000..baffc488252 --- /dev/null +++ b/erpnext/patches/v5_7/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/v5_7/item_template_attributes.py b/erpnext/patches/v5_7/item_template_attributes.py new file mode 100644 index 00000000000..f0012448530 --- /dev/null +++ b/erpnext/patches/v5_7/item_template_attributes.py @@ -0,0 +1,121 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +import MySQLdb + +def execute(): + """ + Structure History: + 1. Item and Item Variant + 2. Item, Variant Attribute, Manage Variants and Manage Variant Items + 3. Item, Item Variant Attribute, Item Attribute and Item Attribute Type (latest) + """ + rename_and_reload_doctypes() + + variant_templates = frappe.get_all("Item", filters={"has_variants": 1}, limit_page_length=1) + if not variant_templates: + # database does not have items that have variants + # so no point in running the patch + return + + variant_attributes = frappe.get_all("Item Variant Attribute", fields=["*"], limit_page_length=1) + + if variant_attributes: + # manage variant patch is already applied + migrate_manage_variants() + + else: + # old structure based on "Item Variant" table + try: + migrate_item_variants() + + except MySQLdb.ProgrammingError: + print "`tabItem Variant` not found" + +def rename_and_reload_doctypes(): + if "tabVariant Attribute" in frappe.db.get_tables(): + frappe.rename_doc("DocType", "Variant Attribute", "Item Variant Attribute") + + frappe.reload_doctype("Item") + frappe.reload_doctype("Item Variant Attribute") + frappe.reload_doctype("Item Attribute Value") + frappe.reload_doctype("Item Attribute") + +def migrate_manage_variants(): + item_attribute = {} + for d in frappe.db.sql("""select DISTINCT va.attribute, i.variant_of + from `tabItem Variant Attribute` va, `tabItem` i + where va.parent = i.name and ifnull(i.variant_of, '')!=''""", as_dict=1): + item_attribute.setdefault(d.variant_of, []).append({"attribute": d.attribute}) + + for item, attributes in item_attribute.items(): + template = frappe.get_doc("Item", item) + template.set('attributes', attributes) + template.save() + + frappe.delete_doc("DocType", "Manage Variants") + frappe.delete_doc("DocType", "Manage Variants Item") + +# patch old style +def migrate_item_variants(): + for item in frappe.get_all("Item", filters={"has_variants": 1}): + all_variants = frappe.get_all("Item", filters={"variant_of": item.name}, fields=["name", "description"]) + item_attributes = frappe.db.sql("""select distinct item_attribute, item_attribute_value + from `tabItem Variant` where parent=%s""", item.name) + + attribute_value_options = {} + for attribute, value in item_attributes: + attribute_value_options.setdefault(attribute, []).append(value) + + save_attributes_in_template(item, attribute_value_options) + + possible_combinations = get_possible_combinations(attribute_value_options) + + for variant in all_variants: + for combination in possible_combinations: + match = True + for attribute, value in combination.items(): + if "{0}: {1}".format(attribute, value) not in variant.description: + match = False + break + + if match: + # found the right variant + save_attributes_in_variant(variant, combination) + break + + frappe.delete_doc("DocType", "Item Variant") + +def save_attributes_in_template(item, attribute_value_options): + # store attribute in Item Variant Attribute table for template + template = frappe.get_doc("Item", item) + template.set("attributes", [{"attribute": attribute} for attribute in attribute_value_options.keys()]) + template.save() + +def get_possible_combinations(attribute_value_options): + possible_combinations = [] + + for attribute, values in attribute_value_options.items(): + if not possible_combinations: + for v in values: + possible_combinations.append({attribute: v}) + + else: + for v in values: + for combination in possible_combinations: + combination[attribute] = v + + return possible_combinations + +def save_attributes_in_variant(variant, combination): + # add data into attributes table + variant_item = frappe.get_doc("Item", variant.name) + variant_item.set("attributes", []) + for attribute, value in combination.items(): + variant_item.append("attributes", { + "attribute": attribute, + "attribute_value": value + }) + variant_item.save() diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json index 486d86112ea..04d6cb48aa1 100644 --- a/erpnext/projects/doctype/project/project.json +++ b/erpnext/projects/doctype/project/project.json @@ -1,68 +1,129 @@ { + "allow_copy": 0, "allow_import": 1, "allow_rename": 1, "autoname": "field:project_name", "creation": "2013-03-07 11:55:07", + "custom": 0, "docstatus": 0, "doctype": "DocType", "document_type": "Master", "fields": [ { + "allow_on_submit": 0, "description": "", "fieldname": "project_name", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Project Name", "no_copy": 0, "oldfieldname": "project_name", "oldfieldtype": "Data", "permlevel": 0, - "reqd": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "Open", "fieldname": "status", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Status", "no_copy": 1, "oldfieldname": "status", "oldfieldtype": "Select", "options": "Open\nCompleted\nCancelled", "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, "reqd": 1, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "project_type", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Project Type", "no_copy": 0, "oldfieldname": "project_type", "oldfieldtype": "Data", "options": "Internal\nExternal\nOther", "permlevel": 0, - "search_index": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_5", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "is_active", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Is Active", "no_copy": 0, "oldfieldname": "is_active", "oldfieldtype": "Select", "options": "Yes\nNo", "permlevel": 0, - "search_index": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "priority", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "Priority", "no_copy": 0, @@ -70,53 +131,123 @@ "oldfieldtype": "Select", "options": "Medium\nLow\nHigh", "permlevel": 0, - "search_index": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "section_break_12", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "expected_start_date", "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Expected Start Date", "no_copy": 0, "oldfieldname": "project_start_date", "oldfieldtype": "Date", "permlevel": 0, - "search_index": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_11", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "expected_end_date", "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Expected End Date", "no_copy": 0, "oldfieldname": "completion_date", "oldfieldtype": "Date", "permlevel": 0, - "search_index": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "customer_details", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-user", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "customer", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Customer", "no_copy": 0, "oldfieldname": "customer", @@ -124,115 +255,281 @@ "options": "Customer", "permlevel": 0, "print_hide": 1, + "read_only": 0, + "report_hide": 0, "reqd": 0, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_14", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "sales_order", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Sales Order", + "no_copy": 0, "options": "Sales Order", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "sb_milestones", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Tasks", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-flag", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "tasks", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Tasks", + "no_copy": 0, "options": "Project Task", "permlevel": 0, "precision": "", - "reqd": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "percent_complete", "fieldtype": "Percent", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 0, "label": "% Tasks Completed", "no_copy": 1, "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "section_break0", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-list", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "notes", "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Notes", "no_copy": 0, "oldfieldname": "notes", "oldfieldtype": "Text Editor", "permlevel": 0, - "search_index": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "section_break_18", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "actual_start_date", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Actual Start Date", + "no_copy": 0, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "actual_time", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Actual Time (in Hours)", + "no_copy": 0, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_20", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "actual_end_date", "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Actual End Date", "no_copy": 0, "oldfieldname": "act_completion_date", "oldfieldtype": "Date", "permlevel": 0, + "print_hide": 0, "read_only": 1, - "search_index": 0 + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "section_break_26", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "estimated_costing", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Estimated Costing", "no_copy": 0, @@ -240,124 +537,292 @@ "oldfieldtype": "Currency", "options": "Company:company:default_currency", "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, "reqd": 0, - "search_index": 0 + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_22", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "company", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Company", + "no_copy": 0, "options": "Company", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "cost_center", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Default Cost Center", + "no_copy": 0, "options": "Cost Center", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "project_details", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-money", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "", "fieldname": "total_costing_amount", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Total Costing Amount (via Time Logs)", + "no_copy": 0, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "", "fieldname": "total_expense_claim", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Total Expense Claim (via Expense Claims)", + "no_copy": 0, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_28", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "", "fieldname": "total_billing_amount", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Total Billing Amount (via Time Logs)", + "no_copy": 0, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "total_purchase_cost", "fieldtype": "Currency", "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Total Purchase Cost (via Purchase Invoice)", + "no_copy": 0, "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "margin", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "", + "no_copy": 0, "oldfieldtype": "Column Break", "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" }, { + "allow_on_submit": 0, "fieldname": "gross_margin", "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Gross Margin", "no_copy": 0, "oldfieldname": "gross_margin_value", "oldfieldtype": "Currency", "options": "Company:company:default_currency", "permlevel": 0, + "print_hide": 0, "read_only": 1, + "report_hide": 0, "reqd": 0, - "search_index": 0 + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_37", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "per_gross_margin", "fieldtype": "Percent", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Gross Margin %", "no_copy": 0, "oldfieldname": "per_gross_margin", "oldfieldtype": "Currency", "options": "", "permlevel": 0, + "print_hide": 0, "read_only": 1, + "report_hide": 0, "reqd": 0, - "search_index": 0 + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], + "hide_heading": 0, + "hide_toolbar": 0, "icon": "icon-puzzle-piece", "idx": 1, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, "max_attachments": 4, - "modified": "2015-06-12 09:00:54.080220", + "modified": "2015-08-12 08:51:43.620261", "modified_by": "Administrator", "module": "Projects", "name": "Project", @@ -366,29 +831,45 @@ { "amend": 0, "apply_user_permissions": 1, + "cancel": 0, "create": 1, "delete": 1, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Projects User", + "set_user_permissions": 0, "share": 1, "submit": 0, "write": 1 }, { "amend": 0, + "apply_user_permissions": 0, "cancel": 0, "create": 0, "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 1, + "print": 0, "read": 1, "report": 1, "role": "All", - "submit": 0 + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 } ], + "read_only": 0, + "read_only_onload": 0, "search_fields": "customer, status, priority, is_active" } \ No newline at end of file diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 6ebafdba59e..de1c3f83f49 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -25,13 +25,13 @@ class Project(Document): "description": task.description, "task_id": task.name }) - + def __setup__(self): self.onload() - + def get_tasks(self): return frappe.get_all("Task", "*", {"project": self.name}, order_by="exp_start_date asc") - + def validate(self): self.validate_dates() self.sync_tasks() @@ -74,7 +74,7 @@ class Project(Document): for t in frappe.get_all("Task", ["name"], {"project": self.name, "name": ("not in", task_names)}): frappe.delete_doc("Task", t.name) task_added_or_deleted = True - + if task_added_or_deleted: self.update_project() @@ -87,12 +87,12 @@ class Project(Document): if total: completed = frappe.db.sql("""select count(*) from tabTask where project=%s and status in ('Closed', 'Cancelled')""", self.name)[0][0] - + self.percent_complete = flt(completed) / total * 100 def update_costing(self): - total_cost = frappe.db.sql("""select sum(total_costing_amount) as costing_amount, - sum(total_billing_amount) as billing_amount, sum(total_expense_claim) as expense_claim, + total_cost = frappe.db.sql("""select sum(ifnull(total_costing_amount, 0)) as costing_amount, + sum(ifnull(total_billing_amount, 0)) as billing_amount, sum(ifnull(total_expense_claim, 0)) as expense_claim, min(act_start_date) as start_date, max(act_end_date) as end_date, sum(actual_time) as time from `tabTask` where project = %s""", self.name, as_dict=1)[0] @@ -105,10 +105,12 @@ class Project(Document): self.gross_margin = flt(total_cost.billing_amount) - flt(total_cost.costing_amount) if self.total_billing_amount: self.per_gross_margin = (self.gross_margin / flt(self.total_billing_amount)) *100 - + def update_purchase_costing(self): - self.total_purchase_cost = frappe.db.sql("""select sum(amount) as cost - from `tabPurchase Invoice Item` where project_name = %s and docstatus=1 """, self.name, as_dict=1)[0].cost or 0 + total_purchase_cost = frappe.db.sql("""select sum(ifnull(base_net_amount, 0)) + from `tabPurchase Invoice Item` where project_name = %s and docstatus=1""", self.name) + + self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0 @frappe.whitelist() def get_cost_center_name(project_name): diff --git a/erpnext/projects/doctype/project_task/project_task.json b/erpnext/projects/doctype/project_task/project_task.json index e5aae3eb4b6..44180cb9a35 100644 --- a/erpnext/projects/doctype/project_task/project_task.json +++ b/erpnext/projects/doctype/project_task/project_task.json @@ -25,7 +25,8 @@ "report_hide": 0, "reqd": 1, "search_index": 0, - "set_only_once": 0 + "set_only_once": 0, + "unique": 0 }, { "allow_on_submit": 0, @@ -46,21 +47,48 @@ "report_hide": 0, "reqd": 1, "search_index": 0, - "set_only_once": 0 + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "task_id", "fieldname": "edit_task", "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "View Task", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_3", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { "allow_on_submit": 0, @@ -79,7 +107,8 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "set_only_once": 0 + "set_only_once": 0, + "unique": 0 }, { "allow_on_submit": 0, @@ -99,13 +128,27 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "set_only_once": 0 + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "section_break_6", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { "allow_on_submit": 0, @@ -124,17 +167,29 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "set_only_once": 0 + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "task_id", "fieldtype": "Link", "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Task ID", "no_copy": 1, "options": "Task", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "hide_heading": 0, @@ -144,7 +199,7 @@ "is_submittable": 0, "issingle": 0, "istable": 1, - "modified": "2015-04-23 05:48:00.504508", + "modified": "2015-08-12 08:51:46.609018", "modified_by": "Administrator", "module": "Projects", "name": "Project Task", diff --git a/erpnext/public/js/pos/pos.js b/erpnext/public/js/pos/pos.js index e28c7189e85..5f827964f6d 100644 --- a/erpnext/public/js/pos/pos.js +++ b/erpnext/public/js/pos/pos.js @@ -182,6 +182,9 @@ erpnext.pos.PointOfSale = Class.extend({ child.serial_no = serial_no; this.frm.script_manager.trigger("item_code", child.doctype, child.name); + frappe.after_ajax(function() { + me.frm.script_manager.trigger("qty", child.doctype, child.name); + }) }, refresh_search_box: function() { var me = this; @@ -432,7 +435,7 @@ erpnext.pos.PointOfSale = Class.extend({ } }, {fieldtype:'Currency', fieldname:'write_off_amount', - label: __('Write Off'), default: 0.0, hidden: 1}, + label: __('Write Off'), "default": 0.0, hidden: 1}, ] }); me.dialog = dialog; @@ -470,6 +473,8 @@ erpnext.pos.PointOfSale = Class.extend({ } me.frm.set_value("mode_of_payment", values.mode_of_payment); + //me.frm.cscript.calculate_taxes_and_totals(); + var paid_amount = flt((flt(values.paid_amount) - flt(values.change)) / me.frm.doc.conversion_rate, precision("paid_amount")); me.frm.set_value("paid_amount", paid_amount); @@ -479,7 +484,6 @@ erpnext.pos.PointOfSale = Class.extend({ me.frm.savesubmit(this); dialog.hide(); - me.refresh(); }) } diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 1c057151791..b05c009fa0d 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -216,6 +216,7 @@ class SalesOrder(SellingController): self.update_stock_ledger(-1) frappe.db.set(self, 'status', 'Stopped') frappe.msgprint(_("{0} {1} status is Stopped").format(self.doctype, self.name)) + self.notify_modified() def unstop_sales_order(self): self.check_modified_date() diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py index cb59a821d1a..869b7e5a495 100644 --- a/erpnext/setup/page/setup_wizard/setup_wizard.py +++ b/erpnext/setup/page/setup_wizard/setup_wizard.py @@ -32,6 +32,8 @@ def setup_account(args=None): if args.language and args.language != "english": set_default_language(args.language) + frappe.clear_cache() + install_fixtures.install(args.get("country")) update_user_name(args) diff --git a/erpnext/startup/notifications.py b/erpnext/startup/notifications.py index d06537066e7..c7e63f133c2 100644 --- a/erpnext/startup/notifications.py +++ b/erpnext/startup/notifications.py @@ -31,6 +31,6 @@ def get_notification_config(): "BOM": {"docstatus": 0}, "Timesheet": {"docstatus": 0}, "Time Log": {"status": "Draft"}, - "Time Log Batch": {"status": "Draft"}, + "Time Log Batch": {"status": "Draft"} } } diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 35455b4fee7..e95babe228b 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -6,6 +6,10 @@ frappe.provide("erpnext.item"); frappe.ui.form.on("Item", { onload: function(frm) { erpnext.item.setup_queries(frm); + if (frm.doc.variant_of){ + frm.fields_dict["attributes"].grid.set_column_disp("attribute_value", true); + } + }, refresh: function(frm) { @@ -30,6 +34,10 @@ frappe.ui.form.on("Item", { frm.add_custom_button(__("Show Variants"), function() { frappe.set_route("List", "Item", {"variant_of": frm.doc.name}); }, "icon-list", "btn-default"); + + frm.add_custom_button(__("Make Variant"), function() { + erpnext.item.make_variant() + }, "icon-list", "btn-default"); } if (frm.doc.variant_of) { frm.set_intro(__("This Item is a Variant of {0} (Template). Attributes will be copied over from the template unless 'No Copy' is set", [frm.doc.variant_of]), true); @@ -49,11 +57,12 @@ frappe.ui.form.on("Item", { } erpnext.item.toggle_reqd(frm); + + erpnext.item.toggle_attributes(frm); }, validate: function(frm){ erpnext.item.weight_to_validate(frm); - erpnext.item.variants_can_not_be_created_manually(frm); }, image: function(frm) { @@ -85,13 +94,8 @@ frappe.ui.form.on("Item", { erpnext.item.toggle_reqd(frm); }, - manage_variants: function(frm) { - if (cur_frm.doc.__unsaved==1) { - frappe.throw(__("You have unsaved changes. Please save.")) - } else { - frappe.route_options = {"item_code": frm.doc.name }; - frappe.set_route("List", "Manage Variants"); - } + has_variants: function(frm) { + erpnext.item.toggle_attributes(frm); } }); @@ -190,10 +194,127 @@ $.extend(erpnext.item, { } }, - variants_can_not_be_created_manually: function(frm) { - if (frm.doc.__islocal && frm.doc.variant_of) - frappe.throw(__("Variants can not be created manually, add item attributes in the template item")) + make_variant: function(doc) { + var fields = [] + + for(var i=0;i< cur_frm.doc.attributes.length;i++){ + var fieldtype, desc; + var row = cur_frm.doc.attributes[i]; + if (row.numeric_values){ + fieldtype = "Float"; + desc = "Min Value: "+ row.from_range +" , Max Value: "+ row.to_range +", in Increments of: "+ row.increment + } + else { + fieldtype = "Data"; + desc = "" + } + fields = fields.concat({ + "label": row.attribute, + "fieldname": row.attribute, + "fieldtype": fieldtype, + "reqd": 1, + "description": desc + }) + } + + var d = new frappe.ui.Dialog({ + title: __("Make Variant"), + fields: fields + }); + + d.set_primary_action(__("Make"), function() { + args = d.get_values(); + if(!args) return; + frappe.call({ + method:"erpnext.stock.doctype.item.item.get_variant", + args: { + "item": cur_frm.doc.name, + "args": d.get_values() + }, + callback: function(r) { + // returns variant item + if (r.message) { + var variant = r.message; + var msgprint_dialog = frappe.msgprint(__("Item Variant {0} already exists with same attributes", + [repl('%(item)s', { + item_encoded: encodeURIComponent(variant), + item: variant + })] + )); + msgprint_dialog.hide_on_page_refresh = true; + msgprint_dialog.$wrapper.find(".variant-click").on("click", function() { + d.hide(); + }); + } else { + d.hide(); + frappe.call({ + method:"erpnext.stock.doctype.item.item.create_variant", + args: { + "item": cur_frm.doc.name, + "args": d.get_values() + }, + callback: function(r) { + var doclist = frappe.model.sync(r.message); + frappe.set_route("Form", doclist[0].doctype, doclist[0].name); + } + }); + } + } + }); + }); + + d.show(); + + $.each(d.fields_dict, function(i, field) { + + if(field.df.fieldtype !== "Data") { + return; + } + + $(field.input_area).addClass("ui-front"); + + field.$input.autocomplete({ + minLength: 0, + minChars: 0, + autoFocus: true, + source: function(request, response) { + frappe.call({ + method:"frappe.client.get_list", + args:{ + doctype:"Item Attribute Value", + filters: [ + ["parent","=", i], + ["attribute_value", "like", request.term + "%"] + ], + fields: ["attribute_value"] + }, + callback: function(r) { + if (r.message) { + response($.map(r.message, function(d) { return d.attribute_value; })); + } + } + }); + }, + select: function(event, ui) { + field.$input.val(ui.item.value); + field.$input.trigger("change"); + }, + }).on("focus", function(){ + setTimeout(function() { + if(!field.$input.val()) { + field.$input.autocomplete("search", ""); + } + }, 500); + }); + }); + }, + toggle_attributes: function(frm) { + frm.toggle_display("attributes", frm.doc.has_variants || frm.doc.variant_of); + frm.fields_dict.attributes.grid.toggle_reqd("attribute_value", frm.doc.variant_of ? 1 : 0); } - - }); + +cur_frm.add_fetch('attribute', 'numeric_values', 'numeric_values'); +cur_frm.add_fetch('attribute', 'from_range', 'from_range'); +cur_frm.add_fetch('attribute', 'to_range', 'to_range'); +cur_frm.add_fetch('attribute', 'increment', 'increment'); diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 9a52a2345ae..dbf252b559b 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -1,8 +1,10 @@ { + "allow_copy": 0, "allow_import": 1, "allow_rename": 1, "autoname": "field:item_code", "creation": "2013-05-03 10:45:46", + "custom": 0, "default_print_format": "Standard", "description": "A Product or a Service that is bought, sold or kept in stock.", "docstatus": 0, @@ -10,999 +12,2092 @@ "document_type": "Master", "fields": [ { + "allow_on_submit": 0, "fieldname": "name_and_description_section", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "", "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-flag", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "naming_series", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Series", + "no_copy": 0, "options": "ITEM-", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "", "fieldname": "item_code", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 0, + "in_list_view": 0, "label": "Item Code", "no_copy": 1, "oldfieldname": "item_code", "oldfieldtype": "Data", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, "reqd": 0, - "search_index": 0 + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "variant_of", "description": "If item is a variant of another item then description, image, pricing, taxes etc will be set from the template unless explicitly specified", "fieldname": "variant_of", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Variant Of", + "no_copy": 0, "options": "Item", "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "item_name", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 0, "label": "Item Name", + "no_copy": 0, "oldfieldname": "item_name", "oldfieldtype": "Data", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, "reqd": 1, - "search_index": 1 + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "", "fieldname": "item_group", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, "in_list_view": 1, "label": "Item Group", + "no_copy": 0, "oldfieldname": "item_group", "oldfieldtype": "Link", "options": "Item Group", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "", "fieldname": "stock_uom", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Default Unit of Measure", + "no_copy": 0, "oldfieldname": "stock_uom", "oldfieldtype": "Link", "options": "UOM", "permlevel": 0, + "print_hide": 0, "read_only": 0, - "reqd": 1 + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "brand", "fieldtype": "Link", "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Brand", + "no_copy": 0, "oldfieldname": "brand", "oldfieldtype": "Link", "options": "Brand", "permlevel": 0, "print_hide": 1, "read_only": 0, - "reqd": 0 + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "barcode", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Barcode", "no_copy": 1, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break0", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "image", "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Image", + "no_copy": 0, "options": "image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "image_view", "fieldtype": "Image", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, "in_list_view": 1, "label": "Image View", + "no_copy": 0, "options": "image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "section_break_11", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "description", "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, "label": "Description", + "no_copy": 0, "oldfieldname": "description", "oldfieldtype": "Text", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, "reqd": 1, - "search_index": 0 + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "inventory", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Inventory", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-truck", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "1", "description": "", "fieldname": "is_stock_item", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Maintain Stock", + "no_copy": 0, "oldfieldname": "is_stock_item", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "", "depends_on": "eval:doc.is_stock_item", "fieldname": "has_batch_no", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Has Batch No", + "no_copy": 0, "oldfieldname": "has_batch_no", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "", "depends_on": "eval:doc.is_stock_item", "description": "Selecting \"Yes\" will give a unique identity to each entity of this item which can be viewed in the Serial No master.", "fieldname": "has_serial_no", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Has Serial No", + "no_copy": 0, "oldfieldname": "has_serial_no", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "has_serial_no", "description": "Example: ABCD.#####\nIf series is set and Serial No is not mentioned in transactions, then automatic serial number will be created based on this series. If you always want to explicitly mention Serial Nos for this item. leave this blank.", "fieldname": "serial_no_series", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Serial Number Series", "no_copy": 0, - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "", "depends_on": "eval:doc.is_stock_item", "description": "", "fieldname": "is_asset_item", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Is Fixed Asset Item", + "no_copy": 0, "oldfieldname": "is_asset_item", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_stock_item", "fieldname": "column_break1", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "oldfieldtype": "Column Break", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" }, { + "allow_on_submit": 0, "depends_on": "", "description": "", "fieldname": "default_warehouse", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Default Warehouse", + "no_copy": 0, "oldfieldname": "default_warehouse", "oldfieldtype": "Link", "options": "Warehouse", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_stock_item", "description": "", "fieldname": "tolerance", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Allow over delivery or receipt upto this percent", + "no_copy": 0, "oldfieldname": "tolerance", "oldfieldtype": "Currency", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_stock_item", "fieldname": "valuation_method", "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Valuation Method", + "no_copy": 0, "options": "\nFIFO\nMoving Average", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "0.00", "depends_on": "is_stock_item", "description": "", "fieldname": "min_order_qty", "fieldtype": "Float", "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Minimum Order Qty", + "no_copy": 0, "oldfieldname": "min_order_qty", "oldfieldtype": "Currency", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.is_stock_item", "fieldname": "warranty_period", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Warranty Period (in days)", + "no_copy": 0, "oldfieldname": "warranty_period", "oldfieldtype": "Data", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "2099-12-31", "depends_on": "is_stock_item", "fieldname": "end_of_life", "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "End of Life", + "no_copy": 0, "oldfieldname": "end_of_life", "oldfieldtype": "Date", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_stock_item", "description": "", "fieldname": "net_weight", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Net Weight", + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.is_stock_item", "fieldname": "weight_uom", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Weight UOM", + "no_copy": 0, "options": "UOM", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.is_stock_item", "description": "", "fieldname": "reorder_section", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Auto re-order", + "no_copy": 0, "options": "icon-rss", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:(doc.is_stock_item && !doc.apply_warehouse_wise_reorder_level)", "description": "Automatically create Material Request if quantity falls below this level", "fieldname": "re_order_level", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Re-order Level", + "no_copy": 0, "oldfieldname": "re_order_level", "oldfieldtype": "Currency", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:(doc.is_stock_item && !doc.apply_warehouse_wise_reorder_level)", "fieldname": "re_order_qty", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Re-order Qty", + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_stock_item", "fieldname": "apply_warehouse_wise_reorder_level", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Apply Warehouse-wise Reorder Level", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:(doc.is_stock_item && doc.apply_warehouse_wise_reorder_level)", "fieldname": "section_break_31", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:(doc.is_stock_item && doc.apply_warehouse_wise_reorder_level)", "description": "Will also apply for variants unless overrridden", "fieldname": "reorder_levels", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Warehouse-wise Reorder Levels", + "no_copy": 0, "options": "Item Reorder", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { - "depends_on": "eval:!doc.variant_of", + "allow_on_submit": 0, + "depends_on": "", "fieldname": "variants_section", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Variants", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "0", - "depends_on": "", + "depends_on": "eval:!doc.variant_of", "description": "If this item has variants, then it cannot be selected in sales orders etc.", "fieldname": "has_variants", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Has Variants", "no_copy": 1, "options": "", "permlevel": 0, "precision": "", - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { - "fieldname": "column_break_18", - "fieldtype": "Column Break", - "permlevel": 0, - "precision": "" - }, - { - "depends_on": "has_variants", - "fieldname": "manage_variants", - "fieldtype": "Button", - "label": "Manage Variants", - "permlevel": 0, - "precision": "" - }, - { - "fieldname": "section_break_20", - "fieldtype": "Section Break", - "permlevel": 0, - "precision": "" - }, - { - "depends_on": "variant_of", + "allow_on_submit": 0, + "depends_on": "", "fieldname": "attributes", "fieldtype": "Table", - "hidden": 0, + "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Attributes", "no_copy": 1, - "options": "Variant Attribute", + "options": "Item Variant Attribute", "permlevel": 0, "precision": "", - "read_only": 1 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "purchase_details", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Purchase Details", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-shopping-cart", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "1", "description": "", "fieldname": "is_purchase_item", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Is Purchase Item", + "no_copy": 0, "oldfieldname": "is_purchase_item", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_purchase_item", "description": "Average time taken by the supplier to deliver", "fieldname": "lead_time_days", "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Lead Time in days", "no_copy": 0, "oldfieldname": "lead_time_days", "oldfieldtype": "Int", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_purchase_item", "description": "", "fieldname": "buying_cost_center", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Default Buying Cost Center", + "no_copy": 0, "oldfieldname": "cost_center", "oldfieldtype": "Link", "options": "Cost Center", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_purchase_item", "description": "", "fieldname": "expense_account", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Default Expense Account", + "no_copy": 0, "oldfieldname": "purchase_account", "oldfieldtype": "Link", "options": "Account", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_purchase_item", "fieldname": "unit_of_measure_conversion", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Unit of Measure Conversion", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_purchase_item", "description": "Will also apply for variants", "fieldname": "uoms", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "UOMs", "no_copy": 1, "oldfieldname": "uom_conversion_details", "oldfieldtype": "Table", "options": "UOM Conversion Detail", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_purchase_item", "fieldname": "last_purchase_rate", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Last Purchase Rate", "no_copy": 1, "oldfieldname": "last_purchase_rate", "oldfieldtype": "Currency", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_purchase_item", "fieldname": "supplier_details", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Supplier Details", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.is_purchase_item", "fieldname": "default_supplier", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Default Supplier", + "no_copy": 0, "options": "Supplier", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.is_purchase_item", "fieldname": "manufacturer", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Manufacturer", + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.is_purchase_item", "fieldname": "manufacturer_part_no", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Manufacturer Part Number", + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_purchase_item", "fieldname": "column_break2", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Item Code for Suppliers", + "no_copy": 0, "oldfieldtype": "Column Break", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" }, { + "allow_on_submit": 0, "depends_on": "is_purchase_item", "fieldname": "supplier_items", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Supplier Items", + "no_copy": 0, "options": "Item Supplier", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "sales_details", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Sales Details", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-tag", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "1", "description": "", "fieldname": "is_sales_item", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Is Sales Item", + "no_copy": 0, "oldfieldname": "is_sales_item", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "", "depends_on": "eval:doc.is_sales_item", "description": "Allow in Sales Order of type \"Service\"", "fieldname": "is_service_item", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Is Service Item", + "no_copy": 0, "oldfieldname": "is_service_item", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "0", "description": "Publish Item to hub.erpnext.com", "fieldname": "publish_in_hub", "fieldtype": "Check", "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Publish in Hub", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "0", "fieldname": "synced_with_hub", "fieldtype": "Check", "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Synced With Hub", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_sales_item", "fieldname": "income_account", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Default Income Account", + "no_copy": 0, "options": "Account", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_sales_item", "fieldname": "selling_cost_center", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Default Selling Cost Center", + "no_copy": 0, "options": "Cost Center", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "is_sales_item", "fieldname": "column_break3", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Customer Item Codes", + "no_copy": 0, "oldfieldtype": "Column Break", "permlevel": 0, + "print_hide": 0, "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" }, { + "allow_on_submit": 0, "depends_on": "is_sales_item", "description": "", "fieldname": "customer_items", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Customer Items", + "no_copy": 0, "options": "Item Customer Detail", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:doc.is_sales_item", "fieldname": "max_discount", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Max Discount (%)", + "no_copy": 0, "oldfieldname": "max_discount", "oldfieldtype": "Currency", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "item_tax_section_break", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Item Tax", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-money", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "description": "Will also apply for variants", "fieldname": "taxes", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Taxes", + "no_copy": 0, "oldfieldname": "item_tax", "oldfieldtype": "Table", "options": "Item Tax", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "inspection_criteria", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Inspection Criteria", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-search", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "", "fieldname": "inspection_required", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Inspection Required", "no_copy": 0, "oldfieldname": "inspection_required", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "inspection_required", "description": "Will also apply to variants", "fieldname": "quality_parameters", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Quality Parameters", + "no_copy": 0, "oldfieldname": "item_specification_details", "oldfieldtype": "Table", "options": "Item Quality Inspection Parameter", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "manufacturing", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Manufacturing", + "no_copy": 0, "oldfieldtype": "Section Break", "options": "icon-cogs", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "", "depends_on": "", "description": "", "fieldname": "is_pro_applicable", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Allow Production Order", + "no_copy": 0, "oldfieldname": "is_pro_applicable", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "default": "", "description": "If subcontracted to a vendor", "fieldname": "is_sub_contracted_item", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Supply Raw Materials for Purchase", + "no_copy": 0, "oldfieldname": "is_sub_contracted_item", "oldfieldtype": "Select", "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "column_break_74", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "", "fieldname": "default_bom", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Default BOM", "no_copy": 1, "oldfieldname": "default_bom", "oldfieldtype": "Link", "options": "BOM", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "customer_code", "fieldtype": "Data", "hidden": 1, + "ignore_user_permissions": 0, "in_filter": 1, + "in_list_view": 0, "label": "Customer Code", "no_copy": 1, "permlevel": 0, "print_hide": 1, - "read_only": 0 + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "website_section", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Website", + "no_copy": 0, "options": "icon-globe", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "show_in_website", "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Show in Website", + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "description": "website page link", "fieldname": "page_name", "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Page Name", "no_copy": 1, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "description": "Items with higher weightage will be shown higher", "fieldname": "weightage", "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Weightage", + "no_copy": 0, "permlevel": 0, + "print_hide": 0, "read_only": 0, - "search_index": 1 + "report_hide": 0, + "reqd": 0, + "search_index": 1, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "description": "Show a slideshow at the top of the page", "fieldname": "slideshow", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Slideshow", + "no_copy": 0, "options": "Website Slideshow", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "description": "Item Image (if not slideshow)", "fieldname": "website_image", "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Image", + "no_copy": 0, "options": "", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "cb72", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.", "fieldname": "website_warehouse", "fieldtype": "Link", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Website Warehouse", + "no_copy": 0, "options": "Warehouse", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "description": "List this Item in multiple groups on the website.", "fieldname": "website_item_groups", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Website Item Groups", + "no_copy": 0, "options": "Website Item Group", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "fieldname": "sb72", "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "website_specifications_cb", "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Website Specifications", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "fieldname": "copy_from_item_group", "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Copy From Item Group", + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "fieldname": "website_specifications", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Website Specifications", + "no_copy": 0, "options": "Item Website Specification", "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "depends_on": "show_in_website", "fieldname": "web_long_description", "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Website Description", + "no_copy": 0, "permlevel": 0, - "read_only": 0 + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "parent_website_route", "fieldtype": "Read Only", + "hidden": 0, "ignore_user_permissions": 1, + "in_filter": 0, + "in_list_view": 0, "label": "Parent Website Route", "no_copy": 1, "options": "", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], + "hide_heading": 0, + "hide_toolbar": 0, "icon": "icon-tag", "idx": 1, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, "max_attachments": 1, - "modified": "2015-07-30 06:04:28.448050", + "modified": "2015-08-18 10:28:54.242793", "modified_by": "Administrator", "module": "Stock", "name": "Item", "owner": "Administrator", "permissions": [ { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, "create": 1, "delete": 1, "email": 1, + "export": 0, + "if_owner": 0, "import": 1, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Item Manager", + "set_user_permissions": 0, "share": 1, "submit": 0, "write": 1 }, { "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, "create": 0, "delete": 0, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Stock Manager", + "set_user_permissions": 0, + "share": 0, "submit": 0, "write": 0 }, { "amend": 0, "apply_user_permissions": 1, + "cancel": 0, "create": 0, "delete": 0, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Stock User", + "set_user_permissions": 0, + "share": 0, "submit": 0, "write": 0 }, { + "amend": 0, "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, + "print": 0, "read": 1, - "role": "Sales User" + "report": 0, + "role": "Sales User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 }, { + "amend": 0, "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, + "print": 0, "read": 1, - "role": "Purchase User" + "report": 0, + "role": "Purchase User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 }, { + "amend": 0, "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, + "print": 0, "read": 1, - "role": "Maintenance User" + "report": 0, + "role": "Maintenance User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 }, { + "amend": 0, "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, + "print": 0, "read": 1, - "role": "Accounts User" + "report": 0, + "role": "Accounts User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 }, { + "amend": 0, "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, + "print": 0, "read": 1, - "role": "Manufacturing User" + "report": 0, + "role": "Manufacturing User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 } ], + "read_only": 0, + "read_only_onload": 0, "search_fields": "item_name,description,item_group,customer_code", "title_field": "item_name" } diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index eaf904d1a87..cd3d295979a 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -3,16 +3,18 @@ from __future__ import unicode_literals import frappe +import json from frappe import msgprint, _ from frappe.utils import cstr, flt, cint, getdate, now_datetime, formatdate from frappe.website.website_generator import WebsiteGenerator from erpnext.setup.doctype.item_group.item_group import invalidate_cache_for, get_parent_item_groups from frappe.website.render import clear_cache from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow -from erpnext.stock.doctype.manage_variants.manage_variants import update_variant class WarehouseNotSet(frappe.ValidationError): pass class ItemTemplateCannotHaveStock(frappe.ValidationError): pass +class ItemVariantExistsError(frappe.ValidationError): pass +class InvalidItemAttributeValueError(frappe.ValidationError): pass class Item(WebsiteGenerator): website = frappe._dict( @@ -63,6 +65,8 @@ class Item(WebsiteGenerator): self.synced_with_hub = 0 self.validate_has_variants() self.validate_stock_for_template_must_be_zero() + self.validate_attributes() + self.validate_variant_attributes() if not self.get("__islocal"): self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group") @@ -298,7 +302,9 @@ class Item(WebsiteGenerator): updated = [] variants = frappe.db.get_all("Item", fields=["item_code"], filters={"variant_of": self.name }) for d in variants: - update_variant(self.name, d) + variant = frappe.get_doc("Item", d) + copy_attributes_to_variant(self, variant) + variant.save() updated.append(d.item_code) if updated: frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated))) @@ -315,7 +321,7 @@ class Item(WebsiteGenerator): or ifnull(reserved_qty, 0) > 0 or ifnull(indented_qty, 0) > 0 or ifnull(planned_qty, 0) > 0)""", self.name) if stock_in: frappe.throw(_("Item Template cannot have stock or Open Sales/Purchase/Production Orders."), ItemTemplateCannotHaveStock) - + def validate_uom(self): if not self.get("__islocal"): check_stock_uom_with_bin(self.name, self.stock_uom) @@ -327,6 +333,31 @@ class Item(WebsiteGenerator): if template_uom != self.stock_uom: frappe.throw(_("Default Unit of Measure for Variant must be same as Template")) + def validate_attributes(self): + if self.has_variants or self.variant_of: + attributes = [] + if not self.attributes: + frappe.throw(_("Attribute table is mandatory")) + for d in self.attributes: + if d.attribute in attributes: + frappe.throw(_("Attribute {0} selected multiple times in Attributes Table".format(d.attribute))) + else: + attributes.append(d.attribute) + + def validate_variant_attributes(self): + if self.variant_of: + args = {} + for d in self.attributes: + if not d.attribute_value: + frappe.throw(_("Please specify Attribute Value for attribute {0}").format(d.attribute)) + args[d.attribute] = d.attribute_value + + if self.get("__islocal"): + # test this during insert because naming is based on item_code and we cannot use condition like self.name != variant + variant = get_variant(self.variant_of, args) + if variant: + frappe.throw(_("Item variant {0} exists with same attributes").format(variant), ItemVariantExistsError) + def validate_end_of_life(item_code, end_of_life=None, verbose=1): if not end_of_life: end_of_life = frappe.db.get_value("Item", item_code, "end_of_life") @@ -458,3 +489,154 @@ def check_stock_uom_with_bin(item, stock_uom): frappe.throw(_("Default Unit of Measure for Item {0} cannot be changed directly because \ you have already made some transaction(s) with another UOM. To change default UOM, \ use 'UOM Replace Utility' tool under Stock module.").format(item)) + +@frappe.whitelist() +def get_variant(item, args): + """Validates Attributes and their Values, then looks for an exactly matching Item Variant + + :param item: Template Item + :param args: A dictionary with "Attribute" as key and "Attribute Value" as value + """ + if isinstance(args, basestring): + args = json.loads(args) + + if not args: + frappe.throw(_("Please specify at least one attribute in the Attributes table")) + + validate_item_variant_attributes(item, args) + + return find_variant(item, args) + +def validate_item_variant_attributes(item, args): + attribute_values = {} + for t in frappe.get_all("Item Attribute Value", fields=["parent", "attribute_value"], + filters={"parent": ["in", args.keys()]}): + (attribute_values.setdefault(t.parent, [])).append(t.attribute_value) + + numeric_attributes = frappe._dict((t.name, t) for t in frappe.get_list("Item Attribute", filters={"numeric_values":1, + "name": ["in", args.keys()]}, fields=["name", "from_range", "to_range", "increment"])) + + template_item = frappe.get_doc("Item", item) + template_item_attributes = frappe._dict((d.attribute, d) for d in template_item.attributes) + + for attribute, value in args.items(): + + if attribute in numeric_attributes: + numeric_attribute = numeric_attributes[attribute] + + from_range = numeric_attribute.from_range + to_range = numeric_attribute.to_range + increment = numeric_attribute.increment + + if increment == 0: + # defensive validation to prevent ZeroDivisionError + frappe.throw(_("Increment for Attribute {0} cannot be 0").format(attribute)) + + + if not ( (from_range <= flt(value) <= to_range) and (flt(value) - from_range) % increment == 0 ): + frappe.throw(_("Value for Attribute {0} must be within the range of {1} to {2} in the increments of {3}").format(attribute, from_range, to_range, increment), InvalidItemAttributeValueError) + + elif value not in attribute_values[attribute]: + frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values").format( + value, attribute)) + +def find_variant(item, args): + conditions = ["""(iv_attribute.attribute="{0}" and iv_attribute.attribute_value="{1}")"""\ + .format(frappe.db.escape(key), frappe.db.escape(cstr(value))) for key, value in args.items()] + + conditions = " or ".join(conditions) + + # use approximate match and shortlist possible variant matches + # it is approximate because we are matching using OR condition + # and it need not be exact match at this stage + # this uses a simpler query instead of using multiple exists conditions + possible_variants = frappe.db.sql_list("""select name from `tabItem` item + where variant_of=%s and exists ( + select name from `tabItem Variant Attribute` iv_attribute + where iv_attribute.parent=item.name + and ({conditions}) + )""".format(conditions=conditions), item) + + for variant in possible_variants: + variant = frappe.get_doc("Item", variant) + + if len(args.keys()) == len(variant.get("attributes")): + # has the same number of attributes and values + # assuming no duplication as per the validation in Item + match_count = 0 + + for attribute, value in args.items(): + for row in variant.attributes: + if row.attribute==attribute and row.attribute_value==value: + # this row matches + match_count += 1 + break + + if match_count == len(args.keys()): + return variant.name + +@frappe.whitelist() +def create_variant(item, args): + if isinstance(args, basestring): + args = json.loads(args) + + variant = frappe.new_doc("Item") + variant_attributes = [] + for d in args: + variant_attributes.append({ + "attribute": d, + "attribute_value": args[d] + }) + + variant.set("attributes", variant_attributes) + template = frappe.get_doc("Item", item) + copy_attributes_to_variant(template, variant) + make_variant_item_code(template, variant) + + return variant + +def copy_attributes_to_variant(item, variant): + from frappe.model import no_value_fields + for field in item.meta.fields: + if field.fieldtype not in no_value_fields and (not field.no_copy)\ + and field.fieldname not in ("item_code", "item_name"): + if variant.get(field.fieldname) != item.get(field.fieldname): + variant.set(field.fieldname, item.get(field.fieldname)) + variant.variant_of = item.name + variant.has_variants = 0 + variant.show_in_website = 0 + if variant.attributes: + variant.description += "\n" + for d in variant.attributes: + variant.description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" + +def make_variant_item_code(template, variant): + """Uses template's item code and abbreviations to make variant's item code""" + if variant.item_code: + return + + abbreviations = [] + for attr in variant.attributes: + item_attribute = frappe.db.sql("""select i.numeric_values, v.abbr + from `tabItem Attribute` i left join `tabItem Attribute Value` v + on (i.name=v.parent) + where i.name=%(attribute)s and v.attribute_value=%(attribute_value)s""", { + "attribute": attr.attribute, + "attribute_value": attr.attribute_value + }, as_dict=True) + + if not item_attribute: + # somehow an invalid item attribute got used + return + + if item_attribute[0].numeric_values: + # don't generate item code if one of the attributes is numeric + return + + abbreviations.append(item_attribute[0].abbr) + + if abbreviations: + variant.item_code = "{0}-{1}".format(template.item_code, "-".join(abbreviations)) + + if variant.item_code: + variant.item_name = variant.item_code diff --git a/erpnext/stock/doctype/item/item_list.js b/erpnext/stock/doctype/item/item_list.js index 6eaa4920ea8..46a22ea5d56 100644 --- a/erpnext/stock/doctype/item/item_list.js +++ b/erpnext/stock/doctype/item/item_list.js @@ -6,7 +6,7 @@ frappe.listview_settings['Item'] = { if(doc.end_of_life && doc.end_of_life < frappe.datetime.get_today()) { return [__("Expired"), "grey", "end_of_life,<,Today"] } else if(doc.has_variants) { - return [__("Template"), "blue", "has_variant,=,1"] + return [__("Template"), "blue", "has_variants,=,Yes"] } else if(doc.variant_of) { return [__("Variant"), "green", "variant_of,=," + doc.variant_of] } else { diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 9235becba1b..2ba96475bda 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -6,7 +6,8 @@ import unittest import frappe from frappe.test_runner import make_test_records -from erpnext.stock.doctype.item.item import WarehouseNotSet, ItemTemplateCannotHaveStock +from erpnext.stock.doctype.item.item import (WarehouseNotSet, ItemTemplateCannotHaveStock, create_variant, + ItemVariantExistsError, InvalidItemAttributeValueError) from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry test_ignore = ["BOM"] @@ -99,4 +100,58 @@ class TestItem(unittest.TestCase): for key, value in to_check.iteritems(): self.assertEquals(value, details.get(key)) + def test_make_item_variant(self): + frappe.delete_doc_if_exists("Item", "_Test Variant Item-L") + + variant = create_variant("_Test Variant Item", {"Test Size": "Large"}) + variant.save() + + # doing it again should raise error + variant = create_variant("_Test Variant Item", {"Test Size": "Large"}) + self.assertRaises(ItemVariantExistsError, variant.save) + + def test_make_item_variant_with_numeric_values(self): + # cleanup + frappe.delete_doc_if_exists("Item", "_Test Numeric Template Item") + frappe.delete_doc_if_exists("Item", "_Test Numeric Variant-L-1.5") + frappe.delete_doc_if_exists("Item Attribute", "Test Item Length") + + # make item attribute + frappe.get_doc({ + "doctype": "Item Attribute", + "attribute_name": "Test Item Length", + "numeric_values": 1, + "from_range": 0.0, + "to_range": 100.0, + "increment": 0.5 + }).insert() + + # make template item + make_item("_Test Numeric Template Item", { + "attributes": [ + {"attribute": "Test Size"}, + {"attribute": "Test Item Length"} + ], + "default_warehouse": "_Test Warehouse - _TC" + }) + + variant = create_variant("_Test Numeric Template Item", {"Test Size": "Large", "Test Item Length": 1.1}) + self.assertEquals(variant.item_code, None) + variant.item_code = "_Test Numeric Variant-L-1.1" + variant.item_name = "_Test Numeric Variant Large 1.1m" + self.assertRaises(InvalidItemAttributeValueError, variant.save) + + variant = create_variant("_Test Numeric Template Item", {"Test Size": "Large", "Test Item Length": 1.5}) + self.assertEquals(variant.item_code, None) + variant.item_code = "_Test Numeric Variant-L-1.5" + variant.item_name = "_Test Numeric Variant Large 1.5m" + variant.save() + +def make_item_variant(): + if not frappe.db.exists("Item", "_Test Variant Item-S"): + variant = create_variant("_Test Variant Item", """{"Test Size": "Small"}""") + variant.item_code = "_Test Variant Item-S" + variant.item_name = "_Test Variant Item-S" + variant.save() + test_records = frappe.get_test_records('Item') diff --git a/erpnext/stock/doctype/item/test_records.json b/erpnext/stock/doctype/item/test_records.json index 5dd63e38dec..f12c7cccf76 100644 --- a/erpnext/stock/doctype/item/test_records.json +++ b/erpnext/stock/doctype/item/test_records.json @@ -273,6 +273,11 @@ "item_name": "_Test Variant Item", "stock_uom": "_Test UOM", "has_variants": 1, + "attributes": [ + { + "attribute": "Test Size" + } + ], "apply_warehouse_wise_reorder_level": 1, "reorder_levels": [ { diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.json b/erpnext/stock/doctype/item_attribute/item_attribute.json index 1824fb68f50..d23fe4d4279 100644 --- a/erpnext/stock/doctype/item_attribute/item_attribute.json +++ b/erpnext/stock/doctype/item_attribute/item_attribute.json @@ -26,24 +26,173 @@ "report_hide": 0, "reqd": 1, "search_index": 0, - "set_only_once": 0 + "set_only_once": 0, + "unique": 0 }, { - "default": "1", - "description": "Lower the number, higher the priority in the Item Code suffix that will be created for this Item Attribute for the Item Variant", - "fieldname": "priority", - "fieldtype": "Int", - "label": "Priority", + "allow_on_submit": 0, + "default": "0", + "fieldname": "numeric_values", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Numeric Values", + "no_copy": 0, "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, + "depends_on": "numeric_values", + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "", + "fieldname": "from_range", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "From Range", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "", + "fieldname": "increment", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Increment", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "column_break_8", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "", + "fieldname": "to_range", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "To Range", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "eval: !doc.numeric_values", + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "", "fieldname": "item_attribute_values", "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Item Attribute Values", + "no_copy": 0, "options": "Item Attribute Value", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "hide_heading": 0, @@ -54,7 +203,7 @@ "is_submittable": 0, "issingle": 0, "istable": 0, - "modified": "2015-07-13 05:28:20.561939", + "modified": "2015-08-11 08:43:10.240847", "modified_by": "Administrator", "module": "Stock", "name": "Item Attribute", @@ -69,6 +218,7 @@ "delete": 1, "email": 0, "export": 0, + "if_owner": 0, "import": 0, "permlevel": 0, "print": 0, diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.py b/erpnext/stock/doctype/item_attribute/item_attribute.py index 171e1186f66..8310288e473 100644 --- a/erpnext/stock/doctype/item_attribute/item_attribute.py +++ b/erpnext/stock/doctype/item_attribute/item_attribute.py @@ -6,12 +6,28 @@ import frappe from frappe.model.document import Document from frappe import _ +class ItemAttributeIncrementError(frappe.ValidationError): pass + class ItemAttribute(Document): def validate(self): + self.validate_numeric() self.validate_duplication() self.validate_attribute_values() - + def validate_numeric(self): + if self.numeric_values: + self.set("item_attribute_values", []) + if self.from_range is None or self.to_range is None: + frappe.throw(_("Please specify from/to range")) + + elif self.from_range >= self.to_range: + frappe.throw(_("From Range has to be less than To Range")) + + if not self.increment: + frappe.throw(_("Increment cannot be 0"), ItemAttributeIncrementError) + else: + self.from_range = self.to_range = self.increment = 0 + def validate_duplication(self): values, abbrs = [], [] for d in self.item_attribute_values: @@ -23,14 +39,15 @@ class ItemAttribute(Document): if d.abbr in abbrs: frappe.throw(_("{0} must appear only once").format(d.abbr)) abbrs.append(d.abbr) - + def validate_attribute_values(self): attribute_values = [] for d in self.item_attribute_values: attribute_values.append(d.attribute_value) - - variant_attributes = frappe.db.sql("select DISTINCT attribute_value from `tabVariant Attribute` where attribute=%s", self.name) + + variant_attributes = frappe.db.sql("select DISTINCT attribute_value from `tabItem Variant Attribute` where attribute=%s", self.name) if variant_attributes: for d in variant_attributes: - if d[0] not in attribute_values: - frappe.throw(_("Attribute Value {0} cannot be removed from {1} as Item Variants exist with this Attribute.").format(d[0], self.name)) + if d[0] and d[0] not in attribute_values: + frappe.throw(_("Attribute Value {0} cannot be removed from {1} as Item Variants \ + exist with this Attribute.").format(d[0], self.name)) diff --git a/erpnext/stock/doctype/item_attribute/test_item_attribute.py b/erpnext/stock/doctype/item_attribute/test_item_attribute.py index 31b3b0a9776..6357b525697 100644 --- a/erpnext/stock/doctype/item_attribute/test_item_attribute.py +++ b/erpnext/stock/doctype/item_attribute/test_item_attribute.py @@ -6,5 +6,25 @@ import unittest test_records = frappe.get_test_records('Item Attribute') +from erpnext.stock.doctype.item_attribute.item_attribute import ItemAttributeIncrementError + class TestItemAttribute(unittest.TestCase): - pass + def setUp(self): + if frappe.db.exists("Item Attribute", "_Test_Length"): + frappe.delete_doc("Item Attribute", "_Test_Length") + + def test_numeric_item_attribute(self): + item_attribute = frappe.get_doc({ + "doctype": "Item Attribute", + "attribute_name": "_Test_Length", + "numeric_values": 1, + "from_range": 0.0, + "to_range": 100.0, + "increment": 0 + }) + + self.assertRaises(ItemAttributeIncrementError, item_attribute.save) + + item_attribute.increment = 0.5 + item_attribute.save() + diff --git a/erpnext/stock/doctype/manage_variants/__init__.py b/erpnext/stock/doctype/item_variant_attribute/__init__.py similarity index 100% rename from erpnext/stock/doctype/manage_variants/__init__.py rename to erpnext/stock/doctype/item_variant_attribute/__init__.py diff --git a/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.json b/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.json new file mode 100644 index 00000000000..7ab21e1e2ba --- /dev/null +++ b/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.json @@ -0,0 +1,217 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "", + "creation": "2015-05-19 05:12:30.344797", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Other", + "fields": [ + { + "allow_on_submit": 0, + "fieldname": "attribute", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Attribute", + "no_copy": 0, + "options": "Item Attribute", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "", + "fieldname": "attribute_value", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Attribute Value", + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "has_variants", + "fieldname": "numeric_values", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Numeric Values", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "numeric_values", + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "", + "fieldname": "from_range", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "From Range", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "", + "fieldname": "increment", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Increment", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "column_break_8", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "", + "fieldname": "to_range", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "To Range", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "", + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "modified": "2015-08-18 02:47:07.959104", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item Variant Attribute", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} diff --git a/erpnext/stock/doctype/manage_variants_item/manage_variants_item.py b/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.py similarity index 87% rename from erpnext/stock/doctype/manage_variants_item/manage_variants_item.py rename to erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.py index 800888a864d..d1a1eb54a5d 100644 --- a/erpnext/stock/doctype/manage_variants_item/manage_variants_item.py +++ b/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.py @@ -6,5 +6,5 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document -class ManageVariantsItem(Document): +class ItemVariantAttribute(Document): pass diff --git a/erpnext/stock/doctype/manage_variants/manage_variants.js b/erpnext/stock/doctype/manage_variants/manage_variants.js deleted file mode 100644 index edbfcd269ad..00000000000 --- a/erpnext/stock/doctype/manage_variants/manage_variants.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt - -frappe.ui.form.on("Manage Variants", { - onload: function(frm) { - var df = frappe.meta.get_docfield("Variant Attribute", "attribute_value", "Manage Variants"); - df.on_make = function(field) { - $(field.input_area).addClass("ui-front"); - field.$input.autocomplete({ - minLength: 0, - minChars: 0, - source: function(request, response) { - frappe.call({ - method:"frappe.client.get_list", - args:{ - doctype:"Item Attribute Value", - filters: [ - ["parent","=", field.doc.attribute], - ["attribute_value", "like", request.term + "%"] - ], - fields: ["attribute_value"] - }, - callback: function(r) { - response($.map(r.message, function(d) { return d.attribute_value; })); - } - }); - }, - select: function(event, ui) { - field.$input.val(ui.item.value); - field.$input.trigger("change"); - } - }); - } - }, - - refresh: function(frm) { - frm.disable_save(); - frm.page.set_primary_action(__("Create Variants"), function() { - frappe.call({ - method: "create_variants", - doc:frm.doc - }) - }); - }, - - onload_post_render: function(frm) { - frm.get_field("variants").grid.cannot_add_rows = true; - }, - - item_code:function(frm) { - return frappe.call({ - method: "get_item_details", - doc:frm.doc, - callback: function(r) { - refresh_field('attributes'); - refresh_field('variants'); - } - }) - } -}); diff --git a/erpnext/stock/doctype/manage_variants/manage_variants.json b/erpnext/stock/doctype/manage_variants/manage_variants.json deleted file mode 100644 index ff4f4367ef7..00000000000 --- a/erpnext/stock/doctype/manage_variants/manage_variants.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 0, - "allow_rename": 0, - "creation": "2015-05-19 05:39:59.345901", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "fields": [ - { - "fieldname": "item_code", - "fieldtype": "Link", - "label": "Item Code", - "options": "Item", - "permlevel": 0, - "precision": "", - "reqd": 1 - }, - { - "fieldname": "section_break_2", - "fieldtype": "Section Break", - "label": "Item Variant Attributes", - "permlevel": 0, - "precision": "" - }, - { - "allow_on_submit": 0, - "fieldname": "attributes", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Attributes", - "no_copy": 0, - "options": "Variant Attribute", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0 - }, - { - "fieldname": "generate_combinations", - "fieldtype": "Button", - "label": "Generate Combinations", - "options": "generate_combinations", - "permlevel": 0, - "precision": "" - }, - { - "fieldname": "section_break_4", - "fieldtype": "Section Break", - "label": "Item Variants", - "permlevel": 0, - "precision": "" - }, - { - "fieldname": "variants", - "fieldtype": "Table", - "label": "Variants", - "options": "Manage Variants Item", - "permlevel": 0, - "precision": "" - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "in_create": 1, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 1, - "istable": 0, - "modified": "2015-07-13 05:28:29.057918", - "modified_by": "Administrator", - "module": "Stock", - "name": "Manage Variants", - "name_case": "", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 0, - "role": "Item Manager", - "share": 1, - "write": 1 - } - ], - "read_only": 1, - "read_only_onload": 0, - "sort_field": "modified", - "sort_order": "DESC" -} \ No newline at end of file diff --git a/erpnext/stock/doctype/manage_variants/manage_variants.py b/erpnext/stock/doctype/manage_variants/manage_variants.py deleted file mode 100644 index 4dcfb22dac5..00000000000 --- a/erpnext/stock/doctype/manage_variants/manage_variants.py +++ /dev/null @@ -1,207 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe import _ -from frappe.model.document import Document -import copy -import json - -class DuplicateAttribute(frappe.ValidationError): pass - -class ManageVariants(Document): - - def get_item_details(self): - self.clear_tables() - if self.item_code: - self.get_attributes() - self.get_variants() - - def generate_combinations(self): - self.validate_attributes() - self.validate_template_item() - self.validate_attribute_values() - self.validate_attributes_are_unique() - self.get_variant_item_codes() - - def create_variants(self): - self.sync_variants() - - def clear_tables(self): - self.set('attributes', []) - self.set('variants', []) - - def get_attributes(self): - attributes = {} - self.set('attributes', []) - for d in frappe.db.sql("""select attr.attribute, attr.attribute_value from `tabVariant Attribute` as attr, - `tabItem` as item where attr.parent = item.name and item.variant_of = %s""", self.item_code, as_dict=1): - attributes.setdefault(d.attribute, []).append(d.attribute_value) - for d in attributes: - attribute_values = set(attributes[d]) - for value in attribute_values: - self.append('attributes',{"attribute": d, "attribute_value": value}) - - def get_variants(self): - variants = [d.name for d in frappe.get_all("Item", - filters={"variant_of":self.item_code})] - data = frappe.db.sql("""select parent, attribute, attribute_value from `tabVariant Attribute`""", as_dict=1) - for d in variants: - variant_attributes, attributes = "", [] - for attribute in data: - if attribute.parent == d: - variant_attributes += attribute.attribute_value + " | " - attributes.append([attribute.attribute, attribute.attribute_value]) - self.append('variants',{"variant": d, "variant_attributes": variant_attributes[: -3], "attributes": json.dumps(attributes)}) - - def validate_attributes(self): - if not self.attributes: - frappe.throw(_("Enter atleast one Attribute & its Value in Attribute table.")) - - def validate_template_item(self): - if not frappe.db.get_value("Item", self.item_code, "has_variants"): - frappe.throw(_("Selected Item cannot have Variants.")) - - if frappe.db.get_value("Item", self.item_code, "variant_of"): - frappe.throw(_("Item cannot be a variant of a variant")) - - def validate_attribute_values(self): - attributes = {} - for t in frappe.db.get_all("Item Attribute Value", fields=["parent", "attribute_value"]): - attributes.setdefault(t.parent, []).append(t.attribute_value) - - for d in self.attributes: - if d.attribute_value not in attributes.get(d.attribute): - frappe.throw(_("Attribute value {0} does not exist in Item Attribute Master.").format(d.attribute_value)) - - def validate_attributes_are_unique(self): - attributes = [] - for d in self.attributes: - key = (d.attribute, d.attribute_value) - if key in attributes: - frappe.throw(_("{0} {1} is entered more than once in Attributes table") - .format(d.attribute, d.attribute_value), DuplicateAttribute) - attributes.append(key) - - def get_variant_item_codes(self): - """Get all possible suffixes for variants""" - variant_dict = {} - self.set('variants', []) - - for d in self.attributes: - variant_dict.setdefault(d.attribute, []).append(d.attribute_value) - - all_attributes = [d.name for d in frappe.get_all("Item Attribute", order_by = "priority asc")] - - # sort attributes by their priority - attributes = filter(None, map(lambda d: d if d in variant_dict else None, all_attributes)) - - def add_attribute_suffixes(item_code, my_attributes, attributes): - attr = frappe.get_doc("Item Attribute", attributes[0]) - for value in attr.item_attribute_values: - if value.attribute_value in variant_dict[attr.name]: - _my_attributes = copy.deepcopy(my_attributes) - _my_attributes.append([attr.name, value.attribute_value]) - if len(attributes) > 1: - add_attribute_suffixes(item_code + "-" + value.abbr, _my_attributes, attributes[1:]) - else: - variant_attributes = "" - for d in _my_attributes: - variant_attributes += d[1] + " | " - self.append('variants', {"variant": item_code + "-" + value.abbr, - "attributes": json.dumps(_my_attributes), "variant_attributes": variant_attributes[: -3]}) - add_attribute_suffixes(self.item_code, [], attributes) - - def sync_variants(self): - variant_item_codes = [] - item_variants_attributes = {} - inserted, updated, old_variant_name, new_variant_name, deleted = [], [], [], [], [] - - for v in self.variants: - variant_item_codes.append(v.variant) - - existing_variants = [d.name for d in frappe.get_all("Item", - filters={"variant_of":self.item_code})] - - for d in existing_variants: - attributes = [] - for attribute in frappe.db.sql("""select attribute, attribute_value from `tabVariant Attribute` where parent = %s""", d): - attributes.append([attribute[0], attribute[1]]) - item_variants_attributes.setdefault(d, []).append(attributes) - - for existing_variant in existing_variants: - if existing_variant not in variant_item_codes: - att = item_variants_attributes[existing_variant][0] - for variant in self.variants: - if sorted(json.loads(variant.attributes) ,key=lambda x: x[0]) == \ - sorted(att ,key=lambda x: x[0]): - rename_variant(existing_variant, variant.variant) - old_variant_name.append(existing_variant) - new_variant_name.append(variant.variant) - - if existing_variant not in old_variant_name: - delete_variant(existing_variant) - deleted.append(existing_variant) - - for item_code in variant_item_codes: - if item_code not in existing_variants: - if item_code not in new_variant_name: - make_variant(self.item_code, item_code, self.variants) - inserted.append(item_code) - else: - update_variant(self.item_code, item_code, self.variants) - updated.append(item_code) - - if inserted: - frappe.msgprint(_("Item Variants {0} created").format(", ".join(inserted))) - - if updated: - frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated))) - - if old_variant_name: - frappe.msgprint(_("Item Variants {0} renamed").format(", ".join(old_variant_name))) - - if deleted: - frappe.msgprint(_("Item Variants {0} deleted").format(", ".join(deleted))) - -def make_variant(item, variant_code, variant_attribute): - variant = frappe.new_doc("Item") - variant.item_code = variant_code - copy_attributes_to_variant(item, variant, variant_attribute, insert=True) - variant.insert() - -def update_variant(item, variant_code, variant_attribute=None): - variant = frappe.get_doc("Item", variant_code) - copy_attributes_to_variant(item, variant, variant_attribute, insert=True) - variant.save() - -def rename_variant(old_variant_code, new_variant_code): - frappe.rename_doc("Item", old_variant_code, new_variant_code) - -def delete_variant(variant_code): - frappe.delete_doc("Item", variant_code) - -def copy_attributes_to_variant(item, variant, variant_attribute=None, insert=False): - template = frappe.get_doc("Item", item) - from frappe.model import no_value_fields - for field in template.meta.fields: - if field.fieldtype not in no_value_fields and (insert or not field.no_copy)\ - and field.fieldname not in ("item_code", "item_name"): - if variant.get(field.fieldname) != template.get(field.fieldname): - variant.set(field.fieldname, template.get(field.fieldname)) - variant.item_name = template.item_name + variant.item_code[len(template.name):] - variant.variant_of = template.name - variant.has_variants = 0 - variant.show_in_website = 0 - if variant_attribute: - for d in variant_attribute: - if d.variant == variant.item_code: - variant.attributes= [] - for a in json.loads(d.attributes): - variant.append('attributes', {"attribute": a[0], "attribute_value": a[1]}) - if variant.attributes: - variant.description += "\n" - for d in variant.attributes: - variant.description += "" + d.attribute + ": " + d.attribute_value + "
" \ No newline at end of file diff --git a/erpnext/stock/doctype/manage_variants/test_manage_variants.py b/erpnext/stock/doctype/manage_variants/test_manage_variants.py deleted file mode 100644 index 6aa7f832f19..00000000000 --- a/erpnext/stock/doctype/manage_variants/test_manage_variants.py +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import unittest -import frappe - -from erpnext.stock.doctype.manage_variants.manage_variants import DuplicateAttribute - -class TestManageVariants(unittest.TestCase): - def test_variant_item_codes(self): - manage_variant = frappe.new_doc("Manage Variants") - manage_variant.update({ - "item_code": "_Test Variant Item", - "attributes": [ - { - "attribute": "Test Size", - "attribute_value": "Small" - }, - { - "attribute": "Test Size", - "attribute_value": "Large" - } - ] - }) - manage_variant.generate_combinations() - self.assertEqual(manage_variant.variants[0].variant, "_Test Variant Item-S") - self.assertEqual(manage_variant.variants[1].variant, "_Test Variant Item-L") - - self.assertEqual(manage_variant.variants[0].variant_attributes, "Small") - self.assertEqual(manage_variant.variants[1].variant_attributes, "Large") - manage_variant.create_variants() - - def test_attributes_are_unique(self): - manage_variant = frappe.new_doc("Manage Variants") - manage_variant.update({ - "item_code": "_Test Variant Item", - "attributes": [ - { - "attribute": "Test Size", - "attribute_value": "Small" - }, - { - "attribute": "Test Size", - "attribute_value": "Small" - } - ] - }) - self.assertRaises(DuplicateAttribute, manage_variant.generate_combinations) diff --git a/erpnext/stock/doctype/manage_variants_item/__init__.py b/erpnext/stock/doctype/manage_variants_item/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/stock/doctype/manage_variants_item/manage_variants_item.json b/erpnext/stock/doctype/manage_variants_item/manage_variants_item.json deleted file mode 100644 index a8bb61d5e48..00000000000 --- a/erpnext/stock/doctype/manage_variants_item/manage_variants_item.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 1, - "allow_rename": 0, - "autoname": "", - "creation": "2015-05-19 05:55:31.155672", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Other", - "fields": [ - { - "allow_on_submit": 0, - "fieldname": "variant", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Variant", - "no_copy": 0, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0 - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break", - "permlevel": 0, - "precision": "" - }, - { - "fieldname": "variant_attributes", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Variant Attributes", - "permlevel": 0, - "precision": "", - "read_only": 1 - }, - { - "fieldname": "attributes", - "fieldtype": "Text", - "hidden": 1, - "label": "attributes", - "permlevel": 0, - "precision": "", - "read_only": 1 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "", - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "modified": "2015-06-30 03:19:07.548196", - "modified_by": "Administrator", - "module": "Stock", - "name": "Manage Variants Item", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "read_only": 0, - "read_only_onload": 0, - "sort_field": "modified", - "sort_order": "DESC" -} \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index 165c4741d99..bf3c9766b10 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -1178,7 +1178,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2015-08-07 12:28:35.832492", + "modified": "2015-08-12 08:51:07.002600", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry", diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index f00a235fa76..174bc1a6df4 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -64,24 +64,13 @@ class TestStockEntry(unittest.TestCase): self.assertEqual([[1, 20],[1, 30]], eval(sle.stock_queue)) frappe.db.set_default("allow_negative_stock", 0) - + def test_auto_material_request(self): + from erpnext.stock.doctype.item.test_item import make_item_variant + make_item_variant() self._test_auto_material_request("_Test Item") - - def test_auto_material_request_for_variant(self): - manage_variant = frappe.new_doc("Manage Variants") - manage_variant.update({ - "item_code": "_Test Variant Item", - "attributes": [ - { - "attribute": "Test Size", - "attribute_value": "Small" - } - ] - }) - manage_variant.generate_combinations() - manage_variant.create_variants() + def test_auto_material_request_for_variant(self): self._test_auto_material_request("_Test Variant Item-S") def _test_auto_material_request(self, item_code): diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json index fe8a1b15bea..62c2a782e93 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json @@ -828,7 +828,7 @@ "is_submittable": 0, "issingle": 0, "istable": 1, - "modified": "2015-08-07 13:21:23.840052", + "modified": "2015-08-12 08:51:15.789056", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry Detail", diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json index a6dc6d485dd..cd6043d41ce 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.json +++ b/erpnext/stock/doctype/stock_settings/stock_settings.json @@ -311,7 +311,7 @@ "is_submittable": 0, "issingle": 1, "istable": 0, - "modified": "2015-08-03 13:00:36.082986", + "modified": "2015-08-12 08:51:24.798096", "modified_by": "Administrator", "module": "Stock", "name": "Stock Settings", diff --git a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.json b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.json index 3747f5c449f..365abaae362 100644 --- a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.json +++ b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.json @@ -1,78 +1,168 @@ { + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, "creation": "2013-01-10 16:34:30", + "custom": 0, "docstatus": 0, "doctype": "DocType", "fields": [ { + "allow_on_submit": 0, "fieldname": "item_code", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Item", + "no_copy": 0, "options": "Item", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "current_stock_uom", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Current Stock UOM", + "no_copy": 0, "options": "UOM", "permlevel": 0, - "read_only": 1 + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "new_stock_uom", "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "New Stock UOM", + "no_copy": 0, "options": "UOM", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "conversion_factor", "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Conversion Factor", - "permlevel": 0 + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 }, { + "allow_on_submit": 0, "fieldname": "update", "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, "label": "Update", + "no_copy": 0, "options": "update_stock_uom", - "permlevel": 0 + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], + "hide_heading": 0, + "hide_toolbar": 0, "icon": "icon-magic", "idx": 1, "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, "issingle": 1, - "modified": "2015-07-13 05:28:25.689187", + "istable": 0, + "modified": "2015-08-12 08:52:09.322664", "modified_by": "Administrator", "module": "Stock", "name": "Stock UOM Replace Utility", "owner": "Administrator", "permissions": [ { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, "create": 1, + "delete": 0, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 0, "role": "Item Manager", + "set_user_permissions": 0, "share": 1, "submit": 0, "write": 1 }, { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, "create": 1, + "delete": 0, "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, "permlevel": 0, "print": 1, "read": 1, "report": 0, "role": "Stock Manager", + "set_user_permissions": 0, "share": 1, "submit": 0, "write": 1 } ], - "read_only": 0 + "read_only": 0, + "read_only_onload": 0 } \ No newline at end of file diff --git a/erpnext/stock/doctype/variant_attribute/__init__.py b/erpnext/stock/doctype/variant_attribute/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/stock/doctype/variant_attribute/variant_attribute.json b/erpnext/stock/doctype/variant_attribute/variant_attribute.json deleted file mode 100644 index 5ab3d73239e..00000000000 --- a/erpnext/stock/doctype/variant_attribute/variant_attribute.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 1, - "allow_rename": 0, - "autoname": "", - "creation": "2015-05-19 05:12:30.344797", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Other", - "fields": [ - { - "allow_on_submit": 0, - "fieldname": "attribute", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Attribute", - "no_copy": 0, - "options": "Item Attribute", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0 - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break", - "permlevel": 0, - "precision": "" - }, - { - "allow_on_submit": 0, - "fieldname": "attribute_value", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Attribute Value", - "no_copy": 0, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "", - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "modified": "2015-05-20 06:16:16.803578", - "modified_by": "Administrator", - "module": "Stock", - "name": "Variant Attribute", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "read_only": 0, - "read_only_onload": 0, - "sort_field": "modified", - "sort_order": "DESC" -} \ No newline at end of file diff --git a/erpnext/stock/doctype/variant_attribute/variant_attribute.py b/erpnext/stock/doctype/variant_attribute/variant_attribute.py deleted file mode 100644 index 9c35732bf2f..00000000000 --- a/erpnext/stock/doctype/variant_attribute/variant_attribute.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document - -class VariantAttribute(Document): - pass diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index a57dd59974b..d08c63c255e 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -50,7 +50,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_profiles_item_details(args.company, args)) + out.update(get_pos_profile_item_details(args.company, args)) # update args with out, if key or value not exists for key, value in out.iteritems(): @@ -284,16 +284,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_profiles_item_details(company, args, pos_profiles=None): +def get_pos_profile_item_details(company, args, pos_profile=None): res = frappe._dict() - if not pos_profiles: - pos_profiles = get_pos_profiles(company) + if not pos_profile: + pos_profile = get_pos_profile(company) - if pos_profiles: + if pos_profile: for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"): - if not args.get(fieldname) and pos_profiles.get(fieldname): - res[fieldname] = pos_profiles.get(fieldname) + if not args.get(fieldname) and pos_profile.get(fieldname): + res[fieldname] = pos_profile.get(fieldname) if res.get("warehouse"): res.actual_qty = get_available_qty(args.item_code, @@ -301,15 +301,16 @@ def get_pos_profiles_item_details(company, args, pos_profiles=None): return res -def get_pos_profiles(company): - pos_profiles = frappe.db.sql("""select * from `tabPOS Profile` where user = %s +@frappe.whitelist() +def get_pos_profile(company): + pos_profile = frappe.db.sql("""select * from `tabPOS Profile` where user = %s and company = %s""", (frappe.session['user'], company), as_dict=1) - if not pos_profiles: - pos_profiles = frappe.db.sql("""select * from `tabPOS Profile` + if not pos_profile: + pos_profile = frappe.db.sql("""select * from `tabPOS Profile` where ifnull(user,'') = '' and company = %s""", company, as_dict=1) - return pos_profiles and pos_profiles[0] or None + return pos_profile and pos_profile[0] or None def get_serial_nos_by_fifo(args, item_doc): diff --git a/erpnext/utilities/doctype/note/note.py b/erpnext/utilities/doctype/note/note.py deleted file mode 100644 index d81363cfb9b..00000000000 --- a/erpnext/utilities/doctype/note/note.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe import _ -from frappe.model.document import Document - -class Note(Document): - def autoname(self): - # replace forbidden characters - import re - self.name = re.sub("[%'\"#*?`]", "", self.title.strip()) - - def before_print(self): - self.print_heading = self.name - self.sub_heading = "" - -def get_permission_query_conditions(user): - if not user: user = frappe.session.user - - if user == "Administrator": - return "" - - return "`tabNote`.public=1" - -def has_permission(doc, ptype, user): - if doc.public == 1 or user == "Administrator": - return True - - if user == doc.owner: - return True - - note_user_map = dict((d.user, d) for d in doc.get("share_with")) - if user in note_user_map: - if ptype == "read": - return True - elif note_user_map.get(user).permission == "Edit": - return True - - return False diff --git a/setup.py b/setup.py index c624e0e4442..5c92ec0b41a 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "5.6.4" +version = "5.7.0" with open("requirements.txt", "r") as f: install_requires = f.readlines()