Merge branch 'layout-cleanup' into develop
Conflicts:
erpnext/accounts/doctype/sales_invoice/sales_invoice.json
erpnext/stock/doctype/delivery_note/delivery_note.json
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index cfdd2f7..889fbef 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
from __future__ import unicode_literals
-__version__ = '5.7.7'
+__version__ = '5.8.2'
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 4b25a88..f5f22dc 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -32,7 +32,6 @@
self.set_against_account()
self.create_remarks()
self.set_print_format_fields()
- self.check_due_date()
self.validate_expense_claim()
self.validate_credit_debit_note()
self.validate_empty_accounts_table()
@@ -83,20 +82,6 @@
for customer in customers:
check_credit_limit(customer, self.company)
- def check_due_date(self):
- if self.cheque_date:
- for d in self.get("accounts"):
- if d.party_type and d.party and d.get("credit" if d.party_type=="Customer" else "debit") > 0:
- due_date = None
- if d.reference_type in ("Sales Invoice", "Purchase Invoice"):
- due_date = frappe.db.get_value(d.reference_type, d.reference_name, "due_date")
-
- if due_date and getdate(self.cheque_date) > getdate(due_date):
- diff = date_diff(self.cheque_date, due_date)
- if diff > 0:
- msgprint(_("Note: Reference Date exceeds invoice due date by {0} days for {1} {2}")
- .format(diff, d.party_type, d.party))
-
def validate_cheque_info(self):
if self.voucher_type in ['Bank Entry']:
if not self.cheque_no or not self.cheque_date:
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 6257865..70ebee1 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -148,12 +148,22 @@
}
cur_frm.fields_dict['credit_to'].get_query = function(doc) {
- return{
- filters:{
- 'account_type': 'Payable',
- 'root_type': 'Liability',
- 'is_group': 0,
- 'company': doc.company
+ // filter on Account
+ if (doc.supplier) {
+ return {
+ filters: {
+ 'account_type': 'Payable',
+ 'is_group': 0,
+ 'company': doc.company
+ }
+ }
+ } else {
+ return {
+ filters: {
+ 'report_type': 'Balance Sheet',
+ 'is_group': 0,
+ 'company': doc.company
+ }
}
}
}
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 2208937..a43e553 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -91,8 +91,12 @@
throw(_("Conversion rate cannot be 0 or 1"))
def validate_credit_to_acc(self):
- account_type = frappe.db.get_value("Account", self.credit_to, "account_type")
- if account_type != "Payable":
+ account = frappe.db.get_value("Account", self.credit_to, ["account_type", "report_type"], as_dict=True)
+
+ if account.report_type != "Balance Sheet":
+ frappe.throw(_("Credit To account must be a Balance Sheet account"))
+
+ if self.supplier and account.account_type != "Payable":
frappe.throw(_("Credit To account must be a Payable account"))
def check_for_stopped_status(self):
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 88b3069..ec84302 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -405,10 +405,22 @@
}
cur_frm.set_query("debit_to", function(doc) {
- return{
- filters: [
- ['Account', 'root_type', '=', 'Asset'],
- ['Account', 'account_type', '=', 'Receivable']
- ]
+ // filter on Account
+ if (doc.customer) {
+ return {
+ filters: {
+ 'account_type': 'Receivable',
+ 'is_group': 0,
+ 'company': doc.company
+ }
+ }
+ } else {
+ return {
+ filters: {
+ 'report_type': 'Balance Sheet',
+ 'is_group': 0,
+ 'company': doc.company
+ }
+ }
}
});
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 1274016..92e3c0d 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -271,8 +271,12 @@
reconcile_against_document(lst)
def validate_debit_to_acc(self):
- account_type = frappe.db.get_value("Account", self.debit_to, "account_type")
- if account_type != "Receivable":
+ account = frappe.db.get_value("Account", self.debit_to, ["account_type", "report_type"], as_dict=True)
+
+ if account.report_type != "Balance Sheet":
+ frappe.throw(_("Debit To account must be a Balance Sheet account"))
+
+ if self.customer and account.account_type != "Receivable":
frappe.throw(_("Debit To account must be a Receivable account"))
def validate_fixed_asset_account(self):
diff --git a/erpnext/change_log/current/sales_purchase_return.md b/erpnext/change_log/current/sales_purchase_return.md
deleted file mode 100644
index 0152d57..0000000
--- a/erpnext/change_log/current/sales_purchase_return.md
+++ /dev/null
@@ -1,3 +0,0 @@
-- Fixes in Sales and Purchase Return
- - Update Delivered, Ordered and Returned Quantity based on Return transaction
- - Allow different Rate in Return transaction
diff --git a/erpnext/change_log/v5/v5_8_0.md b/erpnext/change_log/v5/v5_8_0.md
new file mode 100644
index 0000000..239731a
--- /dev/null
+++ b/erpnext/change_log/v5/v5_8_0.md
@@ -0,0 +1,5 @@
+- Fixes in Sales and Purchase Return
+ - Update Delivered, Ordered and Returned Quantity based on Return transaction
+ - Allow different Rate in Return transaction
+- Set default Finished Goods and Work-in-Progress Warehouse in Manufacturing Settings
+- Fixed range validation for numeric attributes in Item Variants
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 396d088..19b5a9b 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -227,7 +227,7 @@
incoming_rate = incoming_rate[0][0] if incoming_rate else 0.0
return incoming_rate
-
+
def update_reserved_qty(self):
so_map = {}
for d in self.get("items"):
@@ -242,22 +242,23 @@
sales_order = frappe.get_doc("Sales Order", so)
if sales_order.status in ["Stopped", "Cancelled"]:
- frappe.throw(_("Sales Order {0} is cancelled or stopped").format(so), frappe.InvalidStatusError)
-
+ frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Sales Order"), so),
+ frappe.InvalidStatusError)
+
sales_order.update_reserved_qty(so_item_rows)
-
+
def update_stock_ledger(self):
self.update_reserved_qty()
-
+
sl_entries = []
for d in self.get_item_list():
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 \
and d.warehouse and flt(d['qty']):
-
+
incoming_rate = 0
if cint(self.is_return) and self.return_against and self.docstatus==1:
incoming_rate = self.get_incoming_rate_for_sales_return(d.item_code, self.return_against)
-
+
sl_entries.append(self.get_sl_entries(d, {
"actual_qty": -1*flt(d['qty']),
"stock_uom": frappe.db.get_value("Item", d.item_code, "stock_uom"),
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 2a2d7c1..7a6a535 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -27,7 +27,7 @@
"""
app_icon = "icon-th"
app_color = "#e74c3c"
-app_version = "5.7.7"
+app_version = "5.8.2"
github_link = "https://github.com/frappe/erpnext"
error_report_email = "support@erpnext.com"
diff --git a/erpnext/patches/v5_8/update_order_reference_in_return_entries.py b/erpnext/patches/v5_8/update_order_reference_in_return_entries.py
index c6cfceb..a875aed 100644
--- a/erpnext/patches/v5_8/update_order_reference_in_return_entries.py
+++ b/erpnext/patches/v5_8/update_order_reference_in_return_entries.py
@@ -5,6 +5,9 @@
import frappe
def execute():
+ frappe.reload_doctype("Sales Order Item")
+ frappe.reload_doctype("Purchase Order Item")
+
# sales return
return_entries = list(frappe.db.sql("""
select dn.name as name, dn_item.name as row_id, dn.return_against,
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 1ac1cf4..0e8cef2 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -79,7 +79,7 @@
item_meta = frappe.get_meta("Delivery Note Item")
print_hide_fields = {
- "parent": ["grand_total", "rounded_total", "in_words", "currency", "net_total"],
+ "parent": ["grand_total", "rounded_total", "in_words", "currency", "total", "taxes"],
"items": ["rate", "amount", "price_list_rate", "discount_percentage"]
}
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 08350af..d445582 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -572,7 +572,7 @@
for attribute, value in args.items():
for row in variant.attributes:
- if row.attribute==attribute and row.attribute_value==value:
+ if row.attribute==attribute and row.attribute_value== cstr(value):
# this row matches
match_count += 1
break
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index e418366..38238c7 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -162,7 +162,8 @@
mr_obj = frappe.get_doc("Material Request", mr)
if mr_obj.status in ["Stopped", "Cancelled"]:
- frappe.throw(_("Material Request {0} is cancelled or stopped").format(mr), frappe.InvalidStatusError)
+ frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Material Request"), mr),
+ frappe.InvalidStatusError)
mr_obj.update_completed_qty(mr_item_rows)
mr_obj.update_requested_qty(mr_item_rows)
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 58f165c..1ab866c 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -183,7 +183,8 @@
po_obj = frappe.get_doc("Purchase Order", po)
if po_obj.status in ["Stopped", "Cancelled"]:
- frappe.throw(_("Material Request {0} is cancelled or stopped").format(po), frappe.InvalidStatusError)
+ frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Purchase Order"), po),
+ frappe.InvalidStatusError)
po_obj.update_ordered_qty(po_item_rows)
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 6c9b9a4..278ec3b 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -34,7 +34,7 @@
if events:
frappe.db.sql("delete from `tabEvent` where name in (%s)"
.format(", ".join(['%s']*len(events))), tuple(events))
-
+
frappe.db.sql("delete from `tabEvent Role` where parent in (%s)"
.format(", ".join(['%s']*len(events))), tuple(events))
@@ -47,7 +47,7 @@
"owner": opts.owner or self.owner,
"subject": opts.subject,
"description": opts.description,
- "starts_on": self.contact_date + " 10:00:00",
+ "starts_on": self.contact_date,
"event_type": "Private",
"ref_type": self.doctype,
"ref_name": self.name
@@ -56,7 +56,7 @@
event.insert(ignore_permissions=True)
if frappe.db.exists("User", self.contact_by):
- frappe.share.add("Event", event.name, self.contact_by,
+ frappe.share.add("Event", event.name, self.contact_by,
flags={"ignore_share_permission": True})
def validate_uom_is_integer(self, uom_field, qty_fields):
@@ -92,14 +92,14 @@
for field, condition in fields:
if prevdoc_values[field] is not None:
self.validate_value(field, condition, prevdoc_values[field], doc)
-
-
+
+
def validate_rate_with_reference_doc(self, ref_details):
for ref_dt, ref_dn_field, ref_link_field in ref_details:
for d in self.get("items"):
if d.get(ref_link_field):
ref_rate = frappe.db.get_value(ref_dt + " Item", d.get(ref_link_field), "rate")
-
+
if abs(flt(d.rate - ref_rate, d.precision("rate"))) >= .01:
frappe.throw(_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4}) ")
.format(d.idx, ref_dt, d.get(ref_dn_field), d.rate, ref_rate))
diff --git a/setup.py b/setup.py
index 9ed46de..6a420c3 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
-version = "5.7.7"
+version = "5.8.2"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()