Merge remote-tracking branch 'frappe/develop' into wip-4.1
diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js
index 471fe7e..e39d77b 100644
--- a/erpnext/accounts/doctype/account/account.js
+++ b/erpnext/accounts/doctype/account/account.js
@@ -54,7 +54,6 @@
cur_frm.cscript.account_type = function(doc, cdt, cdn) {
if(doc.group_or_ledger=='Ledger') {
cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax');
- cur_frm.toggle_display('master_type', cstr(doc.account_type)=='');
cur_frm.toggle_display('master_name', doc.account_type=='Warehouse' ||
in_list(['Customer', 'Supplier'], doc.master_type));
}
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index b1edaf4..014dde5 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -11,8 +11,9 @@
nsm_parent_field = 'parent_account'
def onload(self):
- frozen_accounts_modifier = frappe.db.get_value("Accounts Settings", "Accounts Settings", "frozen_accounts_modifier")
- if frozen_accounts_modifier in frappe.user.get_roles():
+ frozen_accounts_modifier = frappe.db.get_value("Accounts Settings", "Accounts Settings",
+ "frozen_accounts_modifier")
+ if not frozen_accounts_modifier or frozen_accounts_modifier in frappe.user.get_roles():
self.get("__onload").can_freeze_account = True
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 348543e..262ac22 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -383,20 +383,20 @@
def get_warehouse(self):
- w = frappe.db.sql("""select warehouse from `tabPOS Setting`
- where ifnull(user,'') = %s and company = %s""",
- (frappe.session['user'], self.company))
- w = w and w[0][0] or ''
- if not w:
- ps = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
+ user_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
+ where ifnull(user,'') = %s and company = %s""", (frappe.session['user'], self.company))
+ warehouse = user_pos_setting[0][1] if user_pos_setting else None
+
+ if not warehouse:
+ global_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
where ifnull(user,'') = '' and company = %s""", self.company)
- if not ps:
+
+ if global_pos_setting:
+ warehouse = global_pos_setting[0][1]
+ elif not user_pos_setting:
msgprint(_("POS Setting required to make POS Entry"), raise_exception=True)
- elif not ps[0][1]:
- msgprint(_("Warehouse required in POS Setting"))
- else:
- w = ps[0][1]
- return w
+
+ return warehouse
def on_update(self):
if cint(self.update_stock) == 1:
@@ -747,7 +747,7 @@
'doctype' : 'Sales Invoice',
'name' : inv,
'description' : msg,
- 'priority' : 'Urgent'
+ 'priority' : 'High'
}
assign_to.add(args)
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 83cec98..bb3ab69 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -238,7 +238,11 @@
frappe.throw(_("Expense or Difference account is mandatory for Item {0} as it impacts overall stock value").format(item.item_code))
else:
- is_expense_account = frappe.db.get_value("Account", item.get("expense_account"), "report_type")=="Profit and Loss"
+ is_expense_account = frappe.db.get_value("Account",
+ item.get("expense_account"), "report_type")=="Profit and Loss"
+ if self.doctype != "Purchase Receipt" and not is_expense_account:
+ frappe.throw(_("Expense / Difference account ({0}) must be a 'Profit or Loss' account")
+ .format(item.get("expense_account")))
if is_expense_account and not item.get("cost_center"):
frappe.throw(_("{0} {1}: Cost Center is mandatory for Item {2}").format(
_(self.doctype), self.name, item.get("item_code")))
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index a59e0e9..e96dcbb 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -370,10 +370,8 @@
if items_to_be_requested:
for item in items_to_be_requested:
item_wrapper = frappe.get_doc("Item", item)
- pr_doc = frappe.get_doc({
- "doctype": "Material Request",
- "__islocal": 1,
- "naming_series": "IDT",
+ pr_doc = frappe.new_doc("Material Request")
+ pr_doc.update({
"transaction_date": nowdate(),
"status": "Draft",
"company": self.company,
diff --git a/erpnext/stock/doctype/serial_no/serial_no.json b/erpnext/stock/doctype/serial_no/serial_no.json
index 3316582..8de04f0 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.json
+++ b/erpnext/stock/doctype/serial_no/serial_no.json
@@ -155,7 +155,7 @@
"fieldtype": "Select",
"label": "Creation Document Type",
"no_copy": 1,
- "options": "\nPurchase Receipt\nStock Entry",
+ "options": "\nPurchase Receipt\nStock Entry\nSerial No",
"permlevel": 0,
"read_only": 1
},
@@ -418,7 +418,7 @@
"icon": "icon-barcode",
"idx": 1,
"in_create": 0,
- "modified": "2014-05-27 03:49:19.131746",
+ "modified": "2014-06-26 12:33:49.911829",
"modified_by": "Administrator",
"module": "Stock",
"name": "Serial No",