diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js index dd20632a65..ffb6d5e597 100644 --- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js +++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js @@ -10,6 +10,14 @@ frappe.ui.form.on('Accounting Dimension', { }); } + frm.set_query('document_type', () => { + return { + filters: { + name: ['not in', ['Accounting Dimension', 'Project', 'Cost Center']] + } + }; + }); + let button = frm.doc.disabled ? "Enable" : "Disable"; frm.add_custom_button(__(button), function() { @@ -33,10 +41,10 @@ frappe.ui.form.on('Accounting Dimension', { document_type: function(frm) { frm.set_value('label', frm.doc.document_type); - frm.set_value('fieldname', frappe.scrub(frm.doc.document_type)); + frm.set_value('fieldname', frappe.model.scrub(frm.doc.document_type)); frappe.db.get_value('Accounting Dimension', {'document_type': frm.doc.document_type}, 'document_type', (r) => { - if (r.document_type) { + if (r && r.document_type) { frm.set_df_property('document_type', 'description', "Document type is already set as dimension"); } }); diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json index 57543a0ef4..6a4dc5c34f 100644 --- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json +++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json @@ -38,6 +38,7 @@ "default": "0", "fieldname": "disabled", "fieldtype": "Check", + "hidden": 1, "label": "Disable", "read_only": 1 }, @@ -54,7 +55,7 @@ "label": "Mandatory For Profit and Loss Account" } ], - "modified": "2019-07-07 18:56:19.517450", + "modified": "2019-07-14 17:25:01.307948", "modified_by": "Administrator", "module": "Accounts", "name": "Accounting Dimension", diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py index 15ace7239e..314849847c 100644 --- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py @@ -155,7 +155,7 @@ def get_doctypes_with_dimensions(): return doclist def get_accounting_dimensions(as_list=True): - accounting_dimensions = frappe.get_all("Accounting Dimension", fields=["label", "fieldname", "mandatory_for_pl", "mandatory_for_bs", "disabled"]) + accounting_dimensions = frappe.get_all("Accounting Dimension", fields=["label", "fieldname", "mandatory_for_pl", "mandatory_for_bs", "disabled"], filters={"disabled": 0}) if as_list: return [d.fieldname for d in accounting_dimensions] diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py index c543225444..84276eae10 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py @@ -91,13 +91,13 @@ class GLEntry(Document): if account_type == "Profit and Loss" \ and dimension.mandatory_for_pl and not dimension.disabled: if not self.get(dimension.fieldname): - frappe.throw(_("{0} is required for 'Profit and Loss' account {1}.") + frappe.throw(_("Accounting Dimension {0} is required for 'Profit and Loss' account {1}.") .format(dimension.label, self.account)) if account_type == "Balance Sheet" \ and dimension.mandatory_for_bs and not dimension.disabled: if not self.get(dimension.fieldname): - frappe.throw(_("{0} is required for 'Balance Sheet' account {1}.") + frappe.throw(_("Accounting Dimension {0} is required for 'Balance Sheet' account {1}.") .format(dimension.label, self.account)) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 699f04675f..368389807d 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -601,7 +601,7 @@ def get_outstanding_reference_documents(args): condition += " and company = {0}".format(frappe.db.escape(args.get("company"))) outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"), - args.get("party_account"), filters=args, condition=condition, limit=100) + args.get("party_account"), filters=args, condition=condition) for d in outstanding_invoices: d["exchange_rate"] = 1 diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 3e013f5d6b..e2f99d6ea3 100755 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -451,6 +451,10 @@ def make_customer_and_address(customers): def add_customer(data): + customer = data.get('full_name') or data.get('customer') + if frappe.db.exists("Customer", customer.strip()): + return customer.strip() + customer_doc = frappe.new_doc('Customer') customer_doc.customer_name = data.get('full_name') or data.get('customer') customer_doc.customer_pos_id = data.get('customer_pos_id') diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js index f6a561f04f..cfcc575718 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.js +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js @@ -88,6 +88,12 @@ frappe.query_reports["Accounts Payable"] = { } } }, + { + "fieldname":"payment_terms_template", + "label": __("Payment Terms Template"), + "fieldtype": "Link", + "options": "Payment Terms Template" + }, { "fieldname":"supplier_group", "label": __("Supplier Group"), diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js index ec4f0c983f..006068a266 100644 --- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js +++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js @@ -77,6 +77,12 @@ frappe.query_reports["Accounts Payable Summary"] = { "fieldtype": "Link", "options": "Supplier" }, + { + "fieldname":"payment_terms_template", + "label": __("Payment Terms Template"), + "fieldtype": "Link", + "options": "Payment Terms Template" + }, { "fieldname":"supplier_group", "label": __("Supplier Group"), diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 0cda2c15dd..ecf149b335 100755 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -541,6 +541,10 @@ class ReceivablePayableReport(object): where supplier_group=%s)""") values.append(self.filters.get("supplier_group")) + if self.filters.get("payment_terms_template"): + conditions.append("party in (select name from tabSupplier where payment_terms=%s)") + values.append(self.filters.get("payment_terms_template")) + if self.filters.get("cost_center"): lft, rgt = frappe.get_cached_value("Cost Center", self.filters.get("cost_center"), ['lft', 'rgt']) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index e75dd957db..8f1dfbc26e 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -104,6 +104,9 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company # get balance of all entries that exist date = nowdate() + if account: + acc = frappe.get_doc("Account", account) + try: year_start_date = get_fiscal_year(date, verbose=0)[1] except FiscalYearError: @@ -118,7 +121,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company allow_cost_center_in_entry_of_bs_account = get_allow_cost_center_in_entry_of_bs_account() - if cost_center and allow_cost_center_in_entry_of_bs_account: + if cost_center and (allow_cost_center_in_entry_of_bs_account or acc.report_type =='Profit and Loss'): cc = frappe.get_doc("Cost Center", cost_center) if cc.is_group: cond.append(""" exists ( @@ -132,20 +135,13 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company if account: - acc = frappe.get_doc("Account", account) - if not frappe.flags.ignore_account_permission: acc.check_permission("read") - - if not allow_cost_center_in_entry_of_bs_account and acc.report_type == 'Profit and Loss': + if acc.report_type == 'Profit and Loss': # for pl accounts, get balance within a fiscal year cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \ % year_start_date) - elif allow_cost_center_in_entry_of_bs_account: - # for all accounts, get balance within a fiscal year if maintain cost center in balance account is checked - cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \ - % year_start_date) # different filter for group and ledger - improved performance if acc.is_group: cond.append("""exists ( @@ -734,7 +730,6 @@ def get_children(doctype, parent, company, is_root=False): parent_fieldname = 'parent_' + doctype.lower().replace(' ', '_') fields = [ 'name as value', - 'root_type', 'is_group as expandable' ] filters = [['docstatus', '<', 2]] @@ -742,11 +737,11 @@ def get_children(doctype, parent, company, is_root=False): filters.append(['ifnull(`{0}`,"")'.format(parent_fieldname), '=', '' if is_root else parent]) if is_root: - fields += ['report_type', 'account_currency'] if doctype == 'Account' else [] + fields += ['root_type', 'report_type', 'account_currency'] if doctype == 'Account' else [] filters.append(['company', '=', company]) else: - fields += ['account_currency'] if doctype == 'Account' else [] + fields += ['root_type', 'account_currency'] if doctype == 'Account' else [] fields += [parent_fieldname + ' as parent'] acc = frappe.get_list(doctype, fields=fields, filters=filters) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 8e1510a836..8d24e7a316 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -323,7 +323,7 @@ class calculate_taxes_and_totals(object): self._set_in_company_currency(self.doc, ["total_taxes_and_charges", "rounding_adjustment"]) if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]: - self.doc.base_grand_total = flt(self.doc.grand_total * self.doc.conversion_rate) \ + self.doc.base_grand_total = flt(self.doc.grand_total * self.doc.conversion_rate, self.doc.precision("base_grand_total")) \ if self.doc.total_taxes_and_charges else self.doc.base_net_total else: self.doc.taxes_and_charges_added = self.doc.taxes_and_charges_deducted = 0.0 diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index 9dcd0c493a..90a12b7dbd 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -19,6 +19,10 @@ frappe.ui.form.on("Opportunity", { } } }); + + if (frm.doc.opportunity_from && frm.doc.party_name){ + frm.trigger('set_contact_link'); + } }, onload_post_render: function(frm) { diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 0fb94e73a0..a7162933bf 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -594,7 +594,6 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite bom_item.idx, item.item_name, sum(bom_item.{qty_field}/ifnull(bom.quantity, 1)) * %(qty)s as qty, - item.description, item.image, bom.project, item.stock_uom, @@ -623,17 +622,22 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite where_conditions="", is_stock_item=is_stock_item, qty_field="stock_qty", - select_columns = """, bom_item.source_warehouse, bom_item.operation, bom_item.include_item_in_manufacturing, + select_columns = """, bom_item.source_warehouse, bom_item.operation, + bom_item.include_item_in_manufacturing, bom_item.description, (Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s limit 1) as idx""") items = frappe.db.sql(query, { "parent": bom, "qty": qty, "bom": bom, "company": company }, as_dict=True) elif fetch_scrap_items: - query = query.format(table="BOM Scrap Item", where_conditions="", select_columns=", bom_item.idx", is_stock_item=is_stock_item, qty_field="stock_qty") + query = query.format(table="BOM Scrap Item", where_conditions="", + select_columns=", bom_item.idx, item.description", is_stock_item=is_stock_item, qty_field="stock_qty") + items = frappe.db.sql(query, { "qty": qty, "bom": bom, "company": company }, as_dict=True) else: query = query.format(table="BOM Item", where_conditions="", is_stock_item=is_stock_item, qty_field="stock_qty" if fetch_qty_in_stock_uom else "qty", - select_columns = ", bom_item.uom, bom_item.conversion_factor, bom_item.source_warehouse, bom_item.idx, bom_item.operation, bom_item.include_item_in_manufacturing") + select_columns = """, bom_item.uom, bom_item.conversion_factor, bom_item.source_warehouse, + bom_item.idx, bom_item.operation, bom_item.include_item_in_manufacturing, + bom_item.description """) items = frappe.db.sql(query, { "qty": qty, "bom": bom, "company": company }, as_dict=True) for item in items: diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 15e3166e38..078a61d3f6 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -623,3 +623,4 @@ execute:frappe.delete_doc("DocType", "Project Task") erpnext.patches.v11_1.update_default_supplier_in_item_defaults erpnext.patches.v12_0.update_due_date_in_gle erpnext.patches.v12_0.add_default_buying_selling_terms_in_company +erpnext.patches.v12_0.update_ewaybill_field_position diff --git a/erpnext/patches/v12_0/update_ewaybill_field_position.py b/erpnext/patches/v12_0/update_ewaybill_field_position.py new file mode 100644 index 0000000000..d0291d2123 --- /dev/null +++ b/erpnext/patches/v12_0/update_ewaybill_field_position.py @@ -0,0 +1,27 @@ +from __future__ import unicode_literals +import frappe +from erpnext.regional.india.setup import make_custom_fields + +def execute(): + company = frappe.get_all('Company', filters = {'country': 'India'}) + + if not company: + return + + field = frappe.db.get_value("Custom Field", {"dt": "Sales Invoice", "fieldname": "ewaybill"}) + + ewaybill_field = frappe.get_doc("Custom Field", field) + + ewaybill_field.flags.ignore_validate = True + + ewaybill_field.update({ + 'fieldname': 'ewaybill', + 'label': 'e-Way Bill No.', + 'fieldtype': 'Data', + 'depends_on': 'eval:(doc.docstatus === 1)', + 'allow_on_submit': 1, + 'insert_after': 'tax_id', + 'translatable': 0 + }) + + ewaybill_field.save() \ No newline at end of file diff --git a/erpnext/patches/v9_0/fix_subscription_next_date.py b/erpnext/patches/v9_0/fix_subscription_next_date.py index 1789848a17..4595c8dc99 100644 --- a/erpnext/patches/v9_0/fix_subscription_next_date.py +++ b/erpnext/patches/v9_0/fix_subscription_next_date.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import getdate -from frappe.desk.doctype.auto_repeat.auto_repeat import get_next_schedule_date +from frappe.automation.doctype.auto_repeat.auto_repeat import get_next_schedule_date def execute(): frappe.reload_doc('accounts', 'doctype', 'subscription') diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json index b4536c085c..dc221bccbc 100644 --- a/erpnext/projects/doctype/project/project.json +++ b/erpnext/projects/doctype/project/project.json @@ -126,7 +126,8 @@ "fieldname": "project_template", "fieldtype": "Link", "label": "From Template", - "options": "Project Template" + "options": "Project Template", + "set_only_once": 1 }, { "fieldname": "expected_start_date", @@ -442,7 +443,7 @@ "icon": "fa fa-puzzle-piece", "idx": 29, "max_attachments": 4, - "modified": "2019-06-25 16:14:43.887151", + "modified": "2019-07-16 11:11:12.343658", "modified_by": "Administrator", "module": "Projects", "name": "Project", @@ -481,6 +482,7 @@ "quick_entry": 1, "search_fields": "customer, status, priority, is_active", "show_name_in_global_search": 1, + "sort_field": "modified", "sort_order": "DESC", "timeline_field": "customer", "track_seen": 1 diff --git a/erpnext/projects/doctype/project_user/project_user.json b/erpnext/projects/doctype/project_user/project_user.json index 458028ff51..f0a70dd1df 100644 --- a/erpnext/projects/doctype/project_user/project_user.json +++ b/erpnext/projects/doctype/project_user/project_user.json @@ -1,333 +1,85 @@ { - "allow_copy": 0, - "allow_events_in_timeline": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2016-03-25 02:52:19.283003", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, + "creation": "2016-03-25 02:52:19.283003", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "user", + "email", + "image", + "column_break_2", + "full_name", + "welcome_email_sent", + "view_attachments", + "section_break_5", + "project_status" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "user", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "User", - "length": 0, - "no_copy": 0, - "options": "User", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 1, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "user", + "fieldtype": "Link", + "in_list_view": 1, + "label": "User", + "options": "User", + "reqd": 1, + "search_index": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_from": "user.email", - "fieldname": "email", - "fieldtype": "Read Only", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Email", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fetch_from": "user.email", + "fieldname": "email", + "fieldtype": "Read Only", + "label": "Email" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_from": "user.user_image", - "fieldname": "image", - "fieldtype": "Read Only", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Image", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fetch_from": "user.user_image", + "fieldname": "image", + "fieldtype": "Read Only", + "hidden": 1, + "in_global_search": 1, + "label": "Image" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "user.full_name", - "fieldname": "full_name", - "fieldtype": "Read Only", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Full Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fetch_from": "user.full_name", + "fieldname": "full_name", + "fieldtype": "Read Only", + "label": "Full Name" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "welcome_email_sent", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Welcome email sent", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "0", + "fieldname": "welcome_email_sent", + "fieldtype": "Check", + "label": "Welcome email sent" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 1, - "fieldname": "view_attachments", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "View attachments", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "columns": 1, + "default": "0", + "fieldname": "view_attachments", + "fieldtype": "Check", + "in_list_view": 1, + "label": "View attachments" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_5", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_5", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:parent.doctype == 'Project Update'", - "fieldname": "project_status", - "fieldtype": "Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Project Status", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "depends_on": "eval:parent.doctype == 'Project Update'", + "fieldname": "project_status", + "fieldtype": "Text", + "label": "Project Status" } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2019-01-17 17:10:05.339735", - "modified_by": "Administrator", - "module": "Projects", - "name": "Project User", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0, - "track_views": 0 + ], + "istable": 1, + "modified": "2019-07-15 19:37:26.942294", + "modified_by": "Administrator", + "module": "Projects", + "name": "Project User", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" } \ No newline at end of file diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js index 489c7a3b32..5719276669 100644 --- a/erpnext/projects/doctype/task/task.js +++ b/erpnext/projects/doctype/task/task.js @@ -42,20 +42,6 @@ frappe.ui.form.on("Task", { frappe.set_route("List", "Expense Claim"); }, __("View"), true); } - - if (frm.perm[0].write) { - if (!["Closed", "Cancelled"].includes(frm.doc.status)) { - frm.add_custom_button(__("Close"), () => { - frm.set_value("status", "Closed"); - frm.save(); - }); - } else { - frm.add_custom_button(__("Reopen"), () => { - frm.set_value("status", "Open"); - frm.save(); - }); - } - } } } }, diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js index 750900e3be..acc09ed213 100644 --- a/erpnext/public/js/controllers/buying.js +++ b/erpnext/public/js/controllers/buying.js @@ -346,7 +346,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ update_auto_repeat_reference: function(doc) { if (doc.auto_repeat) { frappe.call({ - method:"frappe.desk.doctype.auto_repeat.auto_repeat.update_reference", + method:"frappe.automation.doctype.auto_repeat.auto_repeat.update_reference", args:{ docname: doc.auto_repeat, reference:doc.name diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 0cd648ea11..0252f38931 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -180,7 +180,7 @@ $.extend(erpnext.utils, { make_subscription: function(doctype, docname) { frappe.call({ - method: "frappe.desk.doctype.auto_repeat.auto_repeat.make_auto_repeat", + method: "frappe.automation.doctype.auto_repeat.auto_repeat.make_auto_repeat", args: { doctype: doctype, docname: docname diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js index 35185c90b6..a8d3888ba0 100644 --- a/erpnext/public/js/utils/party.js +++ b/erpnext/public/js/utils/party.js @@ -145,7 +145,7 @@ erpnext.utils.set_taxes_from_address = function(frm, triggered_from_field, billi erpnext.utils.set_taxes = function(frm, triggered_from_field) { if(frappe.meta.get_docfield(frm.doc.doctype, "taxes")) { if(!erpnext.utils.validate_mandatory(frm, "Lead/Customer/Supplier", - frm.doc.customer || frm.doc.supplier || frm.doc.lead, triggered_from_field)) { + frm.doc.customer || frm.doc.supplier || frm.doc.lead || frm.doc.party_name, triggered_from_field)) { return; } diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py index eeb314cd25..40b98ed19a 100644 --- a/erpnext/regional/india/setup.py +++ b/erpnext/regional/india/setup.py @@ -354,7 +354,7 @@ def make_custom_fields(update=True): 'fieldtype': 'Data', 'depends_on': 'eval:(doc.docstatus === 1)', 'allow_on_submit': 1, - 'insert_after': 'project', + 'insert_after': 'tax_id', 'translatable': 0 } ] diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index e9b310eb30..0c5188a4fe 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -14,7 +14,7 @@ from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty from frappe.desk.notifications import clear_doctype_notifications from frappe.contacts.doctype.address.address import get_company_address from erpnext.controllers.selling_controller import SellingController -from frappe.desk.doctype.auto_repeat.auto_repeat import get_next_schedule_date +from frappe.automation.doctype.auto_repeat.auto_repeat import get_next_schedule_date from erpnext.selling.doctype.customer.customer import check_credit_limit from erpnext.stock.doctype.item.item import get_item_defaults from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults diff --git a/erpnext/selling/report/customer_credit_balance/customer_credit_balance.js b/erpnext/selling/report/customer_credit_balance/customer_credit_balance.js index de8abdc498..3a99eb0891 100644 --- a/erpnext/selling/report/customer_credit_balance/customer_credit_balance.js +++ b/erpnext/selling/report/customer_credit_balance/customer_credit_balance.js @@ -16,20 +16,6 @@ frappe.query_reports["Customer Credit Balance"] = { "label": __("Customer"), "fieldtype": "Link", "options": "Customer" - }, - { - "fieldname":"cost_center", - "label": __("Cost Center"), - "fieldtype": "Link", - "options": "Cost Center", - get_query: () => { - var company = frappe.query_report.get_filter_value('company'); - return { - filters: { - 'company': company - } - } - } - }, + } ] } diff --git a/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py b/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py index a57d975740..ee0d72be7b 100644 --- a/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py +++ b/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py @@ -21,8 +21,7 @@ def execute(filters=None): row = [] outstanding_amt = get_customer_outstanding(d.name, filters.get("company"), - ignore_outstanding_sales_order=d.bypass_credit_limit_check_at_sales_order, - cost_center=filters.get("cost_center")) + ignore_outstanding_sales_order=d.bypass_credit_limit_check_at_sales_order) credit_limit = get_credit_limit(d.name, filters.get("company")) @@ -66,3 +65,4 @@ def get_details(filters): return frappe.db.sql("""select name, customer_name, bypass_credit_limit_check_at_sales_order, is_frozen, disabled from `tabCustomer` %s """ % conditions, filters, as_dict=1) + diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index a2bae56ee0..000d666d36 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -428,7 +428,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ update_auto_repeat_reference: function(doc) { if (doc.auto_repeat) { frappe.call({ - method:"frappe.desk.doctype.auto_repeat.auto_repeat.update_reference", + method:"frappe.automation.doctype.auto_repeat.auto_repeat.update_reference", args:{ docname: doc.auto_repeat, reference:doc.name diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js index 157dbfe174..1bfa2cf56c 100644 --- a/erpnext/stock/dashboard/item_dashboard.js +++ b/erpnext/stock/dashboard/item_dashboard.js @@ -16,18 +16,47 @@ erpnext.stock.ItemDashboard = Class.extend({ this.content = $(frappe.render_template('item_dashboard')).appendTo(this.parent); this.result = this.content.find('.result'); - // move this.content.on('click', '.btn-move', function() { - erpnext.stock.move_item(unescape($(this).attr('data-item')), $(this).attr('data-warehouse'), - null, $(this).attr('data-actual_qty'), null, function() { me.refresh(); }); + handle_move_add($(this), "Move") }); this.content.on('click', '.btn-add', function() { - erpnext.stock.move_item(unescape($(this).attr('data-item')), null, $(this).attr('data-warehouse'), - $(this).attr('data-actual_qty'), $(this).attr('data-rate'), - function() { me.refresh(); }); + handle_move_add($(this), "Add") }); + function handle_move_add(element, action) { + let item = unescape(element.attr('data-item')); + let warehouse = unescape(element.attr('data-warehouse')); + let actual_qty = unescape(element.attr('data-actual_qty')); + let disable_quick_entry = Number(unescape(element.attr('data-disable_quick_entry'))); + let entry_type = action === "Move" ? "Material Transfer": null; + + if (disable_quick_entry) { + open_stock_entry(item, warehouse, entry_type); + } else { + if (action === "Add") { + let rate = unescape($(this).attr('data-rate')); + erpnext.stock.move_item(item, null, warehouse, actual_qty, rate, function() { me.refresh(); }); + } + else { + erpnext.stock.move_item(item, warehouse, null, actual_qty, null, function() { me.refresh(); }); + } + } + } + + function open_stock_entry(item, warehouse, entry_type) { + frappe.model.with_doctype('Stock Entry', function() { + var doc = frappe.model.get_new_doc('Stock Entry'); + if (entry_type) doc.stock_entry_type = entry_type; + + var row = frappe.model.add_child(doc, 'items'); + row.item_code = item; + row.s_warehouse = warehouse; + + frappe.set_route('Form', doc.doctype, doc.name); + }) + } + // more this.content.find('.btn-more').on('click', function() { me.start += 20; @@ -196,4 +225,4 @@ erpnext.stock.move_item = function(item, source, target, actual_qty, rate, callb frappe.set_route('Form', doc.doctype, doc.name); }) }); -} \ No newline at end of file +} diff --git a/erpnext/stock/dashboard/item_dashboard.py b/erpnext/stock/dashboard/item_dashboard.py index 487c765659..cafb5c3a0a 100644 --- a/erpnext/stock/dashboard/item_dashboard.py +++ b/erpnext/stock/dashboard/item_dashboard.py @@ -44,7 +44,9 @@ def get_data(item_code=None, warehouse=None, item_group=None, for item in items: item.update({ - 'item_name': frappe.get_cached_value("Item", item.item_code, 'item_name') + 'item_name': frappe.get_cached_value("Item", item.item_code, 'item_name'), + 'disable_quick_entry': frappe.get_cached_value("Item", item.item_code, 'has_batch_no') + or frappe.get_cached_value("Item", item.item_code, 'has_serial_no'), }) return items diff --git a/erpnext/stock/dashboard/item_dashboard_list.html b/erpnext/stock/dashboard/item_dashboard_list.html index 5a3fa2ed48..e1914ed76a 100644 --- a/erpnext/stock/dashboard/item_dashboard_list.html +++ b/erpnext/stock/dashboard/item_dashboard_list.html @@ -43,11 +43,13 @@