frappe/frappe#478, fixed list passed in
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index 2531e17..d321d00 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -77,7 +77,7 @@
def make_entry(args, adv_adj, update_outstanding):
args.update({"doctype": "GL Entry"})
- gle = frappe.get_doc([args])
+ gle = frappe.get_doc(args)
gle.ignore_permissions = 1
gle.insert()
gle.run_method("on_update_with_args", adv_adj, update_outstanding)
diff --git a/erpnext/patches/4_0/customer_discount_to_pricing_rule.py b/erpnext/patches/4_0/customer_discount_to_pricing_rule.py
index 51719c5..a92568e 100644
--- a/erpnext/patches/4_0/customer_discount_to_pricing_rule.py
+++ b/erpnext/patches/4_0/customer_discount_to_pricing_rule.py
@@ -17,7 +17,7 @@
else:
item_group = d.item_group
- frappe.get_doc([{
+ frappe.get_doc({
"doctype": "Pricing Rule",
"apply_on": "Item Group",
"item_group": item_group,
@@ -25,7 +25,7 @@
"customer": d.parent,
"price_or_discount": "Discount",
"discount_percentage": d.discount
- }]).insert()
+ }).insert()
frappe.db.auto_commit_on_many_writes = False
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 77bfca4..7355bd2 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -112,7 +112,7 @@
def import_chart_of_account(self):
chart = frappe.get_doc("Chart of Accounts", self.chart_of_accounts)
- chart.make_controller().create_accounts(self.name)
+ chart.create_accounts(self.name)
def add_acc(self,lst):
account = frappe.get_doc({
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.js b/erpnext/setup/page/setup_wizard/setup_wizard.js
index 8fb8e11..fe2ceb8 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.js
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.js
@@ -40,7 +40,7 @@
title: frappe._("ERPNext Setup Guide"),
welcome_html: '<h1 class="text-muted text-center"><i class="icon-magic"></i></h1>\
<h2 class="text-center">'+frappe._('ERPNext Setup')+'</h2>\
- <p class="text-center">' +
+ <p class="text-center" style="margin: 0px 100px">' +
frappe._('Welcome to ERPNext. Over the next few minutes we will help you setup your ERPNext account. Try and fill in as much information as you have even if it takes a bit longer. It will save you a lot of time later. Good Luck!') +
'</p>',
working_html: '<h3 class="text-muted text-center"><i class="icon-refresh icon-spin"></i></h3>\
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py
index 2a69e10..3f52463 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.py
@@ -73,16 +73,16 @@
def create_fiscal_year_and_company(args):
curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
- frappe.get_doc([{
+ frappe.get_doc({
"doctype":"Fiscal Year",
'year': curr_fiscal_year,
'year_start_date': args.get('fy_start_date'),
'year_end_date': args.get('fy_end_date'),
- }]).insert()
+ }).insert()
print args
# Company
- frappe.get_doc([{
+ frappe.get_doc({
"doctype":"Company",
'domain': args.get("industry"),
'company_name':args.get('company_name'),
@@ -90,27 +90,23 @@
'default_currency':args.get('currency'),
'country': args.get('country'),
'chart_of_accounts': args.get(('chart_of_accounts')),
- }]).insert()
+ }).insert()
args["curr_fiscal_year"] = curr_fiscal_year
def create_price_lists(args):
for pl_type in ["Selling", "Buying"]:
- frappe.get_doc([
- {
+ frappe.get_doc({
"doctype": "Price List",
"price_list_name": "Standard " + pl_type,
"enabled": 1,
"buying": 1 if pl_type == "Buying" else 0,
"selling": 1 if pl_type == "Selling" else 0,
- "currency": args["currency"]
- },
- {
- "doctype": "Applicable Territory",
- "parentfield": "valid_for_territories",
- "territory": "All Territories"
- }
- ]).insert()
+ "currency": args["currency"],
+ "valid_for_territories": {
+ "territory": "All Territories"
+ }
+ }).insert()
def set_defaults(args):
# enable default currency
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index 9cf2020..1d5a6d2 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -31,9 +31,9 @@
from `tabCompany`""", as_dict=1, update={"doctype":":Company"})
def load_country_and_currency(bootinfo):
- if bootinfo.control_panel.country and \
- frappe.db.exists("Country", bootinfo.control_panel.country):
- bootinfo["docs"] += [frappe.get_doc("Country", bootinfo.control_panel.country)]
+ country = frappe.db.get_default("country")
+ if country and frappe.db.exists("Country", country):
+ bootinfo["docs"] += [frappe.get_doc("Country", country)]
bootinfo["docs"] += frappe.db.sql("""select * from tabCurrency
where ifnull(enabled,0)=1""", as_dict=1, update={"doctype":":Currency"})
diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py
index ecdc9c0..14b9f28 100644
--- a/erpnext/stock/doctype/material_request/test_material_request.py
+++ b/erpnext/stock/doctype/material_request/test_material_request.py
@@ -71,39 +71,40 @@
"warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty2)
def _insert_stock_entry(self, qty1, qty2):
- se = frappe.get_doc([
- {
+ se = frappe.get_doc({
"company": "_Test Company",
"doctype": "Stock Entry",
"posting_date": "2013-03-01",
"posting_time": "00:00:00",
"purpose": "Material Receipt",
"fiscal_year": "_Test Fiscal Year 2013",
+ "mtn_details": [
+ {
+ "conversion_factor": 1.0,
+ "doctype": "Stock Entry Detail",
+ "item_code": "_Test Item Home Desktop 100",
+ "parentfield": "mtn_details",
+ "incoming_rate": 100,
+ "qty": qty1,
+ "stock_uom": "_Test UOM 1",
+ "transfer_qty": qty1,
+ "uom": "_Test UOM 1",
+ "t_warehouse": "_Test Warehouse 1 - _TC",
+ },
+ {
+ "conversion_factor": 1.0,
+ "doctype": "Stock Entry Detail",
+ "item_code": "_Test Item Home Desktop 200",
+ "parentfield": "mtn_details",
+ "incoming_rate": 100,
+ "qty": qty2,
+ "stock_uom": "_Test UOM 1",
+ "transfer_qty": qty2,
+ "uom": "_Test UOM 1",
+ "t_warehouse": "_Test Warehouse 1 - _TC",
+ }
+ ]
},
- {
- "conversion_factor": 1.0,
- "doctype": "Stock Entry Detail",
- "item_code": "_Test Item Home Desktop 100",
- "parentfield": "mtn_details",
- "incoming_rate": 100,
- "qty": qty1,
- "stock_uom": "_Test UOM 1",
- "transfer_qty": qty1,
- "uom": "_Test UOM 1",
- "t_warehouse": "_Test Warehouse 1 - _TC",
- },
- {
- "conversion_factor": 1.0,
- "doctype": "Stock Entry Detail",
- "item_code": "_Test Item Home Desktop 200",
- "parentfield": "mtn_details",
- "incoming_rate": 100,
- "qty": qty2,
- "stock_uom": "_Test UOM 1",
- "transfer_qty": qty2,
- "uom": "_Test UOM 1",
- "t_warehouse": "_Test Warehouse 1 - _TC",
- },
])
se.insert()
se.submit()
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index d6b1ef2..7a259f8 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -264,7 +264,7 @@
for serial_no in serial_nos:
if frappe.db.exists("Serial No", serial_no):
sr = frappe.get_doc("Serial No", serial_no)
- sr.make_controller().via_stock_ledger = True
+ sr.via_stock_ledger = True
sr.warehouse = sle.warehouse if sle.actual_qty > 0 else None
sr.save()
elif sle.actual_qty > 0:
@@ -284,7 +284,7 @@
sr.serial_no = serial_no
sr.item_code = sle.item_code
sr.warehouse = None
- sr.make_controller().via_stock_ledger = True
+ sr.via_stock_ledger = True
sr.insert()
sr.warehouse = sle.warehouse
sr.status = "Available"
diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
index a20da19..fca9cb0 100644
--- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
@@ -41,7 +41,7 @@
def make_entry(self, args):
args.update({"doctype": "Stock Ledger Entry"})
- sle = frappe.get_doc([args])
+ sle = frappe.get_doc(args)
sle.ignore_permissions = 1
sle.insert()
return sle.name
diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
index 2f88c56..083879d 100644
--- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
@@ -175,7 +175,7 @@
frappe.db.sql("delete from `tabGL Entry`")
def submit_stock_reconciliation(self, qty, rate, posting_date, posting_time):
- stock_reco = frappe.get_doc([{
+ stock_reco = frappe.get_doc({
"doctype": "Stock Reconciliation",
"posting_date": posting_date,
"posting_time": posting_time,
@@ -187,7 +187,7 @@
["Item Code", "Warehouse", "Quantity", "Valuation Rate"],
["_Test Item", "_Test Warehouse - _TC", qty, rate]
]),
- }])
+ })
stock_reco.insert()
stock_reco.submit()
return stock_reco
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index c8921d6..cf95845 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -49,7 +49,7 @@
def make_entry(args):
args.update({"doctype": "Stock Ledger Entry"})
- sle = frappe.get_doc([args])
+ sle = frappe.get_doc(args)
sle.ignore_permissions = 1
sle.insert()
sle.submit()
@@ -137,11 +137,11 @@
# update bin
if not frappe.db.exists({"doctype": "Bin", "item_code": args["item_code"],
"warehouse": args["warehouse"]}):
- bin_wrapper = frappe.get_doc([{
+ bin_wrapper = frappe.get_doc({
"doctype": "Bin",
"item_code": args["item_code"],
"warehouse": args["warehouse"],
- }])
+ })
bin_wrapper.ignore_permissions = 1
bin_wrapper.insert()
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 343f6c9..0345a7e 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -40,16 +40,15 @@
def get_bin(item_code, warehouse):
bin = frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse})
if not bin:
- bin_wrapper = frappe.get_doc([{
+ bin_obj = frappe.get_doc({
"doctype": "Bin",
"item_code": item_code,
"warehouse": warehouse,
- }])
- bin_wrapper.ignore_permissions = 1
- bin_wrapper.insert()
- bin_obj = bin_wrapper.make_controller()
+ })
+ bin_obj.ignore_permissions = 1
+ bin_obj.insert()
else:
- bin_obj = frappe.get_doc('Bin', bin)
+ bin_obj = frappe.get_doc('Bin', bin)
return bin_obj
def update_bin(args):
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
index b9cc0bc..7178fa2 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
@@ -58,7 +58,7 @@
self.update_amc_date(serial_nos, d.end_date)
if d.sales_person not in email_map:
- sp = frappe.get_doc("Sales Person", d.sales_person).make_controller()
+ sp = frappe.get_doc("Sales Person", d.sales_person)
email_map[d.sales_person] = sp.get_email_id()
scheduled_date = frappe.db.sql("""select scheduled_date from
diff --git a/erpnext/support/doctype/support_ticket/get_support_mails.py b/erpnext/support/doctype/support_ticket/get_support_mails.py
index b36437e..92e9031 100644
--- a/erpnext/support/doctype/support_ticket/get_support_mails.py
+++ b/erpnext/support/doctype/support_ticket/get_support_mails.py
@@ -63,14 +63,14 @@
ticket.ignore_permissions = True
ticket.save()
else:
- ticket = frappe.get_doc([decode_dict({
+ ticket = frappe.get_doc(decode_dict({
"doctype":"Support Ticket",
"description": content,
"subject": subject,
"raised_by": sender,
"content_type": mail.content_type if mail else None,
"status": "Open",
- })])
+ }))
ticket.ignore_permissions = True
ticket.ignore_mandatory = True
ticket.insert()