Merge pull request #20393 from rohitwaghchaure/unlink_reference_name_from_batch_on_cancel_of_stock_transactions_develop
fix: unlink references from batch on cancellation of stock transactions
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index 86b5a11..0df6a6c 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -620,7 +620,7 @@
if not account:
if not asset_category:
- frappe.throw(_("Set {0} in company {2}").format(account_name.replace('_', ' ').title(), company))
+ frappe.throw(_("Set {0} in company {1}").format(account_name.replace('_', ' ').title(), company))
else:
frappe.throw(_("Set {0} in asset category {1} or company {2}")
.format(account_name.replace('_', ' ').title(), asset_category, company))
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index 6cab18dc..73ef79b 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -62,7 +62,8 @@
if self.contact_date and getdate(self.contact_date) < getdate(nowdate()):
frappe.throw(_("Next Contact Date cannot be in the past"))
- if self.ends_on and self.contact_date and (self.ends_on < self.contact_date):
+ if (self.ends_on and self.contact_date and
+ (getdate(self.ends_on) < getdate(self.contact_date))):
frappe.throw(_("Ends On date cannot be before Next Contact Date."))
def on_update(self):
diff --git a/erpnext/crm/report/lead_details/lead_details.json b/erpnext/crm/report/lead_details/lead_details.json
index 17800fd..cdeb6bb 100644
--- a/erpnext/crm/report/lead_details/lead_details.json
+++ b/erpnext/crm/report/lead_details/lead_details.json
@@ -1,28 +1,29 @@
{
- "add_total_row": 0,
- "creation": "2013-10-22 11:58:16",
- "disabled": 0,
- "docstatus": 0,
- "doctype": "Report",
- "idx": 3,
- "is_standard": "Yes",
- "modified": "2018-09-26 18:59:46.520731",
- "modified_by": "Administrator",
- "module": "CRM",
- "name": "Lead Details",
- "owner": "Administrator",
- "prepared_report": 0,
- "query": "SELECT\n `tabLead`.name as \"Lead Id:Link/Lead:120\",\n `tabLead`.lead_name as \"Lead Name::120\",\n\t`tabLead`.company_name as \"Company Name::120\",\n\t`tabLead`.status as \"Status::120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2)\n\t) as 'Address::180',\n\t`tabAddress`.state as \"State::100\",\n\t`tabAddress`.pincode as \"Pincode::70\",\n\t`tabAddress`.country as \"Country::100\",\n\t`tabLead`.phone as \"Phone::100\",\n\t`tabLead`.mobile_no as \"Mobile No::100\",\n\t`tabLead`.email_id as \"Email Id::120\",\n\t`tabLead`.lead_owner as \"Lead Owner::120\",\n\t`tabLead`.source as \"Source::120\",\n\t`tabLead`.territory as \"Territory::120\",\n\t`tabLead`.notes as \"Notes::360\",\n `tabLead`.owner as \"Owner:Link/User:120\"\nFROM\n\t`tabLead`\n\tleft join `tabDynamic Link` on (\n\t\t`tabDynamic Link`.link_name=`tabLead`.name\n\t)\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.name=`tabDynamic Link`.parent\n\t)\nWHERE\n\t`tabLead`.docstatus<2\nORDER BY\n\t`tabLead`.name asc",
- "ref_doctype": "Lead",
- "report_name": "Lead Details",
- "report_type": "Query Report",
+ "add_total_row": 0,
+ "creation": "2013-10-22 11:58:16",
+ "disable_prepared_report": 0,
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 3,
+ "is_standard": "Yes",
+ "modified": "2020-01-22 16:51:56.591110",
+ "modified_by": "Administrator",
+ "module": "CRM",
+ "name": "Lead Details",
+ "owner": "Administrator",
+ "prepared_report": 0,
+ "query": "SELECT\n `tabLead`.name as \"Lead Id:Link/Lead:120\",\n `tabLead`.lead_name as \"Lead Name::120\",\n\t`tabLead`.company_name as \"Company Name::120\",\n\t`tabLead`.status as \"Status::120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2)\n\t) as 'Address::180',\n\t`tabAddress`.state as \"State::100\",\n\t`tabAddress`.pincode as \"Pincode::70\",\n\t`tabAddress`.country as \"Country::100\",\n\t`tabLead`.phone as \"Phone::100\",\n\t`tabLead`.mobile_no as \"Mobile No::100\",\n\t`tabLead`.email_id as \"Email Id::120\",\n\t`tabLead`.lead_owner as \"Lead Owner::120\",\n\t`tabLead`.source as \"Source::120\",\n\t`tabLead`.territory as \"Territory::120\",\n\t`tabLead`.notes as \"Notes::360\",\n `tabLead`.owner as \"Owner:Link/User:120\"\nFROM\n\t`tabLead`\n\tleft join `tabDynamic Link` on (\n\t\t`tabDynamic Link`.link_name=`tabLead`.name \n\t\tand `tabDynamic Link`.parenttype = 'Address'\n\t)\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.name=`tabDynamic Link`.parent\n\t)\nWHERE\n\t`tabLead`.docstatus<2\nORDER BY\n\t`tabLead`.name asc",
+ "ref_doctype": "Lead",
+ "report_name": "Lead Details",
+ "report_type": "Query Report",
"roles": [
{
"role": "Sales User"
- },
+ },
{
"role": "Sales Manager"
- },
+ },
{
"role": "System Manager"
}
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.json b/erpnext/manufacturing/doctype/production_plan/production_plan.json
index af84481..77ca6b6 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.json
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.json
@@ -225,6 +225,7 @@
"options": "Warehouse"
},
{
+ "depends_on": "eval:!doc.__islocal",
"fieldname": "download_materials_required",
"fieldtype": "Button",
"label": "Download Required Materials"
@@ -296,7 +297,7 @@
"icon": "fa fa-calendar",
"is_submittable": 1,
"links": [],
- "modified": "2019-12-04 15:58:50.940460",
+ "modified": "2020-01-21 19:13:10.113854",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 62e38c3..5a5d8a1 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -485,7 +485,7 @@
if self.work_order \
and frappe.db.get_single_value("Manufacturing Settings", "material_consumption"):
bom_items = self.get_bom_raw_materials(d.transfer_qty)
- raw_material_cost = sum([flt(d.qty)*flt(d.rate) for d in bom_items.values()])
+ raw_material_cost = sum([flt(row.qty)*flt(row.rate) for row in bom_items.values()])
if raw_material_cost:
d.basic_rate = flt((raw_material_cost - scrap_material_cost) / flt(d.transfer_qty), d.precision("basic_rate"))