Merge pull request #14170 from codingCoffee/sal
salary structure patch run if active employee
diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py
index d3a0d1d..ab9b93b 100644
--- a/erpnext/accounts/doctype/budget/budget.py
+++ b/erpnext/accounts/doctype/budget/budget.py
@@ -264,9 +264,12 @@
def get_item_details(args):
cost_center, expense_account = None, None
+ if not args.get('company'):
+ return cost_center, expense_account
+
if args.item_code:
- cost_center, expense_account = frappe.db.get_value('Item',
- args.item_code, ['buying_cost_center', 'expense_account'])
+ cost_center, expense_account = frappe.db.get_value('Item Default',
+ {'parent': args.item_code, 'company': args.get('company')}, ['buying_cost_center', 'expense_account'])
if not (cost_center and expense_account):
for doctype in ['Item Group', 'Company']:
@@ -286,6 +289,6 @@
def get_expense_cost_center(doctype, value):
fields = (['default_cost_center', 'default_expense_account']
- if doctype == 'Item Group'else ['cost_center', 'default_expense_account'])
+ if doctype == 'Item Group' else ['cost_center', 'default_expense_account'])
return frappe.db.get_value(doctype, value, fields)
diff --git a/erpnext/hr/doctype/salary_structure_assignment/salary_structure_assignment.py b/erpnext/hr/doctype/salary_structure_assignment/salary_structure_assignment.py
index 6721749..d4e8ccd 100644
--- a/erpnext/hr/doctype/salary_structure_assignment/salary_structure_assignment.py
+++ b/erpnext/hr/doctype/salary_structure_assignment/salary_structure_assignment.py
@@ -31,7 +31,7 @@
if self.from_date and getdate(self.from_date) > getdate(self.to_date):
frappe.throw(_("From Date {0} cannot be after To Date {1}")
.format(self.from_date, self.to_date))
- if relieving_date and getdate(self.to_date) > relieving_date and not self.flags.old_employee:
+ if relieving_date and getdate(self.to_date) > getdate(relieving_date) and not self.flags.old_employee:
frappe.throw(_("To Date {0} cannot be after employee's relieving Date {1}")
.format(self.to_date, relieving_date))
diff --git a/erpnext/patches/v11_0/create_department_records_for_each_company.py b/erpnext/patches/v11_0/create_department_records_for_each_company.py
index bef524c..17e3ebd 100644
--- a/erpnext/patches/v11_0/create_department_records_for_each_company.py
+++ b/erpnext/patches/v11_0/create_department_records_for_each_company.py
@@ -47,6 +47,9 @@
THEN "%s"
'''%(company, department, records[department]))
+ if not when_then:
+ return
+
frappe.db.sql("""
update
`tab%s`
diff --git a/erpnext/patches/v11_0/make_location_from_warehouse.py b/erpnext/patches/v11_0/make_location_from_warehouse.py
index b838ec9..b5b2e17 100644
--- a/erpnext/patches/v11_0/make_location_from_warehouse.py
+++ b/erpnext/patches/v11_0/make_location_from_warehouse.py
@@ -10,7 +10,7 @@
frappe.reload_doc('stock', 'doctype', 'warehouse')
for d in frappe.get_all('Warehouse',
- fields = ['warehouse_name', 'is_group', 'parent_warehouse'], order_by="is_group desc"):
+ fields = ['warehouse_name', 'is_group', 'parent_warehouse'], order_by="lft asc"):
try:
loc = frappe.new_doc('Location')
loc.location_name = d.warehouse_name
diff --git a/erpnext/patches/v11_0/refactor_erpnext_shopify.py b/erpnext/patches/v11_0/refactor_erpnext_shopify.py
index c8d4de8..d344ae3 100644
--- a/erpnext/patches/v11_0/refactor_erpnext_shopify.py
+++ b/erpnext/patches/v11_0/refactor_erpnext_shopify.py
@@ -22,7 +22,7 @@
def setup_app_type():
shopify_settings = frappe.get_doc("Shopify Settings")
shopify_settings.app_type = 'Private'
- shopify_settings.update_price_in_erpnext_price_list = 0 if shopify_settings.push_prices_to_shopify else 1
+ shopify_settings.update_price_in_erpnext_price_list = 0 if getattr(shopify_settings, 'push_prices_to_shopify', None) else 1
shopify_settings.flags.ignore_mandatory = True
shopify_settings.ignore_permissions = True
shopify_settings.save()
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 62ea2b6..bd49adf 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -58,7 +58,6 @@
$.each(r.message, function(k, v) {
if(!d[k]) d[k] = v;
});
- debugger
}
}
});
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 849a294..4a9c029 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -566,7 +566,7 @@
item = frappe.db.sql("""select i.stock_uom, i.description, i.image, i.item_name, i.item_group,
i.has_batch_no, i.sample_quantity, i.has_serial_no,
id.expense_account, id.buying_cost_center
- from `tabItem`, `tabItem Default` id
+ from `tabItem` i, `tabItem Default` id
where i.name=%s and i.name=id.parent and id.company=%s
and i.disabled=0
and (i.end_of_life is null or i.end_of_life='0000-00-00' or i.end_of_life > %s)""",