Merge branch 'develop' into shopping-cart
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index 1f7853d..07e75ac 100644
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -40,6 +40,7 @@
"base_rate",
"base_amount",
"pricing_rules",
+ "stock_uom_rate",
"is_free_item",
"section_break_22",
"net_rate",
@@ -784,6 +785,14 @@
"read_only": 1
},
{
+ "depends_on": "eval: doc.uom != doc.stock_uom",
+ "fieldname": "stock_uom_rate",
+ "fieldtype": "Currency",
+ "label": "Rate of Stock UOM",
+ "options": "currency",
+ "read_only": 1
+ },
+ {
"fieldname": "sales_invoice_item",
"fieldtype": "Data",
"label": "Sales Invoice Item",
@@ -795,7 +804,7 @@
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2020-12-26 17:20:36.415791",
+ "modified": "2021-01-30 21:43:21.488258",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",
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 7a98aff..b403c7b 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -45,6 +45,7 @@
"base_rate",
"base_amount",
"pricing_rules",
+ "stock_uom_rate",
"is_free_item",
"section_break_21",
"net_rate",
@@ -811,12 +812,20 @@
"no_copy": 1,
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "depends_on": "eval: doc.uom != doc.stock_uom",
+ "fieldname": "stock_uom_rate",
+ "fieldtype": "Currency",
+ "label": "Rate of Stock UOM",
+ "options": "currency",
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2020-12-26 17:25:04.090630",
+ "modified": "2021-01-30 21:42:37.796771",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",
diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
index 0861b20..79b0a6f 100644
--- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
+++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
@@ -15,15 +15,51 @@
return columns, data
def get_columns():
- return [
- _("Payment Document") + "::130",
- _("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":110",
- _("Posting Date") + ":Date:100",
- _("Cheque/Reference No") + "::120",
- _("Clearance Date") + ":Date:100",
- _("Against Account") + ":Link/Account:170",
- _("Amount") + ":Currency:120"
- ]
+ columns = [{
+ "label": _("Payment Document Type"),
+ "fieldname": "payment_document_type",
+ "fieldtype": "Link",
+ "options": "Doctype",
+ "width": 130
+ },
+ {
+ "label": _("Payment Entry"),
+ "fieldname": "payment_entry",
+ "fieldtype": "Dynamic Link",
+ "options": "payment_document_type",
+ "width": 140
+ },
+ {
+ "label": _("Posting Date"),
+ "fieldname": "posting_date",
+ "fieldtype": "Date",
+ "width": 100
+ },
+ {
+ "label": _("Cheque/Reference No"),
+ "fieldname": "cheque_no",
+ "width": 120
+ },
+ {
+ "label": _("Clearance Date"),
+ "fieldname": "clearance_date",
+ "fieldtype": "Date",
+ "width": 100
+ },
+ {
+ "label": _("Against Account"),
+ "fieldname": "against",
+ "fieldtype": "Link",
+ "options": "Account",
+ "width": 170
+ },
+ {
+ "label": _("Amount"),
+ "fieldname": "amount",
+ "width": 120
+ }]
+
+ return columns
def get_conditions(filters):
conditions = ""
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
index c691e9f..75b2954 100644
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
@@ -40,6 +40,7 @@
"base_rate",
"base_amount",
"pricing_rules",
+ "stock_uom_rate",
"is_free_item",
"section_break_29",
"net_rate",
@@ -726,13 +727,21 @@
"fieldname": "more_info_section_break",
"fieldtype": "Section Break",
"label": "More Information"
+ },
+ {
+ "depends_on": "eval: doc.uom != doc.stock_uom",
+ "fieldname": "stock_uom_rate",
+ "fieldtype": "Currency",
+ "label": "Rate of Stock UOM",
+ "options": "currency",
+ "read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2020-12-07 11:59:47.670951",
+ "modified": "2021-01-30 21:44:41.816974",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 2ae9dc7..70e8d8c 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -24,6 +24,7 @@
self.validate_inspection()
self.validate_serialized_batch()
self.validate_customer_provided_item()
+ self.set_rate_of_stock_uom()
self.validate_internal_transfer()
self.validate_putaway_capacity()
@@ -396,6 +397,11 @@
if frappe.db.get_value('Item', d.item_code, 'is_customer_provided_item'):
d.allow_zero_valuation_rate = 1
+ def set_rate_of_stock_uom(self):
+ if self.doctype in ["Purchase Receipt", "Purchase Invoice", "Purchase Order", "Sales Invoice", "Sales Order", "Delivery Note", "Quotation"]:
+ for d in self.get("items"):
+ d.stock_uom_rate = d.rate / d.conversion_factor
+
def validate_internal_transfer(self):
if self.doctype in ('Sales Invoice', 'Delivery Note', 'Purchase Invoice', 'Purchase Receipt') \
and self.is_internal_transfer():
diff --git a/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
index b538a58..3a9d57d 100644
--- a/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
+++ b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
@@ -19,15 +19,50 @@
if not filters.get('lead_age'): filters["lead_age"] = 60
def get_columns():
- return [
- _("Lead") + ":Link/Lead:100",
- _("Name") + "::100",
- _("Organization") + "::100",
- _("Reference Document") + "::150",
- _("Reference Name") + ":Dynamic Link/"+_("Reference Document")+":120",
- _("Last Communication") + ":Data:200",
- _("Last Communication Date") + ":Date:180"
- ]
+ columns = [{
+ "label": _("Lead"),
+ "fieldname": "lead",
+ "fieldtype": "Link",
+ "options": "Lead",
+ "width": 130
+ },
+ {
+ "label": _("Name"),
+ "fieldname": "name",
+ "width": 120
+ },
+ {
+ "label": _("Organization"),
+ "fieldname": "organization",
+ "width": 120
+ },
+ {
+ "label": _("Reference Document Type"),
+ "fieldname": "reference_document_type",
+ "fieldtype": "Link",
+ "options": "Doctype",
+ "width": 100
+ },
+ {
+ "label": _("Reference Name"),
+ "fieldname": "reference_name",
+ "fieldtype": "Dynamic Link",
+ "options": "reference_document_type",
+ "width": 140
+ },
+ {
+ "label": _("Last Communication"),
+ "fieldname": "last_communication",
+ "fieldtype": "Data",
+ "width": 200
+ },
+ {
+ "label": _("Last Communication Date"),
+ "fieldname": "last_communication_date",
+ "fieldtype": "Date",
+ "width": 100
+ }]
+ return columns
def get_data(filters):
lead_details = []
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index a2a723d..c963866 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -191,7 +191,6 @@
item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item));
item.received_stock_qty = flt(item.conversion_factor, precision("conversion_factor", item)) * flt(item.received_qty);
}
-
this._super(doc, cdt, cdn);
},
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 22e7578..416495c 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -4,7 +4,7 @@
erpnext.taxes_and_totals = erpnext.payments.extend({
setup: function() {},
- apply_pricing_rule_on_item: function(item){
+ apply_pricing_rule_on_item: function(item) {
let effective_item_rate = item.price_list_rate;
let item_rate = item.rate;
if (in_list(["Sales Order", "Quotation"], item.parenttype) && item.blanket_order_rate) {
@@ -26,6 +26,7 @@
if (item.discount_amount) {
item_rate = flt((item.rate_with_margin) - (item.discount_amount), precision('rate', item));
+ item.discount_percentage = 100 * flt(item.discount_amount) / flt(item.rate_with_margin);
}
frappe.model.set_value(item.doctype, item.name, "rate", item_rate);
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 1db0f5f..e5f9049 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -40,7 +40,7 @@
cur_frm.cscript.set_gross_profit(item);
cur_frm.cscript.calculate_taxes_and_totals();
-
+ cur_frm.cscript.calculate_stock_uom_rate(frm, cdt, cdn);
});
@@ -1122,6 +1122,7 @@
}
});
}
+ me.calculate_stock_uom_rate(doc, cdt, cdn);
},
conversion_factor: function(doc, cdt, cdn, dont_fetch_price_list_rate) {
@@ -1142,6 +1143,7 @@
frappe.meta.has_field(doc.doctype, "price_list_currency")) {
this.apply_price_list(item, true);
}
+ this.calculate_stock_uom_rate(doc, cdt, cdn);
}
},
@@ -1162,9 +1164,15 @@
qty: function(doc, cdt, cdn) {
let item = frappe.get_doc(cdt, cdn);
this.conversion_factor(doc, cdt, cdn, true);
+ this.calculate_stock_uom_rate(doc, cdt, cdn);
this.apply_pricing_rule(item, true);
},
+ calculate_stock_uom_rate: function(doc, cdt, cdn) {
+ let item = frappe.get_doc(cdt, cdn);
+ item.stock_uom_rate = flt(item.rate)/flt(item.conversion_factor);
+ refresh_field("stock_uom_rate", item.name, item.parentfield);
+ },
service_stop_date: function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
@@ -1275,7 +1283,7 @@
this.frm.set_currency_labels(["base_rate", "base_net_rate", "base_price_list_rate", "base_amount", "base_net_amount"],
company_currency, "items");
- this.frm.set_currency_labels(["rate", "net_rate", "price_list_rate", "amount", "net_amount"],
+ this.frm.set_currency_labels(["rate", "net_rate", "price_list_rate", "amount", "net_amount", "stock_uom_rate"],
this.frm.doc.currency, "items");
if(this.frm.fields_dict["operations"]) {
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index 59ae7b2..a6785f7 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -47,6 +47,7 @@
"base_amount",
"base_net_amount",
"pricing_rules",
+ "stock_uom_rate",
"is_free_item",
"section_break_43",
"valuation_rate",
@@ -634,12 +635,20 @@
"print_hide": 1,
"read_only": 1,
"report_hide": 1
+ },
+ {
+ "depends_on": "eval: doc.uom != doc.stock_uom",
+ "fieldname": "stock_uom_rate",
+ "fieldtype": "Currency",
+ "label": "Rate of Stock UOM",
+ "options": "currency",
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2020-05-19 20:48:43.222229",
+ "modified": "2021-01-30 21:39:40.174551",
"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 159655b..37e47a9 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -46,6 +46,7 @@
"base_rate",
"base_amount",
"pricing_rules",
+ "stock_uom_rate",
"is_free_item",
"section_break_24",
"net_rate",
@@ -214,7 +215,6 @@
"fieldtype": "Link",
"label": "UOM",
"options": "UOM",
- "print_hide": 0,
"reqd": 1
},
{
@@ -780,12 +780,20 @@
"fieldname": "manufacturing_section_section",
"fieldtype": "Section Break",
"label": "Manufacturing Section"
+ },
+ {
+ "depends_on": "eval: doc.uom != doc.stock_uom",
+ "fieldname": "stock_uom_rate",
+ "fieldtype": "Currency",
+ "label": "Rate of Stock UOM",
+ "options": "currency",
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2020-012-07 20:54:32.309460",
+ "modified": "2021-01-30 21:35:07.617320",
"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 9de088d..1799624 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -47,6 +47,7 @@
"base_rate",
"base_amount",
"pricing_rules",
+ "stock_uom_rate",
"is_free_item",
"section_break_25",
"net_rate",
@@ -743,13 +744,21 @@
"no_copy": 1,
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "depends_on": "eval: doc.uom != doc.stock_uom",
+ "fieldname": "stock_uom_rate",
+ "fieldtype": "Currency",
+ "label": "Rate of Stock UOM",
+ "options": "currency",
+ "read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2020-12-26 17:31:27.029803",
+ "modified": "2021-01-30 21:42:03.767968",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
index e991192..8974ad9 100644
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -48,6 +48,7 @@
"base_rate",
"base_amount",
"pricing_rules",
+ "stock_uom_rate",
"is_free_item",
"section_break_29",
"net_rate",
@@ -875,6 +876,14 @@
"print_hide": 1
},
{
+ "depends_on": "eval: doc.uom != doc.stock_uom",
+ "fieldname": "stock_uom_rate",
+ "fieldtype": "Currency",
+ "label": "Rate of Stock UOM",
+ "options": "currency",
+ "read_only": 1
+ },
+ {
"fieldname": "delivery_note_item",
"fieldtype": "Data",
"label": "Delivery Note Item",
@@ -886,7 +895,7 @@
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2020-12-26 16:50:56.479347",
+ "modified": "2021-01-30 21:44:06.918515",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",