Merge pull request #8016 from rmehta/posting-date-option
[feature] posting date, time is always current unless explicitly set
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index 64debd3..420ae50 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -1,5 +1,6 @@
{
"allow_copy": 0,
+ "allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
@@ -481,6 +482,35 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "stock_qty",
+ "fieldtype": "Float",
+ "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": "Qty as per Stock UOM",
+ "length": 0,
+ "no_copy": 1,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1912,35 +1942,6 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "stock_qty",
- "fieldtype": "Float",
- "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": "Qty as per Stock UOM",
- "length": 0,
- "no_copy": 1,
- "permlevel": 0,
- "precision": "",
- "print_hide": 1,
- "print_hide_if_no_value": 0,
- "read_only": 1,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "delivered_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2082,17 +2083,17 @@
"unique": 0
}
],
+ "has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
- "in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2017-02-22 01:46:28.390397",
+ "modified": "2017-03-13 19:35:22.416029",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index b86f9e1..1dafb87 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -1413,11 +1413,30 @@
submit_invoice: function () {
var me = this;
this.change_status();
+ this.update_serial_no()
if (this.frm.doc.docstatus == 1) {
this.print_dialog()
}
},
+ update_serial_no: function() {
+ var me = this;
+
+ //Remove the sold serial no from the cache
+ $.each(this.frm.doc.items, function(index, data) {
+ sn = data.serial_no.split('\n')
+ if(sn.length) {
+ serial_no_list = me.serial_no_data[data.item_code]
+ $.each(sn, function(i, serial_no) {
+ if(in_list(Object.keys(serial_no_list), serial_no)) {
+ delete serial_no_list[serial_no]
+ }
+ })
+ me.serial_no_data[data.item_code] = serial_no_list;
+ }
+ })
+ },
+
change_status: function () {
if (this.frm.doc.docstatus == 0) {
this.frm.doc.docstatus = 1;
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 8b8f257..a4fa3cb 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -5,6 +5,7 @@
import frappe
from frappe import _, scrub
from erpnext.stock.utils import get_incoming_rate
+from erpnext.controllers.queries import get_match_cond
from frappe.utils import flt
@@ -251,28 +252,29 @@
if self.filters.group_by=="Sales Person":
sales_person_cols = ", sales.sales_person, sales.allocated_amount, sales.incentives"
- sales_team_table = "left join `tabSales Team` sales on sales.parent = si.name"
+ sales_team_table = "left join `tabSales Team` sales on sales.parent = `tabSales Invoice`.name"
else:
sales_person_cols = ""
sales_team_table = ""
- self.si_list = frappe.db.sql("""select item.parenttype, item.parent,
- si.posting_date, si.posting_time, si.project, si.update_stock,
- si.customer, si.customer_group, si.territory,
- item.item_code, item.item_name, item.description, item.warehouse,
- item.item_group, item.brand, item.dn_detail, item.delivery_note,
- item.stock_qty as qty, item.base_net_rate, item.base_net_amount, item.name as "item_row"
+ self.si_list = frappe.db.sql("""select `tabSales Invoice Item`.parenttype, `tabSales Invoice Item`.parent,
+ `tabSales Invoice`.posting_date, `tabSales Invoice`.posting_time, `tabSales Invoice`.project, `tabSales Invoice`.update_stock,
+ `tabSales Invoice`.customer, `tabSales Invoice`.customer_group, `tabSales Invoice`.territory,
+ `tabSales Invoice Item`.item_code, `tabSales Invoice Item`.item_name, `tabSales Invoice Item`.description,
+ `tabSales Invoice Item`.warehouse, `tabSales Invoice Item`.item_group, `tabSales Invoice Item`.brand,
+ `tabSales Invoice Item`.dn_detail, `tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.stock_qty as qty,
+ `tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount, `tabSales Invoice Item`.name as "item_row"
{sales_person_cols}
from
- `tabSales Invoice` si
- inner join `tabSales Invoice Item` item on item.parent = si.name
+ `tabSales Invoice`
+ inner join `tabSales Invoice Item` on `tabSales Invoice Item`.parent = `tabSales Invoice`.name
{sales_team_table}
where
- si.docstatus = 1 and si.is_return != 1 {conditions}
+ `tabSales Invoice`.docstatus = 1 and `tabSales Invoice`.is_return != 1 {conditions} {match_cond}
order by
- si.posting_date desc, si.posting_time desc"""
+ `tabSales Invoice`.posting_date desc, `tabSales Invoice`.posting_time desc"""
.format(conditions=conditions, sales_person_cols=sales_person_cols,
- sales_team_table=sales_team_table), self.filters, as_dict=1)
+ sales_team_table=sales_team_table, match_cond = get_match_cond('Sales Invoice')), self.filters, as_dict=1)
def load_stock_ledger_entries(self):
res = frappe.db.sql("""select item_code, voucher_type, voucher_no,
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 514ee86..f4b87d2 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -21,6 +21,10 @@
web_include_js = "assets/js/erpnext-web.min.js"
web_include_css = "assets/erpnext/css/website.css"
+doctype_js = {
+ "Communication": "public/js/communication.js",
+}
+
# setup wizard
setup_wizard_requires = "assets/erpnext/js/setup_wizard.js"
setup_wizard_complete = "erpnext.setup.setup_wizard.setup_wizard.setup_complete"
diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.json b/erpnext/hr/doctype/employee_loan/employee_loan.json
index a14c1e0..a5e7910 100644
--- a/erpnext/hr/doctype/employee_loan/employee_loan.json
+++ b/erpnext/hr/doctype/employee_loan/employee_loan.json
@@ -524,7 +524,7 @@
{
"allow_on_submit": 0,
"bold": 0,
- "collapsible": 0,
+ "collapsible": 1,
"columns": 0,
"fieldname": "account_info",
"fieldtype": "Section Break",
@@ -916,7 +916,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-03-09 01:30:19.231918",
+ "modified": "2017-03-13 15:55:11.143936",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Loan",
diff --git a/erpnext/public/js/communication.js b/erpnext/public/js/communication.js
new file mode 100644
index 0000000..9d54f84
--- /dev/null
+++ b/erpnext/public/js/communication.js
@@ -0,0 +1,73 @@
+frappe.ui.form.on("Communication", {
+ refresh: function(frm) {
+ if(frm.doc.reference_doctype !== "Issue") {
+ frm.add_custom_button(__("Issue"), function() {
+ frappe.confirm("Are you sure you want to create Issue from this email", function(){
+ frm.trigger('make_issue_from_communication');
+ })
+ }, "Make");
+ }
+
+ if(!inList(["Lead", "Opportunity"], frm.doc.reference_doctype)) {
+ frm.add_custom_button(__("Lead"), function() {
+ frappe.confirm("Are you sure you want to create Lead from this email", function(){
+ frm.trigger('make_lead_from_communication');
+ })
+ }, "Make");
+
+ frm.add_custom_button(__("Opportunity"), function() {
+ frappe.confirm("Are you sure you want to create Opportunity from this email", function(){
+ frm.trigger('make_opportunity_from_communication');
+ })
+ }, "Make");
+ }
+
+
+ frm.page.set_inner_btn_group_as_primary(__("Make"));
+ },
+
+ make_lead_from_communication: function(frm) {
+ return frappe.call({
+ method: "frappe.email.inbox.make_lead_from_communication",
+ args: {
+ communication: frm.doc.name
+ },
+ freeze: true,
+ callback: function(r) {
+ if(r.message) {
+ frm.reload_doc()
+ }
+ }
+ })
+ },
+
+ make_issue_from_communication: function(frm) {
+ return frappe.call({
+ method: "frappe.email.inbox.make_issue_from_communication",
+ args: {
+ communication: frm.doc.name
+ },
+ freeze: true,
+ callback: function(r) {
+ if(r.message) {
+ frm.reload_doc()
+ }
+ }
+ })
+ },
+
+ make_opportunity_from_communication: function(frm) {
+ return frappe.call({
+ method: "frappe.email.inbox.make_opportunity_from_communication",
+ args: {
+ communication: frm.doc.name
+ },
+ freeze: true,
+ callback: function(r) {
+ if(r.message) {
+ frm.reload_doc()
+ }
+ }
+ })
+ }
+});
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index 51c0978..253e910 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -1,5 +1,6 @@
{
"allow_copy": 0,
+ "allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "QUOD/.#####",
@@ -464,6 +465,35 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "stock_qty",
+ "fieldtype": "Float",
+ "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": "Qty as per Stock UOM",
+ "length": 0,
+ "no_copy": 1,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_16",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1161,35 +1191,6 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "stock_qty",
- "fieldtype": "Float",
- "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": "Qty as per Stock UOM",
- "length": 0,
- "no_copy": 1,
- "permlevel": 0,
- "precision": "",
- "print_hide": 1,
- "print_hide_if_no_value": 0,
- "read_only": 1,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "projected_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -1520,18 +1521,18 @@
"width": "150px"
}
],
+ "has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
- "in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2017-02-22 01:51:58.405422",
+ "modified": "2017-03-13 19:35:44.119169",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Item",
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index b6d0bf1..5e3518f 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -1,5 +1,6 @@
{
"allow_copy": 0,
+ "allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
@@ -464,6 +465,35 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "stock_qty",
+ "fieldtype": "Float",
+ "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": "Qty as per Stock UOM",
+ "length": 0,
+ "no_copy": 1,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_16",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1461,35 +1491,6 @@
"unique": 0
},
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "stock_qty",
- "fieldtype": "Float",
- "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": "Qty as per Stock UOM",
- "length": 0,
- "no_copy": 1,
- "permlevel": 0,
- "precision": "",
- "print_hide": 1,
- "print_hide_if_no_value": 0,
- "read_only": 1,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
@@ -1859,18 +1860,18 @@
"unique": 0
}
],
+ "has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
- "in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2017-02-22 01:47:17.147012",
+ "modified": "2017-03-13 16:18:49.367870",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index 48aa653..8b52201 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -1,5 +1,6 @@
{
"allow_copy": 0,
+ "allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
@@ -492,6 +493,35 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "stock_qty",
+ "fieldtype": "Float",
+ "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": "Qty as per Stock UOM",
+ "length": 0,
+ "no_copy": 1,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1766,35 +1796,6 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "stock_qty",
- "fieldtype": "Float",
- "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": "Qty as per Stock UOM",
- "length": 0,
- "no_copy": 1,
- "permlevel": 0,
- "precision": "",
- "print_hide": 1,
- "print_hide_if_no_value": 0,
- "read_only": 1,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "installed_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -1883,17 +1884,17 @@
"unique": 0
}
],
+ "has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
- "in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2017-02-22 01:49:51.752713",
+ "modified": "2017-03-13 19:34:42.305637",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",