diff --git a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py
index edf3d5a574..f5224a269e 100644
--- a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py
+++ b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py
@@ -20,11 +20,16 @@ class POSClosingEntry(StatusUpdater):
self.validate_pos_invoices()
def validate_pos_closing(self):
- user = frappe.get_all("POS Closing Entry",
- filters = { "user": self.user, "docstatus": 1, "pos_profile": self.pos_profile },
- or_filters = {
- "period_start_date": ("between", [self.period_start_date, self.period_end_date]),
- "period_end_date": ("between", [self.period_start_date, self.period_end_date])
+ user = frappe.db.sql("""
+ SELECT name FROM `tabPOS Closing Entry`
+ WHERE
+ user = %(user)s AND docstatus = 1 AND pos_profile = %(profile)s AND
+ (period_start_date between %(start)s and %(end)s OR period_end_date between %(start)s and %(end)s)
+ """, {
+ 'user': self.user,
+ 'profile': self.pos_profile,
+ 'start': self.period_start_date,
+ 'end': self.period_end_date
})
if user:
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
index 8d8babbe75..165294b24c 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
@@ -317,13 +317,14 @@ class POSInvoice(SalesInvoice):
)
customer_group_price_list = frappe.db.get_value("Customer Group", customer_group, 'default_price_list')
selling_price_list = customer_price_list or customer_group_price_list or profile.get('selling_price_list')
+ if customer_currency != profile.get('currency'):
+ self.set('currency', customer_currency)
+
else:
selling_price_list = profile.get('selling_price_list')
if selling_price_list:
self.set('selling_price_list', selling_price_list)
- if customer_currency != profile.get('currency'):
- self.set('currency', customer_currency)
# set pos values in items
for item in self.get("items"):
diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
index 58409cd3c6..c88d67989b 100644
--- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
+++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
@@ -212,8 +212,8 @@ def consolidate_pos_invoices(pos_invoices=[], closing_entry={}):
invoice_by_customer = get_invoice_customer_map(invoices)
if len(invoices) >= 5 and closing_entry:
- enqueue_job(create_merge_logs, invoice_by_customer, closing_entry)
closing_entry.set_status(update=True, status='Queued')
+ enqueue_job(create_merge_logs, invoice_by_customer, closing_entry)
else:
create_merge_logs(invoice_by_customer, closing_entry)
@@ -225,8 +225,8 @@ def unconsolidate_pos_invoices(closing_entry):
)
if len(merge_logs) >= 5:
- enqueue_job(cancel_merge_logs, merge_logs, closing_entry)
closing_entry.set_status(update=True, status='Queued')
+ enqueue_job(cancel_merge_logs, merge_logs, closing_entry)
else:
cancel_merge_logs(merge_logs, closing_entry)
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 21874fe2ca..991eef1d21 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -1521,6 +1521,7 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
parent.flags.ignore_validate_update_after_submit = True
parent.set_qty_as_per_stock_uom()
parent.calculate_taxes_and_totals()
+ parent.set_total_in_words()
if parent_doctype == "Sales Order":
make_packing_list(parent)
parent.set_gross_profit()
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 4b5e347970..2ae9dc7102 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -313,7 +313,7 @@ class StockController(AccountsController):
return serialized_items
def validate_warehouse(self):
- from erpnext.stock.utils import validate_warehouse_company
+ from erpnext.stock.utils import validate_warehouse_company, validate_disabled_warehouse
warehouses = list(set([d.warehouse for d in
self.get("items") if getattr(d, "warehouse", None)]))
@@ -329,6 +329,7 @@ class StockController(AccountsController):
warehouses.extend(from_warehouse)
for w in warehouses:
+ validate_disabled_warehouse(w)
validate_warehouse_company(w, self.company)
def update_billing_percentage(self, update_modified=True):
diff --git a/erpnext/crm/doctype/utils.py b/erpnext/crm/doctype/utils.py
index 4ccd9bd73b..f244daffea 100644
--- a/erpnext/crm/doctype/utils.py
+++ b/erpnext/crm/doctype/utils.py
@@ -78,7 +78,9 @@ def get_scheduled_employees_for_popup(communication_medium):
def strip_number(number):
if not number: return
- # strip 0 from the start of the number for proper number comparisions
+ # strip + and 0 from the start of the number for proper number comparisions
+ # eg. +7888383332 should match with 7888383332
# eg. 07888383332 should match with 7888383332
+ number = number.lstrip('+')
number = number.lstrip('0')
return number
diff --git a/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py b/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py
index ea0d1e982d..a8c7720a0a 100644
--- a/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py
+++ b/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py
@@ -145,7 +145,7 @@ def create_inpatient(patient):
def get_healthcare_service_unit(unit_name=None):
if not unit_name:
- service_unit = get_random("Healthcare Service Unit", filters={"inpatient_occupancy": 1})
+ service_unit = get_random("Healthcare Service Unit", filters={"inpatient_occupancy": 1, "company": "_Test Company"})
else:
service_unit = frappe.db.exists("Healthcare Service Unit", {"healthcare_service_unit_name": unit_name})
diff --git a/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py b/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py
index 0d3f45f500..4b461f1a97 100644
--- a/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py
+++ b/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py
@@ -119,7 +119,7 @@ def create_records(patient):
ip_record.expected_length_of_stay = 0
ip_record.save()
ip_record.reload()
- service_unit = get_healthcare_service_unit()
+ service_unit = get_healthcare_service_unit('Test Service Unit Ip Occupancy')
admit_patient(ip_record, service_unit, now_datetime())
ipmo = create_ipmo(patient)
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index bc1d7628ff..109d9216e7 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -78,7 +78,7 @@ website_generators = ["Item Group", "Item", "BOM", "Sales Partner",
"Job Opening", "Student Admission"]
website_context = {
- "favicon": "/assets/erpnext/images/favicon.png",
+ "favicon": "/assets/erpnext/images/erpnext-favicon.svg",
"splash_image": "/assets/erpnext/images/erpnext-logo.svg"
}
diff --git a/erpnext/hr/doctype/job_offer/job_offer.py b/erpnext/hr/doctype/job_offer/job_offer.py
index c397a3f5ca..7e650f7691 100644
--- a/erpnext/hr/doctype/job_offer/job_offer.py
+++ b/erpnext/hr/doctype/job_offer/job_offer.py
@@ -16,7 +16,7 @@ class JobOffer(Document):
def validate(self):
self.validate_vacancies()
- job_offer = frappe.db.exists("Job Offer",{"job_applicant": self.job_applicant})
+ job_offer = frappe.db.exists("Job Offer",{"job_applicant": self.job_applicant, "docstatus": ["!=", 2]})
if job_offer and job_offer != self.name:
frappe.throw(_("Job Offer: {0} is already for Job Applicant: {1}").format(frappe.bold(job_offer), frappe.bold(self.job_applicant)))
diff --git a/erpnext/hr/doctype/leave_application/leave_application_list.js b/erpnext/hr/doctype/leave_application/leave_application_list.js
index cbb4b73227..a3c03b1bec 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_list.js
+++ b/erpnext/hr/doctype/leave_application/leave_application_list.js
@@ -1,5 +1,6 @@
frappe.listview_settings['Leave Application'] = {
add_fields: ["leave_type", "employee", "employee_name", "total_leave_days", "from_date", "to_date"],
+ has_indicator_for_draft: 1,
get_indicator: function (doc) {
if (doc.status === "Approved") {
return [__("Approved"), "green", "status,=,Approved"];
diff --git a/erpnext/public/images/erp-icon.svg b/erpnext/public/images/erp-icon.svg
deleted file mode 100644
index 6bec40cc62..0000000000
--- a/erpnext/public/images/erp-icon.svg
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
\ No newline at end of file
diff --git a/erpnext/public/images/erpnext-12.svg b/erpnext/public/images/erpnext-12.svg
deleted file mode 100644
index fcc8e46fdd..0000000000
--- a/erpnext/public/images/erpnext-12.svg
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
\ No newline at end of file
diff --git a/erpnext/public/images/erpnext-favicon.svg b/erpnext/public/images/erpnext-favicon.svg
new file mode 100644
index 0000000000..a3ac3bb2ce
--- /dev/null
+++ b/erpnext/public/images/erpnext-favicon.svg
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/erpnext/public/images/erpnext-footer.png b/erpnext/public/images/erpnext-footer.png
deleted file mode 100644
index ffff7756b7..0000000000
Binary files a/erpnext/public/images/erpnext-footer.png and /dev/null differ
diff --git a/erpnext/public/images/erpnext-logo.png b/erpnext/public/images/erpnext-logo.png
deleted file mode 100644
index 115faaa6a8..0000000000
Binary files a/erpnext/public/images/erpnext-logo.png and /dev/null differ
diff --git a/erpnext/public/images/erpnext_logo.svg b/erpnext/public/images/erpnext_logo.svg
deleted file mode 100644
index af3a84953b..0000000000
--- a/erpnext/public/images/erpnext_logo.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
\ No newline at end of file
diff --git a/erpnext/public/images/favicon.png b/erpnext/public/images/favicon.png
deleted file mode 100644
index b6948856f8..0000000000
Binary files a/erpnext/public/images/favicon.png and /dev/null differ
diff --git a/erpnext/public/images/splash.png b/erpnext/public/images/splash.png
deleted file mode 100644
index 8e5d055c66..0000000000
Binary files a/erpnext/public/images/splash.png and /dev/null differ
diff --git a/erpnext/regional/india/e_invoice/utils.py b/erpnext/regional/india/e_invoice/utils.py
index e64be4b645..5f701f2aa6 100644
--- a/erpnext/regional/india/e_invoice/utils.py
+++ b/erpnext/regional/india/e_invoice/utils.py
@@ -23,7 +23,7 @@ def validate_einvoice_fields(doc):
invalid_doctype = doc.doctype != 'Sales Invoice'
invalid_supply_type = doc.get('gst_category') not in ['Registered Regular', 'SEZ', 'Overseas', 'Deemed Export']
company_transaction = doc.get('billing_address_gstin') == doc.get('company_gstin')
- no_taxes_applied = len(doc.get('taxes')) == 0
+ no_taxes_applied = len(doc.get('taxes', [])) == 0
if not einvoicing_enabled or invalid_doctype or invalid_supply_type or company_transaction or no_taxes_applied:
return
diff --git a/erpnext/regional/report/irs_1099/irs_1099.py b/erpnext/regional/report/irs_1099/irs_1099.py
index c1c8aedc9f..4e57ff7ea3 100644
--- a/erpnext/regional/report/irs_1099/irs_1099.py
+++ b/erpnext/regional/report/irs_1099/irs_1099.py
@@ -32,6 +32,10 @@ def execute(filters=None):
data = []
columns = get_columns()
+ conditions = ""
+ if filters.supplier_group:
+ conditions += "AND s.supplier_group = %s" %frappe.db.escape(filters.get("supplier_group"))
+
data = frappe.db.sql("""
SELECT
s.supplier_group as "supplier_group",
@@ -46,15 +50,17 @@ def execute(filters=None):
AND s.irs_1099 = 1
AND gl.fiscal_year = %(fiscal_year)s
AND gl.party_type = "Supplier"
+ AND gl.company = %(company)s
+ {conditions}
+
GROUP BY
gl.party
+
ORDER BY
- gl.party DESC
- """, {
- "fiscal_year": filters.fiscal_year,
- "supplier_group": filters.supplier_group,
- "company": filters.company
- }, as_dict=True)
+ gl.party DESC""".format(conditions=conditions), {
+ "fiscal_year": filters.fiscal_year,
+ "company": filters.company
+ }, as_dict=True)
return columns, data
@@ -79,13 +85,13 @@ def get_columns():
"fieldname": "tax_id",
"label": _("Tax ID"),
"fieldtype": "Data",
- "width": 120
+ "width": 200
},
{
"fieldname": "payments",
"label": _("Total Payments"),
"fieldtype": "Currency",
- "width": 120
+ "width": 200
}
]
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index e259367e58..cbfab8204f 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -325,6 +325,9 @@ class TestSalesOrder(unittest.TestCase):
create_dn_against_so(so.name, 4)
make_sales_invoice(so.name)
+ prev_total = so.get("base_total")
+ prev_total_in_words = so.get("base_in_words")
+
first_item_of_so = so.get("items")[0]
trans_item = json.dumps([
{'item_code' : first_item_of_so.item_code, 'rate' : first_item_of_so.rate, \
@@ -340,6 +343,12 @@ class TestSalesOrder(unittest.TestCase):
self.assertEqual(so.get("items")[-1].amount, 1400)
self.assertEqual(so.status, 'To Deliver and Bill')
+ updated_total = so.get("base_total")
+ updated_total_in_words = so.get("base_in_words")
+
+ self.assertEqual(updated_total, prev_total+1400)
+ self.assertNotEqual(updated_total_in_words, prev_total_in_words)
+
def test_update_child_removing_item(self):
so = make_sales_order(**{
"item_list": [{
diff --git a/erpnext/setup/doctype/customer_group/customer_group.json b/erpnext/setup/doctype/customer_group/customer_group.json
index 10f9bd0030..0e2ed9efcf 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.json
+++ b/erpnext/setup/doctype/customer_group/customer_group.json
@@ -139,7 +139,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
- "modified": "2020-03-18 18:10:13.048492",
+ "modified": "2021-02-08 17:01:52.162202",
"modified_by": "Administrator",
"module": "Setup",
"name": "Customer Group",
@@ -189,6 +189,15 @@
"permlevel": 1,
"read": 1,
"role": "Sales Manager"
+ },
+ {
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "report": 1,
+ "role": "Customer",
+ "select": 1,
+ "share": 1
}
],
"search_fields": "parent_customer_group",
diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json
index 31624edb49..e835214487 100644
--- a/erpnext/setup/doctype/item_group/item_group.json
+++ b/erpnext/setup/doctype/item_group/item_group.json
@@ -214,7 +214,7 @@
"is_tree": 1,
"links": [],
"max_attachments": 3,
- "modified": "2020-12-30 12:57:38.876956",
+ "modified": "2021-02-08 17:02:44.951572",
"modified_by": "Administrator",
"module": "Setup",
"name": "Item Group",
@@ -271,6 +271,15 @@
"read": 1,
"report": 1,
"role": "Accounts User"
+ },
+ {
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "report": 1,
+ "role": "Customer",
+ "select": 1,
+ "share": 1
}
],
"search_fields": "parent_item_group",
diff --git a/erpnext/setup/doctype/territory/territory.json b/erpnext/setup/doctype/territory/territory.json
index aa8e0486f5..a25bda054b 100644
--- a/erpnext/setup/doctype/territory/territory.json
+++ b/erpnext/setup/doctype/territory/territory.json
@@ -123,7 +123,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
- "modified": "2020-03-18 18:11:36.623555",
+ "modified": "2021-02-08 17:10:03.767426",
"modified_by": "Administrator",
"module": "Setup",
"name": "Territory",
@@ -166,6 +166,15 @@
{
"read": 1,
"role": "Maintenance User"
+ },
+ {
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "report": 1,
+ "role": "Customer",
+ "select": 1,
+ "share": 1
}
],
"search_fields": "parent_territory,territory_manager",
diff --git a/erpnext/shopping_cart/product_query.py b/erpnext/shopping_cart/product_query.py
index 8daf3d7dac..36d446ed0f 100644
--- a/erpnext/shopping_cart/product_query.py
+++ b/erpnext/shopping_cart/product_query.py
@@ -23,8 +23,10 @@ class ProductQuery:
self.cart_settings = frappe.get_doc("Shopping Cart Settings")
self.page_length = self.settings.products_per_page or 20
self.fields = ['name', 'item_name', 'item_code', 'website_image', 'variant_of', 'has_variants', 'item_group', 'image', 'web_long_description', 'description', 'route']
- self.filters = [['show_in_website', '=', 1]]
- self.or_filters = []
+ self.filters = []
+ self.or_filters = [['show_in_website', '=', 1]]
+ if not self.settings.get('hide_variants'):
+ self.or_filters.append(['show_variant_in_website', '=', 1])
def query(self, attributes=None, fields=None, search_term=None, start=0):
"""Summary
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
index a5c303ccb4..36d09efd1a 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
@@ -27,10 +27,11 @@ class StockLedgerEntry(Document):
def validate(self):
self.flags.ignore_submit_comment = True
- from erpnext.stock.utils import validate_warehouse_company
+ from erpnext.stock.utils import validate_warehouse_company, validate_disabled_warehouse
self.validate_mandatory()
self.validate_item()
self.validate_batch()
+ validate_disabled_warehouse(self.warehouse)
validate_warehouse_company(self.warehouse, self.company)
self.scrub_posting_time()
self.validate_and_set_fiscal_year()
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index 46919c8c8c..95f8c438b3 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -202,8 +202,7 @@ class update_entries_after(object):
where
item_code = %(item_code)s
and warehouse = %(warehouse)s
- and voucher_type = %(voucher_type)s
- and voucher_no = %(voucher_no)s
+ and timestamp(posting_date, time_format(posting_time, '%H:%i:%s')) = timestamp(%(posting_date)s, time_format(%(posting_time)s, '%H:%i:%s'))
order by
creation ASC
for update
@@ -794,4 +793,4 @@ def get_future_sle_with_negative_qty(args):
and qty_after_transaction + {0} < 0
order by timestamp(posting_date, posting_time) asc
limit 1
- """.format(args.actual_qty), args, as_dict=1)
\ No newline at end of file
+ """.format(args.actual_qty), args, as_dict=1)
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 4ea7e4fcd6..0af3d90822 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe, erpnext
from frappe import _
import json
-from frappe.utils import flt, cstr, nowdate, nowtime
+from frappe.utils import flt, cstr, nowdate, nowtime, get_link_to_form
from six import string_types
@@ -284,6 +284,10 @@ def is_group_warehouse(warehouse):
if frappe.db.get_value("Warehouse", warehouse, "is_group"):
frappe.throw(_("Group node warehouse is not allowed to select for transactions"))
+def validate_disabled_warehouse(warehouse):
+ if frappe.db.get_value("Warehouse", warehouse, "disabled"):
+ frappe.throw(_("Disabled Warehouse {0} cannot be used for this transaction.").format(get_link_to_form('Warehouse', warehouse)))
+
def update_included_uom_in_report(columns, result, include_uom, conversion_factors):
if not include_uom or not conversion_factors:
return