From 5839a8d7f059165cf7d8044b0265a38fb4adf906 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 2 Mar 2016 17:51:24 +0530 Subject: [PATCH] [fixes] usability cleanup of recurring document and added explicit submit_on_creation --- .../purchase_invoice/purchase_invoice.json | 367 ++++++++++-------- .../doctype/sales_invoice/sales_invoice.json | 275 +++++++------ .../purchase_order/purchase_order.json | 271 +++++++------ erpnext/controllers/recurring_document.py | 10 +- erpnext/patches.txt | 3 +- erpnext/patches/v6_24/set_recurring_id.py | 12 + erpnext/public/js/controllers/transaction.js | 4 + .../doctype/sales_order/sales_order.json | 299 ++++++++------ 8 files changed, 698 insertions(+), 543 deletions(-) create mode 100644 erpnext/patches/v6_24/set_recurring_id.py diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 430c4c8a30c..e69627e3372 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -2341,12 +2341,39 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "recurring_id", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Reference Document", + "length": 0, + "no_copy": 1, + "options": "Purchase Invoice", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Select the period when the invoice will be generated automatically", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "recurring_type", "fieldtype": "Select", "hidden": 0, @@ -2354,7 +2381,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Recurring Type", + "label": "Frequency", "length": 0, "no_copy": 1, "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", @@ -2372,60 +2399,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Start date of current invoice's period", - "fieldname": "from_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "From Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "End date of current invoice's period", - "fieldname": "to_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "To Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "repeat_on_day_of_month", "fieldtype": "Int", "hidden": 0, @@ -2450,8 +2425,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which recurring invoice will be stop", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "end_date", "fieldtype": "Date", "hidden": 0, @@ -2459,7 +2434,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "End Date", + "label": "Recurring Ends On", "length": 0, "no_copy": 1, "permlevel": 0, @@ -2472,6 +2447,113 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "fieldname": "submit_on_creation", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Submit on creation", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", + "fieldname": "notify_by_email", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Notify by email", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", + "description": "", + "fieldname": "notification_email_address", + "fieldtype": "Code", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Notification Email Address", + "length": 0, + "no_copy": 1, + "options": "Email", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", + "fieldname": "recurring_print_format", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Recurring Print Format", + "length": 0, + "no_copy": 0, + "options": "Print Format", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -2500,8 +2582,60 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which next invoice will be generated. It is generated on submit.", + "depends_on": "is_recurring", + "description": "", + "fieldname": "from_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "From Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "to_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "To Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", "fieldname": "next_date", "fieldtype": "Date", "hidden": 0, @@ -2515,119 +2649,12 @@ "permlevel": 0, "print_hide": 1, "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The unique id for tracking all recurring invoices. It is generated on submit.", - "fieldname": "recurring_id", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Recurring Id", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Check to send it via Email, uncheck to generate a draft document only.", - "fieldname": "notify_by_email", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Notify by Email", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.notify_by_email==1", - "description": "Enter email id separated by commas, invoice will be mailed automatically on particular date", - "fieldname": "notification_email_address", - "fieldtype": "Code", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Notification Email Address", - "length": 0, - "no_copy": 1, - "options": "Email", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "fieldname": "recurring_print_format", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Recurring Print Format", - "length": 0, - "no_copy": 0, - "options": "Print Format", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 } ], "hide_heading": 0, @@ -2641,7 +2668,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-03-02 05:11:31.331521", + "modified": "2016-03-02 07:12:31.805279", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 23b5fe6bcb8..86a6593b024 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -3051,6 +3051,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "label": "Settings", "length": 0, "no_copy": 0, "permlevel": 0, @@ -3069,7 +3070,7 @@ "bold": 0, "collapsible": 0, "depends_on": "eval:doc.docstatus<2", - "description": "Check if recurring invoice, uncheck to stop recurring or put proper End Date", + "description": "", "fieldname": "is_recurring", "fieldtype": "Check", "hidden": 0, @@ -3090,12 +3091,39 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "recurring_id", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Reference Document", + "length": 0, + "no_copy": 1, + "options": "Sales Invoice", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Select the period when the invoice will be generated automatically", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "recurring_type", "fieldtype": "Select", "hidden": 0, @@ -3103,7 +3131,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Recurring Type", + "label": "Frequency", "length": 0, "no_copy": 1, "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", @@ -3121,60 +3149,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Start date of current invoice's period", - "fieldname": "from_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "From Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "End date of current invoice's period", - "fieldname": "to_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "To Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc ", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "repeat_on_day_of_month", "fieldtype": "Int", "hidden": 0, @@ -3199,8 +3175,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which recurring invoice will be stop", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "end_date", "fieldtype": "Date", "hidden": 0, @@ -3225,84 +3201,34 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "column_break12", - "fieldtype": "Column Break", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "fieldname": "submit_on_creation", + "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "label": "Submit on creation", "length": 0, "no_copy": 0, "permlevel": 0, - "print_hide": 1, + "precision": "", + "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, "search_index": 0, "set_only_once": 0, - "unique": 0, - "width": "50%" - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which next invoice will be generated. It is generated on submit.\n", - "fieldname": "next_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Next Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The unique id for tracking all recurring invoices.\u00a0It is generated on submit.", - "fieldname": "recurring_id", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Recurring Id", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, "unique": 0 }, { "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Check to send it via Email, uncheck to generate a draft document only.", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "notify_by_email", "fieldtype": "Check", "hidden": 0, @@ -3310,7 +3236,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Notify by Email", + "label": "Notify by email", "length": 0, "no_copy": 1, "permlevel": 0, @@ -3328,8 +3254,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.notify_by_email==1", - "description": "Enter email id separated by commas, invoice will be mailed automatically on particular date", + "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", + "description": "", "fieldname": "notification_email_address", "fieldtype": "Code", "hidden": 0, @@ -3355,7 +3281,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", + "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", "fieldname": "recurring_print_format", "fieldtype": "Link", "hidden": 0, @@ -3378,6 +3304,109 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break12", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "This Document", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "50%" + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "from_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "From Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "to_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "To Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "next_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Next Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -3416,7 +3445,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-03-02 05:09:44.584180", + "modified": "2016-03-02 07:12:38.793697", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index bff776f4f48..8e5bf85f48c 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -2356,7 +2356,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "", + "label": "Settings", "length": 0, "no_copy": 0, "permlevel": 0, @@ -2395,11 +2395,39 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "recurring_id", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Reference Document", + "length": 0, + "no_copy": 1, + "options": "Purchase Order", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "recurring_type", "fieldtype": "Select", "hidden": 0, @@ -2407,7 +2435,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Recurring Type", + "label": "Frequency", "length": 0, "no_copy": 1, "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", @@ -2425,60 +2453,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Start date of current order's period", - "fieldname": "from_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "From Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "End date of current order's period", - "fieldname": "to_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "To Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "repeat_on_day_of_month", "fieldtype": "Int", "hidden": 0, @@ -2503,8 +2479,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which recurring order will be stop", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "end_date", "fieldtype": "Date", "hidden": 0, @@ -2529,18 +2505,20 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "column_break83", - "fieldtype": "Column Break", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "fieldname": "submit_on_creation", + "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "", + "label": "Submit on creation", "length": 0, "no_copy": 0, "permlevel": 0, - "print_hide": 1, + "precision": "", + "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, @@ -2553,59 +2531,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which next invoice will be generated. It is generated on submit.", - "fieldname": "next_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Next Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "fieldname": "recurring_id", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Recurring Id", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Check to send it via Email, uncheck to generate a draft document only.", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "notify_by_email", "fieldtype": "Check", "hidden": 0, @@ -2613,7 +2540,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Notify by Email", + "label": "Notify by email", "length": 0, "no_copy": 1, "permlevel": 0, @@ -2631,8 +2558,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.notify_by_email==1", - "description": "Enter email id separated by commas, order will be mailed automatically on particular date", + "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", + "description": "", "fieldname": "notification_email_address", "fieldtype": "Code", "hidden": 0, @@ -2658,7 +2585,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", + "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", "fieldname": "recurring_print_format", "fieldtype": "Link", "hidden": 0, @@ -2680,6 +2607,108 @@ "search_index": 0, "set_only_once": 0, "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break83", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "This Document", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "from_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "From Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "to_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "To Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "next_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Next Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "hide_heading": 0, @@ -2692,7 +2721,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-03-02 05:10:05.387790", + "modified": "2016-03-02 07:12:18.785730", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py index d02913280be..d5499a37692 100644 --- a/erpnext/controllers/recurring_document.py +++ b/erpnext/controllers/recurring_document.py @@ -101,7 +101,7 @@ def make_new_document(reference_doc, date_field, posting_date): for fieldname in ("owner", "recurring_type", "repeat_on_day_of_month", "recurring_id", "notification_email_address", "is_recurring", "end_date", "title", "naming_series", "select_print_heading", "ignore_pricing_rule", - "posting_time", "remarks"): + "posting_time", "remarks", 'submit_on_creation'): if new_document.meta.get_field(fieldname): new_document.set(fieldname, reference_doc.get(fieldname)) @@ -112,11 +112,11 @@ def make_new_document(reference_doc, date_field, posting_date): new_document.run_method("on_recurring", reference_doc=reference_doc) - if not reference_doc.notify_by_email: + if reference_doc.submit_on_creation: + new_document.submit() + else: new_document.docstatus=0 new_document.insert() - else: - new_document.submit() return new_document @@ -190,7 +190,7 @@ def validate_notification_email_id(doc): if doc.notify_by_email: if doc.notification_email_address: email_list = split_emails(doc.notification_email_address.replace("\n", "")) - + from frappe.utils import validate_email_add for email in email_list: if not validate_email_add(email): diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 7c9da34d14b..46ab671a422 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -250,4 +250,5 @@ erpnext.patches.v6_19.comment_feed_communication erpnext.patches.v6_21.fix_reorder_level erpnext.patches.v6_21.rename_material_request_fields erpnext.patches.v6_23.update_stopped_status_to_closed -erpnext.patches.v6_24.repost_valuation_rate_for_serialized_items \ No newline at end of file +erpnext.patches.v6_24.repost_valuation_rate_for_serialized_items +erpnext.patches.v6_24.set_recurring_id diff --git a/erpnext/patches/v6_24/set_recurring_id.py b/erpnext/patches/v6_24/set_recurring_id.py new file mode 100644 index 00000000000..e8786a23d41 --- /dev/null +++ b/erpnext/patches/v6_24/set_recurring_id.py @@ -0,0 +1,12 @@ +import frappe + +def execute(): + for doctype in ('Sales Order', 'Purchase Order', 'Sales Invoice', + 'Purchase Invoice'): + frappe.reload_doctype(doctype) + frappe.db.sql('''update `tab{0}` set submit_on_creation=1 + where is_recurring=1'''.format(doctype)) + frappe.db.sql('''update `tab{0}` set notify_by_email=1 + where is_recurring=1'''.format(doctype)) + frappe.db.sql('''update `tab{0}` set recurring_id = name + where is_recurring=1 and ifnull(recurring_id, '') = "" '''.format(doctype)) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 5c93ef0b5d6..8c4b36de0d9 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -839,6 +839,10 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ is_recurring: function() { // set default values for recurring documents + if(!this.frm.doc.recurring_id) { + this.frm.set_value('recurring_id', this.frm.doc.name); + } + if(this.frm.doc.is_recurring) { var owner_email = this.frm.doc.owner=="Administrator" ? frappe.user_info("Administrator").email diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index 820792ecb70..4e16b9c04ef 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -2669,12 +2669,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "settings", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Settings", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 1, "bold": 0, "collapsible": 0, "depends_on": "eval:doc.docstatus<2", - "description": "Check if recurring order, uncheck to stop recurring or put proper End Date", + "description": "", "fieldname": "is_recurring", "fieldtype": "Check", "hidden": 0, @@ -2695,12 +2720,39 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "recurring_id", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Reference Document", + "length": 0, + "no_copy": 1, + "options": "Sales Order", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Select the period when the invoice will be generated automatically", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "recurring_type", "fieldtype": "Select", "hidden": 0, @@ -2708,7 +2760,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Recurring Type", + "label": "Frequency", "length": 0, "no_copy": 1, "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", @@ -2726,60 +2778,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Start date of current order's period", - "fieldname": "from_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "From Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "End date of current order's period", - "fieldname": "to_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "To Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc ", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "repeat_on_day_of_month", "fieldtype": "Int", "hidden": 0, @@ -2804,8 +2804,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which recurring order will be stop", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "end_date", "fieldtype": "Date", "hidden": 0, @@ -2813,7 +2813,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "End Date", + "label": "Recurring Upto", "length": 0, "no_copy": 1, "permlevel": 0, @@ -2830,18 +2830,20 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "column_break83", - "fieldtype": "Column Break", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "fieldname": "submit_on_creation", + "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "", + "label": "Submit on creation", "length": 0, "no_copy": 0, "permlevel": 0, - "print_hide": 1, + "precision": "", + "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, @@ -2854,59 +2856,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which next invoice will be generated. It is generated on submit.", - "fieldname": "next_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Next Date", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "fieldname": "recurring_id", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Recurring Id", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", - "description": "Check to send it via Email, uncheck to generate a draft document only.", + "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", + "description": "", "fieldname": "notify_by_email", "fieldtype": "Check", "hidden": 0, @@ -2914,7 +2865,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Notify by Email", + "label": "Notify by email", "length": 0, "no_copy": 1, "permlevel": 0, @@ -2932,8 +2883,8 @@ "allow_on_submit": 1, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.notify_by_email==1", - "description": "Enter email id separated by commas, order will be mailed automatically on particular date", + "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", + "description": "", "fieldname": "notification_email_address", "fieldtype": "Code", "hidden": 0, @@ -2959,7 +2910,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "eval:doc.is_recurring==1", + "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", "fieldname": "recurring_print_format", "fieldtype": "Link", "hidden": 0, @@ -2981,6 +2932,108 @@ "search_index": 0, "set_only_once": 0, "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break83", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "This Document", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "to_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "To Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "from_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "From Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "is_recurring", + "description": "", + "fieldname": "next_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Next Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "hide_heading": 0, @@ -2993,7 +3046,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-03-02 05:07:57.612026", + "modified": "2016-03-02 07:13:13.573209", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order",