frappe/frappe#478
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
index 0559559..b3949ff 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
@@ -18,7 +18,7 @@
if cint(self.auto_accounting_for_stock):
# set default perpetual account in company
for company in frappe.db.sql("select name from tabCompany"):
- frappe.bean("Company", company[0]).save()
+ frappe.get_doc("Company", company[0]).save()
# Create account head for warehouses
warehouse_list = frappe.db.sql("select name, company from tabWarehouse", as_dict=1)
@@ -27,5 +27,5 @@
frappe.throw(_("Company is missing in following warehouses") + ": \n" +
"\n".join(warehouse_with_no_company))
for wh in warehouse_list:
- wh_bean = frappe.bean("Warehouse", wh.name)
+ wh_bean = frappe.get_doc("Warehouse", wh.name)
wh_bean.save()
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py
index 536b199..3be7c04 100644
--- a/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py
+++ b/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py
@@ -36,7 +36,7 @@
child.update(account_properties.get(chart.get("name"), {})\
.get(account_name, {}))
- account = frappe.bean({
+ account = frappe.get_doc({
"doctype": "Account",
"account_name": account_name,
"company": company,
diff --git a/erpnext/accounts/doctype/chart_of_accounts/import_charts.py b/erpnext/accounts/doctype/chart_of_accounts/import_charts.py
index 1d34ab2..fd36bf8 100644
--- a/erpnext/accounts/doctype/chart_of_accounts/import_charts.py
+++ b/erpnext/accounts/doctype/chart_of_accounts/import_charts.py
@@ -13,7 +13,7 @@
chart = json.loads(f.read())
country = frappe.db.get_value("Country", {"code": fname.split("_", 1)[0]})
if country:
- bean = frappe.bean({
+ bean = frappe.get_doc({
"doctype":"Chart of Accounts",
"chart_name": chart.get("name"),
"source_file": fname,
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
index 99aae56..cbb8fd9 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
@@ -347,7 +347,7 @@
@frappe.whitelist()
def get_payment_entry_from_sales_invoice(sales_invoice):
from erpnext.accounts.utils import get_balance_on
- si = frappe.bean("Sales Invoice", sales_invoice)
+ si = frappe.get_doc("Sales Invoice", sales_invoice)
jv = get_payment_entry(si.doc)
jv.remark = 'Payment received against Sales Invoice %(name)s. %(remarks)s' % si.fields
@@ -365,7 +365,7 @@
@frappe.whitelist()
def get_payment_entry_from_purchase_invoice(purchase_invoice):
from erpnext.accounts.utils import get_balance_on
- pi = frappe.bean("Purchase Invoice", purchase_invoice)
+ pi = frappe.get_doc("Purchase Invoice", purchase_invoice)
jv = get_payment_entry(pi.doc)
jv.remark = 'Payment against Purchase Invoice %(name)s. %(remarks)s' % pi.fields
diff --git a/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py
index 0e02e02..20a342d 100644
--- a/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py
+++ b/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py
@@ -9,14 +9,14 @@
class TestJournalVoucher(unittest.TestCase):
def test_journal_voucher_with_against_jv(self):
self.clear_account_balance()
- jv_invoice = frappe.bean(copy=test_records[2])
+ jv_invoice = frappe.get_doc(copy=test_records[2])
jv_invoice.insert()
jv_invoice.submit()
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail`
where against_jv=%s""", jv_invoice.name))
- jv_payment = frappe.bean(copy=test_records[0])
+ jv_payment = frappe.get_doc(copy=test_records[0])
jv_payment.doclist[1].against_jv = jv_invoice.name
jv_payment.insert()
jv_payment.submit()
@@ -37,7 +37,7 @@
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
set_perpetual_inventory()
- jv = frappe.bean(copy=test_records[0])
+ jv = frappe.get_doc(copy=test_records[0])
jv.doclist[1].account = "_Test Warehouse - _TC"
jv.insert()
@@ -50,7 +50,7 @@
frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
self.clear_account_balance()
- jv = frappe.bean(copy=test_records[0])
+ jv = frappe.get_doc(copy=test_records[0])
jv.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
jv.doclist[2].cost_center = "_Test Cost Center - _TC"
jv.doclist[2].debit = 20000.0
@@ -65,7 +65,7 @@
frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
self.clear_account_balance()
- jv = frappe.bean(copy=test_records[0])
+ jv = frappe.get_doc(copy=test_records[0])
jv.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
jv.doclist[2].cost_center = "_Test Cost Center - _TC"
jv.doclist[2].debit = 20000.0
@@ -83,7 +83,7 @@
frappe.db.set_value("Company", "_Test Company", "yearly_bgt_flag", "Stop")
- jv = frappe.bean(copy=test_records[0])
+ jv = frappe.get_doc(copy=test_records[0])
jv.posting_date = "2013-08-12"
jv.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
jv.doclist[2].cost_center = "_Test Cost Center - _TC"
@@ -100,7 +100,7 @@
frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
self.clear_account_balance()
- jv = frappe.bean(copy=test_records[0])
+ jv = frappe.get_doc(copy=test_records[0])
jv.doclist[1].account = "_Test Account Cost for Goods Sold - _TC"
jv.doclist[1].cost_center = "_Test Cost Center - _TC"
jv.doclist[1].credit = 30000.0
@@ -110,7 +110,7 @@
self.assertTrue(frappe.db.get_value("GL Entry",
{"voucher_type": "Journal Voucher", "voucher_no": jv.name}))
- jv1 = frappe.bean(copy=test_records[0])
+ jv1 = frappe.get_doc(copy=test_records[0])
jv1.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
jv1.doclist[2].cost_center = "_Test Cost Center - _TC"
jv1.doclist[2].debit = 40000.0
diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
index b9dca05..9ffe451 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
@@ -12,18 +12,18 @@
frappe.db.sql("""delete from `tabGL Entry`""")
from erpnext.accounts.doctype.journal_voucher.test_journal_voucher import test_records as jv_records
- jv = frappe.bean(copy=jv_records[2])
+ jv = frappe.get_doc(copy=jv_records[2])
jv.insert()
jv.submit()
- jv1 = frappe.bean(copy=jv_records[0])
+ jv1 = frappe.get_doc(copy=jv_records[0])
jv1.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
jv1.doclist[2].debit = 600.0
jv1.doclist[1].credit = 600.0
jv1.insert()
jv1.submit()
- pcv = frappe.bean(copy=test_record)
+ pcv = frappe.get_doc(copy=test_record)
pcv.insert()
pcv.submit()
diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
index 9d1e5da..c1bd319 100644
--- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
@@ -19,7 +19,7 @@
"price": 0,
"discount_percentage": 10,
}]
- frappe.bean(copy=test_record).insert()
+ frappe.get_doc(copy=test_record).insert()
args = frappe._dict({
"item_code": "_Test Item",
@@ -38,7 +38,7 @@
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 10)
- prule = frappe.bean(copy=test_record)
+ prule = frappe.get_doc(copy=test_record)
prule.applicable_for = "Customer"
self.assertRaises(MandatoryError, prule.insert)
prule.customer = "_Test Customer"
@@ -47,7 +47,7 @@
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 20)
- prule = frappe.bean(copy=test_record)
+ prule = frappe.get_doc(copy=test_record)
prule.apply_on = "Item Group"
prule.item_group = "All Item Groups"
prule.discount_percentage = 15
@@ -57,7 +57,7 @@
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 10)
- prule = frappe.bean(copy=test_record)
+ prule = frappe.get_doc(copy=test_record)
prule.applicable_for = "Campaign"
prule.campaign = "_Test Campaign"
prule.discount_percentage = 5
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index f3fae30..fa79c37 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -19,7 +19,7 @@
set_perpetual_inventory(0)
self.assertTrue(not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")))
- wrapper = frappe.bean(copy=test_records[0])
+ wrapper = frappe.get_doc(copy=test_records[0])
wrapper.insert()
wrapper.submit()
wrapper.load_from_db()
@@ -45,7 +45,7 @@
set_perpetual_inventory(1)
self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
- pi = frappe.bean(copy=test_records[1])
+ pi = frappe.get_doc(copy=test_records[1])
pi.insert()
pi.submit()
@@ -73,7 +73,7 @@
set_perpetual_inventory()
self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
- pi = frappe.bean(copy=test_records[1])
+ pi = frappe.get_doc(copy=test_records[1])
pi.doclist[1].item_code = "_Test Non Stock Item"
pi.doclist[1].expense_account = "_Test Account Cost for Goods Sold - _TC"
pi.doclist.pop(2)
@@ -99,7 +99,7 @@
set_perpetual_inventory(0)
def test_purchase_invoice_calculation(self):
- wrapper = frappe.bean(copy=test_records[0])
+ wrapper = frappe.get_doc(copy=test_records[0])
wrapper.insert()
wrapper.load_from_db()
@@ -132,7 +132,7 @@
self.assertEqual(tax.total, expected_values[i][2])
def test_purchase_invoice_with_subcontracted_item(self):
- wrapper = frappe.bean(copy=test_records[0])
+ wrapper = frappe.get_doc(copy=test_records[0])
wrapper.doclist[1].item_code = "_Test FG Item"
wrapper.insert()
wrapper.load_from_db()
@@ -169,11 +169,11 @@
from erpnext.accounts.doctype.journal_voucher.test_journal_voucher \
import test_records as jv_test_records
- jv = frappe.bean(copy=jv_test_records[1])
+ jv = frappe.get_doc(copy=jv_test_records[1])
jv.insert()
jv.submit()
- pi = frappe.bean(copy=test_records[0])
+ pi = frappe.get_doc(copy=test_records[0])
pi.append("advance_allocation_details", {
"journal_voucher": jv.name,
"jv_detail_no": jv.doclist[1].name,
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 449fca0..ccdd99f 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -156,7 +156,7 @@
def update_time_log_batch(self, sales_invoice):
for d in self.doclist.get({"doctype":"Sales Invoice Item"}):
if d.time_log_batch:
- tlb = frappe.bean("Time Log Batch", d.time_log_batch)
+ tlb = frappe.get_doc("Time Log Batch", d.time_log_batch)
tlb.sales_invoice = sales_invoice
tlb.update_after_submit()
@@ -672,7 +672,7 @@
where posting_date=%s and recurring_id=%s and docstatus=1""",
(next_date, recurring_id)):
try:
- ref_wrapper = frappe.bean('Sales Invoice', ref_invoice)
+ ref_wrapper = frappe.get_doc('Sales Invoice', ref_invoice)
new_invoice_wrapper = make_new_invoice(ref_wrapper, next_date)
send_notification(new_invoice_wrapper)
if commit:
@@ -798,7 +798,7 @@
from frappe.model.mapper import get_mapped_doc
def set_missing_values(source, target):
- bean = frappe.bean(target)
+ bean = frappe.get_doc(target)
bean.run_method("onload_post_render")
def update_item(source_doc, target_doc, source_parent):
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 740e752..87c8923 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -10,29 +10,29 @@
class TestSalesInvoice(unittest.TestCase):
def make(self):
- w = frappe.bean(copy=test_records[0])
+ w = frappe.get_doc(copy=test_records[0])
w.is_pos = 0
w.insert()
w.submit()
return w
def test_double_submission(self):
- w = frappe.bean(copy=test_records[0])
+ w = frappe.get_doc(copy=test_records[0])
w.docstatus = '0'
w.insert()
w2 = [d for d in w.doclist]
w.submit()
- w = frappe.bean(w2)
+ w = frappe.get_doc(w2)
self.assertRaises(DocstatusTransitionError, w.submit)
def test_timestamp_change(self):
- w = frappe.bean(copy=test_records[0])
+ w = frappe.get_doc(copy=test_records[0])
w.docstatus = '0'
w.insert()
- w2 = frappe.bean([d.fields.copy() for d in w.doclist])
+ w2 = frappe.get_doc([d.fields.copy() for d in w.doclist])
import time
time.sleep(1)
@@ -43,7 +43,7 @@
self.assertRaises(TimestampMismatchError, w2.save)
def test_sales_invoice_calculation_base_currency(self):
- si = frappe.bean(copy=test_records[2])
+ si = frappe.get_doc(copy=test_records[2])
si.insert()
expected_values = {
@@ -87,7 +87,7 @@
self.assertEquals(si.grand_total_export, 1627.05)
def test_sales_invoice_calculation_export_currency(self):
- si = frappe.bean(copy=test_records[2])
+ si = frappe.get_doc(copy=test_records[2])
si.currency = "USD"
si.conversion_rate = 50
si.doclist[1].rate = 1
@@ -137,7 +137,7 @@
self.assertEquals(si.grand_total_export, 32.54)
def test_sales_invoice_discount_amount(self):
- si = frappe.bean(copy=test_records[3])
+ si = frappe.get_doc(copy=test_records[3])
si.discount_amount = 104.95
si.append("other_charges", {
"doctype": "Sales Taxes and Charges",
@@ -192,7 +192,7 @@
self.assertEquals(si.grand_total_export, 1500)
def test_discount_amount_gl_entry(self):
- si = frappe.bean(copy=test_records[3])
+ si = frappe.get_doc(copy=test_records[3])
si.discount_amount = 104.95
si.append("other_charges", {
"doctype": "Sales Taxes and Charges",
@@ -240,7 +240,7 @@
self.assertFalse(gle)
def test_inclusive_rate_validations(self):
- si = frappe.bean(copy=test_records[2])
+ si = frappe.get_doc(copy=test_records[2])
for i, tax in enumerate(si.get("other_charges")):
tax.idx = i+1
@@ -258,7 +258,7 @@
def test_sales_invoice_calculation_base_currency_with_tax_inclusive_price(self):
# prepare
- si = frappe.bean(copy=test_records[3])
+ si = frappe.get_doc(copy=test_records[3])
si.insert()
expected_values = {
@@ -303,7 +303,7 @@
def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self):
# prepare
- si = frappe.bean(copy=test_records[3])
+ si = frappe.get_doc(copy=test_records[3])
si.currency = "USD"
si.conversion_rate = 50
si.doclist[1].price_list_rate = 55.56
@@ -365,7 +365,7 @@
from erpnext.accounts.doctype.journal_voucher.test_journal_voucher \
import test_records as jv_test_records
- jv = frappe.bean(frappe.copy_doc(jv_test_records[0]))
+ jv = frappe.get_doc(frappe.copy_doc(jv_test_records[0]))
jv.doclist[1].against_invoice = w.name
jv.insert()
jv.submit()
@@ -378,10 +378,10 @@
561.8)
def test_time_log_batch(self):
- tlb = frappe.bean("Time Log Batch", "_T-Time Log Batch-00001")
+ tlb = frappe.get_doc("Time Log Batch", "_T-Time Log Batch-00001")
tlb.submit()
- si = frappe.bean(frappe.copy_doc(test_records[0]))
+ si = frappe.get_doc(frappe.copy_doc(test_records[0]))
si.doclist[1].time_log_batch = "_T-Time Log Batch-00001"
si.insert()
si.submit()
@@ -403,7 +403,7 @@
def test_sales_invoice_gl_entry_without_aii(self):
self.clear_stock_account_balance()
set_perpetual_inventory(0)
- si = frappe.bean(copy=test_records[1])
+ si = frappe.get_doc(copy=test_records[1])
si.insert()
si.submit()
@@ -447,7 +447,7 @@
pos[0]["cash_bank_account"] = "_Test Account Bank Account - _TC"
pos[0]["paid_amount"] = 600.0
- si = frappe.bean(copy=pos)
+ si = frappe.get_doc(copy=pos)
si.insert()
si.submit()
@@ -500,7 +500,7 @@
# insert purchase receipt
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import test_records \
as pr_test_records
- pr = frappe.bean(copy=pr_test_records[0])
+ pr = frappe.get_doc(copy=pr_test_records[0])
pr.naming_series = "_T-Purchase Receipt-"
pr.doclist[1].warehouse = "_Test Warehouse No Account - _TC"
pr.insert()
@@ -511,7 +511,7 @@
si_doclist[0]["posting_time"] = "12:05"
si_doclist[1]["warehouse"] = "_Test Warehouse No Account - _TC"
- si = frappe.bean(copy=si_doclist)
+ si = frappe.get_doc(copy=si_doclist)
si.insert()
si.submit()
@@ -553,7 +553,7 @@
si_copy = frappe.copy_doc(test_records[1])
si_copy[1]["item_code"] = None
- si = frappe.bean(si_copy)
+ si = frappe.get_doc(si_copy)
si.insert()
si.submit()
@@ -580,7 +580,7 @@
set_perpetual_inventory()
si_copy = frappe.copy_doc(test_records[1])
si_copy[1]["item_code"] = "_Test Non Stock Item"
- si = frappe.bean(si_copy)
+ si = frappe.get_doc(si_copy)
si.insert()
si.submit()
@@ -605,7 +605,7 @@
def _insert_purchase_receipt(self):
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import test_records \
as pr_test_records
- pr = frappe.bean(copy=pr_test_records[0])
+ pr = frappe.get_doc(copy=pr_test_records[0])
pr.naming_series = "_T-Purchase Receipt-"
pr.insert()
pr.submit()
@@ -613,7 +613,7 @@
def _insert_delivery_note(self):
from erpnext.stock.doctype.delivery_note.test_delivery_note import test_records \
as dn_test_records
- dn = frappe.bean(copy=dn_test_records[0])
+ dn = frappe.get_doc(copy=dn_test_records[0])
dn.naming_series = "_T-Delivery Note-"
dn.insert()
dn.submit()
@@ -624,18 +624,18 @@
import test_records as pos_setting_test_records
frappe.db.sql("""delete from `tabPOS Setting`""")
- ps = frappe.bean(copy=pos_setting_test_records[0])
+ ps = frappe.get_doc(copy=pos_setting_test_records[0])
ps.insert()
def test_sales_invoice_with_advance(self):
from erpnext.accounts.doctype.journal_voucher.test_journal_voucher \
import test_records as jv_test_records
- jv = frappe.bean(copy=jv_test_records[0])
+ jv = frappe.get_doc(copy=jv_test_records[0])
jv.insert()
jv.submit()
- si = frappe.bean(copy=test_records[0])
+ si = frappe.get_doc(copy=test_records[0])
si.append("advance_adjustment_details", {
"doctype": "Sales Invoice Advance",
"journal_voucher": jv.name,
@@ -665,7 +665,7 @@
from frappe.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
from erpnext.accounts.utils import get_fiscal_year
today = nowdate()
- base_si = frappe.bean(copy=test_records[0])
+ base_si = frappe.get_doc(copy=test_records[0])
base_si.update({
"convert_into_recurring_invoice": 1,
"recurring_type": "Monthly",
@@ -678,13 +678,13 @@
})
# monthly
- si1 = frappe.bean(copy=base_si.doclist)
+ si1 = frappe.get_doc(copy=base_si.doclist)
si1.insert()
si1.submit()
self._test_recurring_invoice(si1, True)
# monthly without a first and last day period
- si2 = frappe.bean(copy=base_si.doclist)
+ si2 = frappe.get_doc(copy=base_si.doclist)
si2.update({
"invoice_period_from_date": today,
"invoice_period_to_date": add_to_date(today, days=30)
@@ -694,7 +694,7 @@
self._test_recurring_invoice(si2, False)
# quarterly
- si3 = frappe.bean(copy=base_si.doclist)
+ si3 = frappe.get_doc(copy=base_si.doclist)
si3.update({
"recurring_type": "Quarterly",
"invoice_period_from_date": get_first_day(today),
@@ -705,7 +705,7 @@
self._test_recurring_invoice(si3, True)
# quarterly without a first and last day period
- si4 = frappe.bean(copy=base_si.doclist)
+ si4 = frappe.get_doc(copy=base_si.doclist)
si4.update({
"recurring_type": "Quarterly",
"invoice_period_from_date": today,
@@ -716,7 +716,7 @@
self._test_recurring_invoice(si4, False)
# yearly
- si5 = frappe.bean(copy=base_si.doclist)
+ si5 = frappe.get_doc(copy=base_si.doclist)
si5.update({
"recurring_type": "Yearly",
"invoice_period_from_date": get_first_day(today),
@@ -727,7 +727,7 @@
self._test_recurring_invoice(si5, True)
# yearly without a first and last day period
- si6 = frappe.bean(copy=base_si.doclist)
+ si6 = frappe.get_doc(copy=base_si.doclist)
si6.update({
"recurring_type": "Yearly",
"invoice_period_from_date": today,
@@ -738,7 +738,7 @@
self._test_recurring_invoice(si6, False)
# change posting date but keep recuring day to be today
- si7 = frappe.bean(copy=base_si.doclist)
+ si7 = frappe.get_doc(copy=base_si.doclist)
si7.update({
"posting_date": add_to_date(today, days=-1)
})
@@ -771,7 +771,7 @@
self.assertEquals(i+2, len(recurred_invoices))
- new_si = frappe.bean("Sales Invoice", recurred_invoices[0][0])
+ new_si = frappe.get_doc("Sales Invoice", recurred_invoices[0][0])
for fieldname in ["convert_into_recurring_invoice", "recurring_type",
"repeat_on_day_of_month", "notification_email_address"]:
@@ -811,7 +811,7 @@
se = make_serialized_item()
serial_nos = get_serial_nos(se.doclist[1].serial_no)
- si = frappe.bean(copy=test_records[0])
+ si = frappe.get_doc(copy=test_records[0])
si.update_stock = 1
si.doclist[1].item_code = "_Test Serialized Item With Series"
si.doclist[1].qty = 1
@@ -845,11 +845,11 @@
se = make_serialized_item()
serial_nos = get_serial_nos(se.doclist[1].serial_no)
- sr = frappe.bean("Serial No", serial_nos[0])
+ sr = frappe.get_doc("Serial No", serial_nos[0])
sr.status = "Not Available"
sr.save()
- si = frappe.bean(copy=test_records[0])
+ si = frappe.get_doc(copy=test_records[0])
si.update_stock = 1
si.doclist[1].item_code = "_Test Serialized Item With Series"
si.doclist[1].qty = 1
diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
index 4085347..fe763e7 100644
--- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
+++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
@@ -7,12 +7,12 @@
class TestShippingRule(unittest.TestCase):
def test_from_greater_than_to(self):
- shipping_rule = frappe.bean(copy=test_records[0])
+ shipping_rule = frappe.get_doc(copy=test_records[0])
shipping_rule.doclist[1].from_value = 101
self.assertRaises(FromGreaterThanToError, shipping_rule.insert)
def test_many_zero_to_values(self):
- shipping_rule = frappe.bean(copy=test_records[0])
+ shipping_rule = frappe.get_doc(copy=test_records[0])
shipping_rule.doclist[1].to_value = 0
self.assertRaises(ManyBlankToValuesError, shipping_rule.insert)
@@ -24,7 +24,7 @@
((50, 150), (25, 175)),
((50, 150), (50, 150)),
]:
- shipping_rule = frappe.bean(copy=test_records[0])
+ shipping_rule = frappe.get_doc(copy=test_records[0])
shipping_rule.doclist[1].from_value = range_a[0]
shipping_rule.doclist[1].to_value = range_a[1]
shipping_rule.doclist[2].from_value = range_b[0]
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index f2eef28..2531e17 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.bean([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/accounts/party.py b/erpnext/accounts/party.py
index 1557e3f..7804734 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -25,7 +25,7 @@
if not ignore_permissions and not frappe.has_permission(party_type, "read", party):
frappe.throw("Not Permitted", frappe.PermissionError)
- party_bean = frappe.bean(party_type, party)
+ party_bean = frappe.get_doc(party_type, party)
party = party_bean.doc
set_address_details(out, party, party_type)
@@ -166,7 +166,7 @@
frappe.throw(_("Please enter Account Receivable/Payable group in company master"))
# create
- account = frappe.bean({
+ account = frappe.get_doc({
"doctype": "Account",
'account_name': party,
'parent_account': parent_account,
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index db13d62..e0c1e3a 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -103,7 +103,7 @@
args = frappe.local.form_dict
args.pop("cmd")
- ac = frappe.bean(args)
+ ac = frappe.get_doc(args)
ac.doctype = "Account"
ac.old_parent = ""
ac.freeze_account = "No"
@@ -116,7 +116,7 @@
args = frappe.local.form_dict
args.pop("cmd")
- cc = frappe.bean(args)
+ cc = frappe.get_doc(args)
cc.doctype = "Cost Center"
cc.old_parent = ""
cc.insert()
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 066afe0..ee68134 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -185,7 +185,7 @@
from frappe.model.mapper import get_mapped_doc
def set_missing_values(source, target):
- bean = frappe.bean(target)
+ bean = frappe.get_doc(target)
bean.run_method("set_missing_values")
def update_item(obj, target, source_parent):
@@ -224,7 +224,7 @@
from frappe.model.mapper import get_mapped_doc
def set_missing_values(source, target):
- bean = frappe.bean(target)
+ bean = frappe.get_doc(target)
bean.run_method("set_missing_values")
def update_item(obj, target, source_parent):
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 1bc7c54..997d6dc 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -11,12 +11,12 @@
def test_make_purchase_receipt(self):
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
- po = frappe.bean(copy=test_records[0]).insert()
+ po = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_purchase_receipt,
po.name)
- po = frappe.bean("Purchase Order", po.name)
+ po = frappe.get_doc("Purchase Order", po.name)
po.submit()
pr = make_purchase_receipt(po.name)
@@ -26,7 +26,7 @@
self.assertEquals(len(pr), len(test_records[0]))
pr[0]["naming_series"] = "_T-Purchase Receipt-"
- pr_bean = frappe.bean(pr)
+ pr_bean = frappe.get_doc(pr)
pr_bean.insert()
def test_ordered_qty(self):
@@ -34,12 +34,12 @@
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
- po = frappe.bean(copy=test_records[0]).insert()
+ po = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_purchase_receipt,
po.name)
- po = frappe.bean("Purchase Order", po.name)
+ po = frappe.get_doc("Purchase Order", po.name)
po.is_subcontracted = "No"
po.doclist[1].item_code = "_Test Item"
po.submit()
@@ -54,7 +54,7 @@
pr[0]["posting_date"] = "2013-05-12"
pr[0]["naming_series"] = "_T-Purchase Receipt-"
pr[1]["qty"] = 4.0
- pr_bean = frappe.bean(pr)
+ pr_bean = frappe.get_doc(pr)
pr_bean.insert()
pr_bean.submit()
@@ -67,7 +67,7 @@
pr1[0]["naming_series"] = "_T-Purchase Receipt-"
pr1[0]["posting_date"] = "2013-05-12"
pr1[1]["qty"] = 8
- pr1_bean = frappe.bean(pr1)
+ pr1_bean = frappe.get_doc(pr1)
pr1_bean.insert()
pr1_bean.submit()
@@ -77,12 +77,12 @@
def test_make_purchase_invoice(self):
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_invoice
- po = frappe.bean(copy=test_records[0]).insert()
+ po = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_purchase_invoice,
po.name)
- po = frappe.bean("Purchase Order", po.name)
+ po = frappe.get_doc("Purchase Order", po.name)
po.submit()
pi = make_purchase_invoice(po.name)
@@ -90,23 +90,23 @@
self.assertEquals(len(pi), len(test_records[0]))
pi[0]["posting_date"] = "2013-05-12"
pi[0]["bill_no"] = "NA"
- frappe.bean(pi).insert()
+ frappe.get_doc(pi).insert()
def test_subcontracting(self):
- po = frappe.bean(copy=test_records[0])
+ po = frappe.get_doc(copy=test_records[0])
po.insert()
self.assertEquals(len(po.get("po_raw_material_details")), 2)
def test_warehouse_company_validation(self):
from erpnext.stock.utils import InvalidWarehouseCompany
- po = frappe.bean(copy=test_records[0])
+ po = frappe.get_doc(copy=test_records[0])
po.company = "_Test Company 1"
po.conversion_rate = 0.0167
self.assertRaises(InvalidWarehouseCompany, po.insert)
def test_uom_integer_validation(self):
from erpnext.utilities.transaction_base import UOMMustBeIntegerError
- po = frappe.bean(copy=test_records[0])
+ po = frappe.get_doc(copy=test_records[0])
po.doclist[1].qty = 3.4
self.assertRaises(UOMMustBeIntegerError, po.insert)
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
index ef48c79..6fced37 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -56,7 +56,7 @@
from frappe.model.mapper import get_mapped_doc
def set_missing_values(source, target):
- bean = frappe.bean(target)
+ bean = frappe.get_doc(target)
bean.run_method("set_missing_values")
bean.run_method("get_schedule_dates")
diff --git a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
index 3e5461a..fc1d25d 100644
--- a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
@@ -11,12 +11,12 @@
def test_make_purchase_order(self):
from erpnext.buying.doctype.supplier_quotation.supplier_quotation import make_purchase_order
- sq = frappe.bean(copy=test_records[0]).insert()
+ sq = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_purchase_order,
sq.name)
- sq = frappe.bean("Supplier Quotation", sq.name)
+ sq = frappe.get_doc("Supplier Quotation", sq.name)
sq.submit()
po = make_purchase_order(sq.name)
@@ -29,7 +29,7 @@
if doc.get("item_code"):
doc["schedule_date"] = "2013-04-12"
- frappe.bean(po).insert()
+ frappe.get_doc(po).insert()
test_records = [
[
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 7ebd1af..4801c75 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -118,7 +118,7 @@
tax_doctype = self.meta.get_field(tax_parentfield).options
from frappe.model import default_fields
- tax_master = frappe.bean(tax_master_doctype, self.get(tax_master_field))
+ tax_master = frappe.get_doc(tax_master_doctype, self.get(tax_master_field))
for i, tax in enumerate(tax_master.get(tax_parentfield)):
for fieldname in default_fields:
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 5495e6f..da4d939 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -35,7 +35,7 @@
if self.customer:
from erpnext.accounts.party import _get_party_details
self.update_if_missing(_get_party_details(self.customer,
- ignore_permissions=self.bean.ignore_permissions))
+ ignore_permissions=self.ignore_permissions))
elif self.lead:
from erpnext.selling.doctype.lead.lead import get_lead_details
@@ -47,7 +47,7 @@
def apply_shipping_rule(self):
if self.shipping_rule:
- shipping_rule = frappe.bean("Shipping Rule", self.shipping_rule)
+ shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule)
value = self.net_total
# TODO
@@ -274,7 +274,7 @@
total_outstanding = total_outstanding[0][0] if total_outstanding else 0
outstanding_including_current = flt(total_outstanding) + flt(grand_total)
- frappe.bean('Account', customer_account).run_method("check_credit_limit",
+ frappe.get_doc('Account', customer_account).run_method("check_credit_limit",
outstanding_including_current)
def validate_max_discount(self):
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 0291eb6..914d80d 100644
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -101,7 +101,7 @@
if not user_wrapper.user_image == self.image:
user_wrapper.user_image = self.image
try:
- frappe.doc({
+ frappe.get_doc({
"doctype": "File Data",
"file_name": self.image,
"attached_to_doctype": "User",
diff --git a/erpnext/hr/doctype/job_applicant/get_job_applications.py b/erpnext/hr/doctype/job_applicant/get_job_applications.py
index c384ccc..a94325d 100644
--- a/erpnext/hr/doctype/job_applicant/get_job_applications.py
+++ b/erpnext/hr/doctype/job_applicant/get_job_applications.py
@@ -9,7 +9,7 @@
class JobsMailbox(POP3Mailbox):
def setup(self, args=None):
- self.settings = args or frappe.doc("Jobs Email Settings", "Jobs Email Settings")
+ self.settings = args or frappe.get_doc("Jobs Email Settings", "Jobs Email Settings")
def process_message(self, mail):
if mail.from_email == self.settings.email_id:
@@ -18,7 +18,7 @@
name = frappe.db.get_value("Job Applicant", {"email_id": mail.from_email},
"name")
if name:
- applicant = frappe.bean("Job Applicant", name)
+ applicant = frappe.get_doc("Job Applicant", name)
if applicant.status!="Rejected":
applicant.status = "Open"
applicant.ignore_permissions = True
@@ -26,7 +26,7 @@
else:
name = (mail.from_real_name and (mail.from_real_name + " - ") or "") \
+ mail.from_email
- applicant = frappe.bean({
+ applicant = frappe.get_doc({
"creation": mail.date,
"doctype":"Job Applicant",
"applicant_name": name,
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index de8bff7..f2f95bf 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -18,7 +18,7 @@
class LeaveApplication(DocListController):
def setup(self):
if frappe.db.exists(self.doctype, self.name):
- self.previous_doc = frappe.doc(self.doctype, self.name)
+ self.previous_doc = frappe.get_doc(self.doctype, self.name)
else:
self.previous_doc = None
@@ -147,7 +147,7 @@
(self.leave_type, max_days))
def validate_leave_approver(self):
- employee = frappe.bean("Employee", self.employee)
+ employee = frappe.get_doc("Employee", self.employee)
leave_approvers = [l.leave_approver for l in
employee.get("employee_leave_approvers")]
@@ -166,7 +166,7 @@
raise_exception=LeaveApproverIdentityError)
def notify_employee(self, status):
- employee = frappe.doc("Employee", self.employee)
+ employee = frappe.get_doc("Employee", self.employee)
if not employee.user_id:
return
@@ -186,7 +186,7 @@
})
def notify_leave_approver(self):
- employee = frappe.doc("Employee", self.employee)
+ employee = frappe.get_doc("Employee", self.employee)
def _get_message(url=False):
name = self.name
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py
index 26cc093..3ed9d56 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.py
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.py
@@ -23,7 +23,7 @@
def _add_employee_leave_approver(self, employee, leave_approver):
temp_session_user = frappe.session.user
frappe.set_user("Administrator")
- employee = frappe.bean("Employee", employee)
+ employee = frappe.get_doc("Employee", employee)
employee.append("employee_leave_approvers", {
"doctype": "Employee Leave Approver",
"leave_approver": leave_approver
diff --git a/erpnext/hr/doctype/salary_manager/salary_manager.py b/erpnext/hr/doctype/salary_manager/salary_manager.py
index cd11598..0079b2e 100644
--- a/erpnext/hr/doctype/salary_manager/salary_manager.py
+++ b/erpnext/hr/doctype/salary_manager/salary_manager.py
@@ -86,7 +86,7 @@
if not frappe.db.sql("""select name from `tabSalary Slip`
where docstatus!= 2 and employee = %s and month = %s and fiscal_year = %s and company = %s
""", (emp[0], self.month, self.fiscal_year, self.company)):
- ss = frappe.bean({
+ ss = frappe.get_doc({
"doctype": "Salary Slip",
"fiscal_year": self.fiscal_year,
"employee": emp[0],
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index e991a8a..c14901a 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -9,7 +9,7 @@
frappe.db.sql("""delete from `tabLeave Application`""")
frappe.db.sql("""delete from `tabSalary Slip`""")
from erpnext.hr.doctype.leave_application.test_leave_application import test_records as leave_applications
- la = frappe.bean(copy=leave_applications[4])
+ la = frappe.get_doc(copy=leave_applications[4])
la.insert()
la.status = "Approved"
la.submit()
@@ -19,7 +19,7 @@
def test_salary_slip_with_holidays_included(self):
frappe.db.set_value("HR Settings", "HR Settings", "include_holidays_in_total_working_days", 1)
- ss = frappe.bean(copy=test_records[0])
+ ss = frappe.get_doc(copy=test_records[0])
ss.insert()
self.assertEquals(ss.total_days_in_month, 31)
self.assertEquals(ss.payment_days, 30)
@@ -31,7 +31,7 @@
self.assertEquals(ss.net_pay, 14867.74)
def test_salary_slip_with_holidays_excluded(self):
- ss = frappe.bean(copy=test_records[0])
+ ss = frappe.get_doc(copy=test_records[0])
ss.insert()
self.assertEquals(ss.total_days_in_month, 30)
self.assertEquals(ss.payment_days, 29)
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py
index 4c01073..09956d1 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.py
@@ -77,7 +77,7 @@
from frappe.model.mapper import get_mapped_doc
def postprocess(source, target):
- sal_slip = frappe.bean(target)
+ sal_slip = frappe.get_doc(target)
sal_slip.run_method("pull_emp_details")
sal_slip.run_method("get_leave_details")
sal_slip.run_method("calculate_net_pay")
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index e3199f9..237c0cd 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -134,11 +134,11 @@
})["rate"]
if self.docstatus == 0:
- frappe.bean(self.doclist).save()
+ frappe.get_doc(self.doclist).save()
elif self.docstatus == 1:
self.calculate_cost()
self.update_exploded_items()
- frappe.bean(self.doclist).update_after_submit()
+ frappe.get_doc(self.doclist).update_after_submit()
def get_bom_unitcost(self, bom_no):
bom = frappe.db.sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index a22088a..f878cd8 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -152,7 +152,7 @@
@frappe.whitelist()
def make_stock_entry(production_order_id, purpose):
- production_order = frappe.bean("Production Order", production_order_id)
+ production_order = frappe.get_doc("Production Order", production_order_id)
stock_entry = frappe.new_bean("Stock Entry")
stock_entry.purpose = purpose
diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py
index 73b7bcf..b3d655a 100644
--- a/erpnext/manufacturing/doctype/production_order/test_production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py
@@ -17,22 +17,22 @@
frappe.db.sql("""delete from `tabBin`""")
frappe.db.sql("""delete from `tabGL Entry`""")
- pro_bean = frappe.bean(copy = test_records[0])
+ pro_bean = frappe.get_doc(copy = test_records[0])
pro_bean.insert()
pro_bean.submit()
from erpnext.stock.doctype.stock_entry.test_stock_entry import test_records as se_test_records
- mr1 = frappe.bean(copy = se_test_records[0])
+ mr1 = frappe.get_doc(copy = se_test_records[0])
mr1.insert()
mr1.submit()
- mr2 = frappe.bean(copy = se_test_records[0])
+ mr2 = frappe.get_doc(copy = se_test_records[0])
mr2.doclist[1].item_code = "_Test Item Home Desktop 100"
mr2.insert()
mr2.submit()
stock_entry = make_stock_entry(pro_bean.name, "Manufacture/Repack")
- stock_entry = frappe.bean(stock_entry)
+ stock_entry = frappe.get_doc(stock_entry)
stock_entry.fiscal_year = "_Test Fiscal Year 2013"
stock_entry.fg_completed_qty = 4
stock_entry.posting_date = "2013-05-12"
@@ -52,7 +52,7 @@
pro_order = self.test_planned_qty()
stock_entry = make_stock_entry(pro_order, "Manufacture/Repack")
- stock_entry = frappe.bean(stock_entry)
+ stock_entry = frappe.get_doc(stock_entry)
stock_entry.posting_date = "2013-05-12"
stock_entry.fiscal_year = "_Test Fiscal Year 2013"
stock_entry.fg_completed_qty = 15
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 cdda05e..39a0d57 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -365,7 +365,7 @@
purchase_request_list = []
if items_to_be_requested:
for item in items_to_be_requested:
- item_wrapper = frappe.bean("Item", item)
+ item_wrapper = frappe.get_doc("Item", item)
pr_doc = frappe.get_doc({
"doctype": "Material Request",
"__islocal": 1,
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 1566301..51719c5 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.bean([{
+ frappe.get_doc([{
"doctype": "Pricing Rule",
"apply_on": "Item Group",
"item_group": item_group,
diff --git a/erpnext/patches/4_0/fix_contact_address.py b/erpnext/patches/4_0/fix_contact_address.py
index fe33230..91d1a0b 100644
--- a/erpnext/patches/4_0/fix_contact_address.py
+++ b/erpnext/patches/4_0/fix_contact_address.py
@@ -4,8 +4,8 @@
frappe.reload_doc("website", "doctype", "contact_us_settings")
address = frappe.db.get_value("Contact Us Settings", None, "address")
if address:
- address = frappe.doc("Address", address)
- contact = frappe.bean("Contact Us Settings", "Contact Us Settings")
+ address = frappe.get_doc("Address", address)
+ contact = frappe.get_doc("Contact Us Settings", "Contact Us Settings")
for f in ("address_title", "address_line1", "address_line2", "city", "state", "country", "pincode"):
contact.set(f, address.get(f))
diff --git a/erpnext/patches/4_0/split_email_settings.py b/erpnext/patches/4_0/split_email_settings.py
index 6f4395b..40aad39 100644
--- a/erpnext/patches/4_0/split_email_settings.py
+++ b/erpnext/patches/4_0/split_email_settings.py
@@ -8,13 +8,13 @@
frappe.reload_doc("core", "doctype", "outgoing_email_settings")
frappe.reload_doc("support", "doctype", "support_email_settings")
- email_settings = frappe.bean("Email Settings")
+ email_settings = frappe.get_doc("Email Settings")
map_outgoing_email_settings(email_settings)
map_support_email_settings(email_settings)
frappe.delete_doc("Doctype", "Email Settings")
def map_outgoing_email_settings(email_settings):
- outgoing_email_settings = frappe.bean("Outgoing Email Settings")
+ outgoing_email_settings = frappe.get_doc("Outgoing Email Settings")
for fieldname in (("outgoing_mail_server", "mail_server"),
"use_ssl", "mail_port", "mail_login", "mail_password",
"always_use_login_id_as_sender",
@@ -30,7 +30,7 @@
outgoing_email_settings.save()
def map_support_email_settings(email_settings):
- support_email_settings = frappe.bean("Support Email Settings")
+ support_email_settings = frappe.get_doc("Support Email Settings")
for fieldname in ("sync_support_mails", "support_email",
("support_host", "mail_server"),
diff --git a/erpnext/patches/4_0/update_user_properties.py b/erpnext/patches/4_0/update_user_properties.py
index 262f7b8..da8635e 100644
--- a/erpnext/patches/4_0/update_user_properties.py
+++ b/erpnext/patches/4_0/update_user_properties.py
@@ -87,7 +87,7 @@
where `tabEmployee Leave Approver`.parent=`tabEmployee`.name)
or ifnull(`reports_to`, '')!=''"""):
- frappe.bean("Employee", employee).save()
+ frappe.get_doc("Employee", employee).save()
def update_permissions():
# clear match conditions other than owner
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index f9c561e..2225acd 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -47,7 +47,7 @@
for milestone in self.get("project_milestones"):
if milestone.milestone_date:
description = (milestone.milestone or "Milestone") + " for " + self.name
- frappe.bean({
+ frappe.get_doc({
"doctype": "Event",
"owner": self.owner,
"subject": description,
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index 9de6b1b..a4dfb47 100644
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -44,7 +44,7 @@
def on_update(self):
"""update percent complete in project"""
if self.project:
- project = frappe.bean("Project", self.project)
+ project = frappe.get_doc("Project", self.project)
project.run_method("update_percent_complete")
@frappe.whitelist()
diff --git a/erpnext/projects/doctype/time_log/test_time_log.py b/erpnext/projects/doctype/time_log/test_time_log.py
index 973e89b..c0bfa75 100644
--- a/erpnext/projects/doctype/time_log/test_time_log.py
+++ b/erpnext/projects/doctype/time_log/test_time_log.py
@@ -8,7 +8,7 @@
class TestTimeLog(unittest.TestCase):
def test_duplication(self):
- ts = frappe.bean(frappe.copy_doc(test_records[0]))
+ ts = frappe.get_doc(frappe.copy_doc(test_records[0]))
self.assertRaises(OverlapError, ts.insert)
test_records = [[{
diff --git a/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py b/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py
index f974d70..e059c04 100644
--- a/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py
+++ b/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py
@@ -6,7 +6,7 @@
class TimeLogBatchTest(unittest.TestCase):
def test_time_log_status(self):
from erpnext.projects.doctype.time_log.test_time_log import test_records as time_log_records
- time_log = frappe.bean(copy=time_log_records[0])
+ time_log = frappe.get_doc(copy=time_log_records[0])
time_log.update({
"from_time": "2013-01-02 10:00:00.000000",
"to_time": "2013-01-02 11:00:00.000000",
@@ -16,7 +16,7 @@
time_log.submit()
self.assertEquals(frappe.db.get_value("Time Log", time_log.name, "status"), "Submitted")
- tlb = frappe.bean(copy=test_records[0])
+ tlb = frappe.get_doc(copy=test_records[0])
tlb.doclist[1].time_log = time_log.name
tlb.insert()
tlb.submit()
diff --git a/erpnext/projects/doctype/time_log_batch/time_log_batch.py b/erpnext/projects/doctype/time_log_batch/time_log_batch.py
index 103eb11..a8e9be8 100644
--- a/erpnext/projects/doctype/time_log_batch/time_log_batch.py
+++ b/erpnext/projects/doctype/time_log_batch/time_log_batch.py
@@ -15,7 +15,7 @@
self.set_status()
self.total_hours = 0.0
for d in self.doclist.get({"doctype":"Time Log Batch Detail"}):
- tl = frappe.doc("Time Log", d.time_log)
+ tl = frappe.get_doc("Time Log", d.time_log)
self.update_time_log_values(d, tl)
self.validate_time_log_is_submitted(tl)
self.total_hours += float(tl.hours or 0.0)
@@ -54,7 +54,7 @@
def update_status(self, time_log_batch):
self.set_status()
for d in self.doclist.get({"doctype":"Time Log Batch Detail"}):
- tl = frappe.bean("Time Log", d.time_log)
+ tl = frappe.get_doc("Time Log", d.time_log)
tl.time_log_batch = time_log_batch
tl.sales_invoice = self.sales_invoice
tl.update_after_submit()
\ No newline at end of file
diff --git a/erpnext/selling/doctype/lead/get_leads.py b/erpnext/selling/doctype/lead/get_leads.py
index 1fe4907..661021e 100644
--- a/erpnext/selling/doctype/lead/get_leads.py
+++ b/erpnext/selling/doctype/lead/get_leads.py
@@ -14,7 +14,7 @@
if not (lead_name or contact_name):
# none, create a new Lead
- lead = frappe.bean({
+ lead = frappe.get_doc({
"doctype":"Lead",
"lead_name": real_name or sender,
"email_id": sender,
@@ -34,12 +34,12 @@
if mail:
# save attachments to parent if from mail
- bean = frappe.bean(parent_doctype, parent_name)
+ bean = frappe.get_doc(parent_doctype, parent_name)
mail.save_attachments_in_doc(bean.doc)
class SalesMailbox(POP3Mailbox):
def setup(self, args=None):
- self.settings = args or frappe.doc("Sales Email Settings", "Sales Email Settings")
+ self.settings = args or frappe.get_doc("Sales Email Settings", "Sales Email Settings")
def process_message(self, mail):
if mail.from_email == self.settings.email_id:
diff --git a/erpnext/selling/doctype/lead/lead.py b/erpnext/selling/doctype/lead/lead.py
index 9852429..9e4ead8 100644
--- a/erpnext/selling/doctype/lead/lead.py
+++ b/erpnext/selling/doctype/lead/lead.py
@@ -127,7 +127,7 @@
from erpnext.accounts.party import set_address_details
out = frappe._dict()
- lead_bean = frappe.bean("Lead", lead)
+ lead_bean = frappe.get_doc("Lead", lead)
lead = lead_bean.doc
out.update({
diff --git a/erpnext/selling/doctype/lead/test_lead.py b/erpnext/selling/doctype/lead/test_lead.py
index 1e64851..a403e93 100644
--- a/erpnext/selling/doctype/lead/test_lead.py
+++ b/erpnext/selling/doctype/lead/test_lead.py
@@ -28,5 +28,5 @@
customer[0]["company"] = "_Test Company"
customer[0]["customer_group"] = "_Test Customer Group"
- frappe.bean(customer).insert()
+ frappe.get_doc(customer).insert()
\ No newline at end of file
diff --git a/erpnext/selling/doctype/opportunity/opportunity.py b/erpnext/selling/doctype/opportunity/opportunity.py
index 8a103be..bd33f04 100644
--- a/erpnext/selling/doctype/opportunity/opportunity.py
+++ b/erpnext/selling/doctype/opportunity/opportunity.py
@@ -109,7 +109,7 @@
def on_submit(self):
if self.lead:
- frappe.bean("Lead", self.lead).get_controller().set_status(update=True)
+ frappe.get_doc("Lead", self.lead).set_status(update=True)
def on_cancel(self):
if self.has_quotation():
@@ -134,7 +134,7 @@
from frappe.model.mapper import get_mapped_doc
def set_missing_values(source, target):
- quotation = frappe.bean(target)
+ quotation = frappe.get_doc(target)
quotation.run_method("onload_post_render")
quotation.run_method("calculate_taxes_and_totals")
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index bcccdaa..ad6d30b 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -55,7 +55,7 @@
def update_opportunity(self):
for opportunity in self.doclist.get_distinct_values("prevdoc_docname"):
- frappe.bean("Opportunity", opportunity).get_controller().set_status(update=True)
+ frappe.get_doc("Opportunity", opportunity).set_status(update=True)
def declare_order_lost(self, arg):
if not self.has_sales_order():
@@ -108,7 +108,7 @@
target[0].customer = customer.name
target[0].customer_name = customer.customer_name
- si = frappe.bean(target)
+ si = frappe.get_doc(target)
si.ignore_permissions = ignore_permissions
si.run_method("onload_post_render")
@@ -147,7 +147,7 @@
if not customer_name:
from erpnext.selling.doctype.lead.lead import _make_customer
customer_doclist = _make_customer(lead_name, ignore_permissions=ignore_permissions)
- customer = frappe.bean(customer_doclist)
+ customer = frappe.get_doc(customer_doclist)
customer.ignore_permissions = ignore_permissions
if quotation[1] == "Shopping Cart":
customer.customer_group = frappe.db.get_value("Shopping Cart Settings", None,
diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py
index b3c6d61..b9f4921 100644
--- a/erpnext/selling/doctype/quotation/test_quotation.py
+++ b/erpnext/selling/doctype/quotation/test_quotation.py
@@ -11,7 +11,7 @@
def test_make_sales_order(self):
from erpnext.selling.doctype.quotation.quotation import make_sales_order
- quotation = frappe.bean(copy=test_records[0])
+ quotation = frappe.get_doc(copy=test_records[0])
quotation.insert()
self.assertRaises(frappe.ValidationError, make_sales_order, quotation.name)
@@ -29,7 +29,7 @@
sales_order[0]["delivery_date"] = "2014-01-01"
sales_order[0]["naming_series"] = "_T-Quotation-"
sales_order[0]["transaction_date"] = "2013-05-12"
- frappe.bean(sales_order).insert()
+ frappe.get_doc(sales_order).insert()
test_records = [
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index ff235b1..f29b36f 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -150,11 +150,11 @@
def update_prevdoc_status(self, flag):
for quotation in self.doclist.get_distinct_values("prevdoc_docname"):
- bean = frappe.bean("Quotation", quotation)
+ bean = frappe.get_doc("Quotation", quotation)
if bean.docstatus==2:
frappe.throw(quotation + ": " + frappe._("Quotation is cancelled."))
- bean.get_controller().set_status(update=True)
+ bean.set_status(update=True)
def on_submit(self):
self.update_stock_ledger(update_stock = 1)
@@ -253,7 +253,7 @@
return "order" if self.docstatus==1 else None
def set_missing_values(source, target):
- bean = frappe.bean(target)
+ bean = frappe.get_doc(target)
bean.run_method("onload_post_render")
@frappe.whitelist()
@@ -322,7 +322,7 @@
@frappe.whitelist()
def make_sales_invoice(source_name, target_doc=None):
def set_missing_values(source, target):
- bean = frappe.bean(target)
+ bean = frappe.get_doc(target)
bean.is_pos = 0
bean.run_method("onload_post_render")
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index 6171a2b..62411b0 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -12,12 +12,12 @@
def test_make_material_request(self):
from erpnext.selling.doctype.sales_order.sales_order import make_material_request
- so = frappe.bean(copy=test_records[0]).insert()
+ so = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_material_request,
so.name)
- sales_order = frappe.bean("Sales Order", so.name)
+ sales_order = frappe.get_doc("Sales Order", so.name)
sales_order.submit()
mr = make_material_request(so.name)
@@ -27,12 +27,12 @@
def test_make_delivery_note(self):
from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note
- so = frappe.bean(copy=test_records[0]).insert()
+ so = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_delivery_note,
so.name)
- sales_order = frappe.bean("Sales Order", so.name)
+ sales_order = frappe.get_doc("Sales Order", so.name)
sales_order.submit()
dn = make_delivery_note(so.name)
@@ -42,12 +42,12 @@
def test_make_sales_invoice(self):
from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
- so = frappe.bean(copy=test_records[0]).insert()
+ so = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_sales_invoice,
so.name)
- sales_order = frappe.bean("Sales Order", so.name)
+ sales_order = frappe.get_doc("Sales Order", so.name)
sales_order.submit()
si = make_sales_invoice(so.name)
@@ -55,7 +55,7 @@
self.assertEquals(len(si), len(sales_order.doclist))
self.assertEquals(len([d for d in si if d["doctype"]=="Sales Invoice Item"]), 1)
- si = frappe.bean(si)
+ si = frappe.get_doc(si)
si.posting_date = "2013-10-10"
si.insert()
si.submit()
@@ -68,7 +68,7 @@
if not so_doclist:
so_doclist = test_records[0]
- w = frappe.bean(copy=so_doclist)
+ w = frappe.get_doc(copy=so_doclist)
w.insert()
w.submit()
@@ -80,7 +80,7 @@
_insert_purchase_receipt(so.doclist[1].item_code)
- dn = frappe.bean(frappe.copy_doc(dn_test_records[0]))
+ dn = frappe.get_doc(frappe.copy_doc(dn_test_records[0]))
dn.doclist[1].item_code = so.doclist[1].item_code
dn.doclist[1].against_sales_order = so.name
dn.doclist[1].prevdoc_detail_docname = so.doclist[1].name
@@ -281,16 +281,16 @@
def test_warehouse_user(self):
frappe.defaults.add_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", "Restriction")
- frappe.bean("User", "test@example.com").get_controller()\
+ frappe.get_doc("User", "test@example.com").get_controller()\
.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
- frappe.bean("User", "test2@example.com").get_controller()\
+ frappe.get_doc("User", "test2@example.com").get_controller()\
.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
frappe.set_user("test@example.com")
from frappe.model.bean import BeanPermissionError
- so = frappe.bean(copy = test_records[0])
+ so = frappe.get_doc(copy = test_records[0])
so.company = "_Test Company 1"
so.conversion_rate = 0.02
so.plc_conversion_rate = 0.02
diff --git a/erpnext/selling/page/sales_browser/sales_browser.py b/erpnext/selling/page/sales_browser/sales_browser.py
index 42839f3..fcb270e 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.py
+++ b/erpnext/selling/page/sales_browser/sales_browser.py
@@ -35,4 +35,4 @@
if ctype == "Sales Person":
doclist[0]["employee"] = frappe.form_dict.get('employee')
- frappe.bean(doclist).save()
\ No newline at end of file
+ frappe.get_doc(doclist).save()
\ No newline at end of file
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 2aa3245..1880ffd 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -61,7 +61,7 @@
stock_group = frappe.db.get_value("Account", {"account_type": "Stock",
"group_or_ledger": "Group"})
if stock_group:
- frappe.bean({
+ frappe.get_doc({
"doctype":"Warehouse",
"warehouse_name": whname,
"company": self.name,
@@ -73,7 +73,7 @@
not frappe.db.sql("select name from tabCompany where name!=%s", self.name):
import os
with open(os.path.join(os.path.dirname(__file__), "sample_home_page.html"), "r") as webfile:
- webpage = frappe.bean({
+ webpage = frappe.get_doc({
"doctype": "Web Page",
"title": self.name + " Home",
"published": 1,
@@ -82,7 +82,7 @@
}).insert()
# update in home page in settings
- website_settings = frappe.bean("Website Settings", "Website Settings")
+ website_settings = frappe.get_doc("Website Settings", "Website Settings")
website_settings.home_page = webpage.name
website_settings.brand_html = self.name
website_settings.copyright = self.name
@@ -97,7 +97,7 @@
"url": "blog"
})
website_settings.save()
- style_settings = frappe.bean("Style Settings", "Style Settings")
+ style_settings = frappe.get_doc("Style Settings", "Style Settings")
style_settings.top_bar_background = "F2F2F2"
style_settings.font_size = "15px"
style_settings.save()
@@ -111,11 +111,11 @@
frappe.db.set(self, "payables_group", "Accounts Payable - " + self.abbr)
def import_chart_of_account(self):
- chart = frappe.bean("Chart of Accounts", self.chart_of_accounts)
+ chart = frappe.get_doc("Chart of Accounts", self.chart_of_accounts)
chart.make_controller().create_accounts(self.name)
def add_acc(self,lst):
- account = frappe.bean({
+ account = frappe.get_doc({
"doctype": "Account",
"freeze_account": "No",
"master_type": "",
@@ -163,7 +163,7 @@
]
for cc in cc_list:
cc.update({"doctype": "Cost Center"})
- cc_bean = frappe.bean(cc)
+ cc_bean = frappe.get_doc(cc)
cc_bean.ignore_permissions = True
if cc.get("cost_center_name") == self.name:
diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py
index 932c45a..691bc72 100644
--- a/erpnext/setup/doctype/company/test_company.py
+++ b/erpnext/setup/doctype/company/test_company.py
@@ -13,7 +13,7 @@
print "Country: ", country
print "Chart Name: ", chart_name
- company_bean = frappe.bean({
+ company_bean = frappe.get_doc({
"doctype": "Company",
"company_name": "_Test Company 2",
"abbr": "_TC2",
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py
index 26b4497..a9896dc 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.py
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.py
@@ -60,7 +60,7 @@
raise_exception=1)
def update_control_panel(self):
- cp_bean = frappe.bean("Control Panel")
+ cp_bean = frappe.get_doc("Control Panel")
if self.country:
cp_bean.country = self.country
if self.time_zone:
diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py
index 2716095..4bdace8 100644
--- a/erpnext/setup/doctype/item_group/test_item_group.py
+++ b/erpnext/setup/doctype/item_group/test_item_group.py
@@ -127,7 +127,7 @@
return get_no_of_children([item_group], 0)
def test_recursion(self):
- group_b = frappe.bean("Item Group", "_Test Item Group B")
+ group_b = frappe.get_doc("Item Group", "_Test Item Group B")
group_b.parent_item_group = "_Test Item Group B - 3"
self.assertRaises(NestedSetRecursionError, group_b.save)
@@ -140,7 +140,7 @@
self.test_basic_tree()
def move_it_back(self):
- group_b = frappe.bean("Item Group", "_Test Item Group B")
+ group_b = frappe.get_doc("Item Group", "_Test Item Group B")
group_b.parent_item_group = "All Item Groups"
group_b.save()
self.test_basic_tree()
@@ -150,7 +150,7 @@
old_lft, old_rgt = frappe.db.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
# put B under C
- group_b = frappe.bean("Item Group", "_Test Item Group B")
+ group_b = frappe.get_doc("Item Group", "_Test Item Group B")
lft, rgt = group_b.lft, group_b.rgt
group_b.parent_item_group = "_Test Item Group C"
@@ -169,7 +169,7 @@
self.move_it_back()
def test_move_group_into_root(self):
- group_b = frappe.bean("Item Group", "_Test Item Group B")
+ group_b = frappe.get_doc("Item Group", "_Test Item Group B")
group_b.parent_item_group = ""
self.assertRaises(NestedSetMultipleRootsError, group_b.save)
@@ -186,7 +186,7 @@
# before move
old_lft, old_rgt = frappe.db.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
- group_b_3 = frappe.bean("Item Group", "_Test Item Group B - 3")
+ group_b_3 = frappe.get_doc("Item Group", "_Test Item Group B - 3")
lft, rgt = group_b_3.lft, group_b_3.rgt
# child of right sibling is moved into it
@@ -203,7 +203,7 @@
self.assertEquals(new_rgt - old_rgt, rgt - lft + 1)
# move it back
- group_b_3 = frappe.bean("Item Group", "_Test Item Group B - 3")
+ group_b_3 = frappe.get_doc("Item Group", "_Test Item Group B - 3")
group_b_3.parent_item_group = "_Test Item Group B"
group_b_3.save()
self.test_basic_tree()
@@ -228,7 +228,7 @@
self.assertEquals(new_rgt, item_group.rgt - 2)
# insert it back
- frappe.bean(copy=test_records[6]).insert()
+ frappe.get_doc(copy=test_records[6]).insert()
self.test_basic_tree()
@@ -243,14 +243,14 @@
self.test_basic_tree(records=records_to_test)
# insert Group B back
- frappe.bean(copy=test_records[3]).insert()
+ frappe.get_doc(copy=test_records[3]).insert()
self.test_basic_tree()
# move its children back
for name in frappe.db.sql_list("""select name from `tabItem Group`
where parent_item_group='_Test Item Group C'"""):
- bean = frappe.bean("Item Group", name)
+ bean = frappe.get_doc("Item Group", name)
bean.parent_item_group = "_Test Item Group B"
bean.save()
@@ -263,7 +263,7 @@
self.test_basic_tree(records=records_to_test)
# insert Group B - 2back
- frappe.bean(copy=test_records[5]).insert()
+ frappe.get_doc(copy=test_records[5]).insert()
self.test_basic_tree()
def test_merge_leaf_into_group(self):
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index 9fe243d..c7955d9 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -24,7 +24,7 @@
for name in data:
country = frappe._dict(data[name])
if not frappe.db.exists("Country", name):
- frappe.doc({
+ frappe.get_doc({
"doctype": "Country",
"country_name": name,
"code": country.code,
@@ -33,7 +33,7 @@
}).insert()
if country.currency and not frappe.db.exists("Currency", country.currency):
- frappe.doc({
+ frappe.get_doc({
"doctype": "Currency",
"currency_name": country.currency,
"fraction": country.currency_fraction,
@@ -111,7 +111,7 @@
from frappe.modules import scrub
for r in records:
- bean = frappe.bean(r)
+ bean = frappe.get_doc(r)
# ignore mandatory for root
parent_link_field = ("parent_" + scrub(bean.doctype))
@@ -122,7 +122,7 @@
def feature_setup():
"""save global defaults and features setup"""
- bean = frappe.bean("Features Setup", "Features Setup")
+ bean = frappe.get_doc("Features Setup", "Features Setup")
bean.ignore_permissions = True
# store value as 1 for all these fields
@@ -142,7 +142,7 @@
where parent=%s""", dt, as_dict=True)
if default_values:
try:
- b = frappe.bean(dt, dt)
+ b = frappe.get_doc(dt, dt)
for fieldname, value in default_values:
b.set(fieldname, value)
b.save()
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py
index 917cfd1..d635e08 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.py
@@ -45,7 +45,7 @@
if args.get("email"):
args['name'] = args.get("email")
frappe.flags.mute_emails = True
- frappe.bean({
+ frappe.get_doc({
"doctype":"User",
"email": args.get("email"),
"first_name": args.get("first_name"),
@@ -73,7 +73,7 @@
def create_fiscal_year_and_company(args):
curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
- frappe.bean([{
+ frappe.get_doc([{
"doctype":"Fiscal Year",
'year': curr_fiscal_year,
'year_start_date': args.get('fy_start_date'),
@@ -82,7 +82,7 @@
print args
# Company
- frappe.bean([{
+ frappe.get_doc([{
"doctype":"Company",
'domain': args.get("industry"),
'company_name':args.get('company_name'),
@@ -96,7 +96,7 @@
def create_price_lists(args):
for pl_type in ["Selling", "Buying"]:
- frappe.bean([
+ frappe.get_doc([
{
"doctype": "Price List",
"price_list_name": "Standard " + pl_type,
@@ -116,7 +116,7 @@
# enable default currency
frappe.db.set_value("Currency", args.get("currency"), "enabled", 1)
- global_defaults = frappe.bean("Global Defaults", "Global Defaults")
+ global_defaults = frappe.get_doc("Global Defaults", "Global Defaults")
global_defaults.update({
'current_fiscal_year': args.curr_fiscal_year,
'default_currency': args.get('currency'),
@@ -128,46 +128,46 @@
})
global_defaults.save()
- accounts_settings = frappe.bean("Accounts Settings")
+ accounts_settings = frappe.get_doc("Accounts Settings")
accounts_settings.auto_accounting_for_stock = 1
accounts_settings.save()
- stock_settings = frappe.bean("Stock Settings")
+ stock_settings = frappe.get_doc("Stock Settings")
stock_settings.item_naming_by = "Item Code"
stock_settings.valuation_method = "FIFO"
stock_settings.stock_uom = "Nos"
stock_settings.auto_indent = 1
stock_settings.save()
- selling_settings = frappe.bean("Selling Settings")
+ selling_settings = frappe.get_doc("Selling Settings")
selling_settings.cust_master_name = "Customer Name"
selling_settings.so_required = "No"
selling_settings.dn_required = "No"
selling_settings.save()
- buying_settings = frappe.bean("Buying Settings")
+ buying_settings = frappe.get_doc("Buying Settings")
buying_settings.supp_master_name = "Supplier Name"
buying_settings.po_required = "No"
buying_settings.pr_required = "No"
buying_settings.maintain_same_rate = 1
buying_settings.save()
- notification_control = frappe.bean("Notification Control")
+ notification_control = frappe.get_doc("Notification Control")
notification_control.quotation = 1
notification_control.sales_invoice = 1
notification_control.purchase_order = 1
notification_control.save()
- hr_settings = frappe.bean("HR Settings")
+ hr_settings = frappe.get_doc("HR Settings")
hr_settings.emp_created_by = "Naming Series"
hr_settings.save()
- email_settings = frappe.bean("Outgoing Email Settings")
+ email_settings = frappe.get_doc("Outgoing Email Settings")
email_settings.send_print_in_body_and_attachment = 1
email_settings.save()
# control panel
- cp = frappe.doc("Control Panel", "Control Panel")
+ cp = frappe.get_doc("Control Panel", "Control Panel")
cp.company_name = args["company_name"]
cp.save()
@@ -186,7 +186,7 @@
companies = frappe.db.sql_list("select name FROM `tabCompany`")
for company in companies:
if not frappe.db.exists("Email Digest", "Default Weekly Digest - " + company):
- edigest = frappe.bean({
+ edigest = frappe.get_doc({
"doctype": "Email Digest",
"name": "Default Weekly Digest - " + company,
"company": company,
@@ -224,7 +224,7 @@
def create_taxes(args):
for i in xrange(1,6):
if args.get("tax_" + str(i)):
- frappe.bean({
+ frappe.get_doc({
"doctype":"Account",
"company": args.get("company_name"),
"parent_account": "Duties and Taxes - " + args.get("company_abbr"),
@@ -240,7 +240,7 @@
item = args.get("item_" + str(i))
if item:
item_group = args.get("item_group_" + str(i))
- frappe.bean({
+ frappe.get_doc({
"doctype":"Item",
"item_code": item,
"item_name": item,
@@ -261,7 +261,7 @@
item = args.get("item_buy_" + str(i))
if item:
item_group = args.get("item_buy_group_" + str(i))
- frappe.bean({
+ frappe.get_doc({
"doctype":"Item",
"item_code": item,
"item_name": item,
@@ -283,7 +283,7 @@
for i in xrange(1,6):
customer = args.get("customer_" + str(i))
if customer:
- frappe.bean({
+ frappe.get_doc({
"doctype":"Customer",
"customer_name": customer,
"customer_type": "Company",
@@ -294,7 +294,7 @@
if args.get("customer_contact_" + str(i)):
contact = args.get("customer_contact_" + str(i)).split(" ")
- frappe.bean({
+ frappe.get_doc({
"doctype":"Contact",
"customer": customer,
"first_name":contact[0],
@@ -305,7 +305,7 @@
for i in xrange(1,6):
supplier = args.get("supplier_" + str(i))
if supplier:
- frappe.bean({
+ frappe.get_doc({
"doctype":"Supplier",
"supplier_name": supplier,
"supplier_type": "Local",
@@ -314,7 +314,7 @@
if args.get("supplier_contact_" + str(i)):
contact = args.get("supplier_contact_" + str(i)).split(" ")
- frappe.bean({
+ frappe.get_doc({
"doctype":"Contact",
"supplier": supplier,
"first_name":contact[0],
@@ -324,7 +324,7 @@
def create_letter_head(args):
if args.get("attach_letterhead"):
- lh = frappe.bean({
+ lh = frappe.get_doc({
"doctype":"Letter Head",
"letter_head_name": "Standard",
"is_default": 1
@@ -349,7 +349,7 @@
root_territory = get_root_of("Territory")
for name in (country, "Rest Of The World"):
if name and not frappe.db.exists("Territory", name):
- frappe.bean({
+ frappe.get_doc({
"doctype": "Territory",
"territory_name": name.replace("'", ""),
"parent_territory": root_territory,
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index fdc20fa..0311cdc 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -19,7 +19,7 @@
load_country_and_currency(bootinfo)
import frappe.model.doctype
- bootinfo['notification_settings'] = frappe.doc("Notification Control",
+ bootinfo['notification_settings'] = frappe.get_doc("Notification Control",
"Notification Control").get_values()
# if no company, show a dialog box to create a new company
@@ -35,7 +35,7 @@
def load_country_and_currency(bootinfo):
if bootinfo.control_panel.country and \
frappe.db.exists("Country", bootinfo.control_panel.country):
- bootinfo["docs"] += [frappe.doc("Country", bootinfo.control_panel.country)]
+ bootinfo["docs"] += [frappe.get_doc("Country", bootinfo.control_panel.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/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index d48024f..ce6986c 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -289,7 +289,7 @@
invoiced_qty_map = get_invoiced_qty_map(source_name)
def update_accounts(source, target):
- si = frappe.bean(target)
+ si = frappe.get_doc(target)
si.is_pos = 0
si.run_method("onload_post_render")
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
index 4c6af1b..1c2becec 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
@@ -13,7 +13,7 @@
if not item_code:
item_code = pr_test_records[0][1]["item_code"]
- pr = frappe.bean(copy=pr_test_records[0])
+ pr = frappe.get_doc(copy=pr_test_records[0])
pr.doclist[1].item_code = item_code
pr.insert()
pr.submit()
@@ -25,12 +25,12 @@
from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice
_insert_purchase_receipt()
- dn = frappe.bean(copy=test_records[0]).insert()
+ dn = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_sales_invoice,
dn.name)
- dn = frappe.bean("Delivery Note", dn.name)
+ dn = frappe.get_doc("Delivery Note", dn.name)
dn.submit()
si = make_sales_invoice(dn.name)
@@ -38,7 +38,7 @@
# modify amount
si[1]["rate"] = 200
- self.assertRaises(frappe.ValidationError, frappe.bean(si).insert)
+ self.assertRaises(frappe.ValidationError, frappe.get_doc(si).insert)
def test_delivery_note_no_gl_entry(self):
@@ -48,7 +48,7 @@
_insert_purchase_receipt()
- dn = frappe.bean(copy=test_records[0])
+ dn = frappe.get_doc(copy=test_records[0])
dn.insert()
dn.submit()
@@ -68,7 +68,7 @@
_insert_purchase_receipt()
- dn = frappe.bean(copy=test_records[0])
+ dn = frappe.get_doc(copy=test_records[0])
dn.doclist[1].expense_account = "Cost of Goods Sold - _TC"
dn.doclist[1].cost_center = "Main - _TC"
@@ -95,7 +95,7 @@
self.assertEquals(bal, prev_bal - 375.0)
# back dated purchase receipt
- pr = frappe.bean(copy=pr_test_records[0])
+ pr = frappe.get_doc(copy=pr_test_records[0])
pr.posting_date = "2013-01-01"
pr.doclist[1].rate = 100
pr.doclist[1].base_amount = 100
@@ -123,7 +123,7 @@
_insert_purchase_receipt()
_insert_purchase_receipt("_Test Item Home Desktop 100")
- dn = frappe.bean(copy=test_records[0])
+ dn = frappe.get_doc(copy=test_records[0])
dn.doclist[1].item_code = "_Test Sales BOM Item"
dn.doclist[1].qty = 1
@@ -162,7 +162,7 @@
se = make_serialized_item()
serial_nos = get_serial_nos(se.doclist[1].serial_no)
- dn = frappe.bean(copy=test_records[0])
+ dn = frappe.get_doc(copy=test_records[0])
dn.doclist[1].item_code = "_Test Serialized Item With Series"
dn.doclist[1].qty = 1
dn.doclist[1].serial_no = serial_nos[0]
@@ -195,11 +195,11 @@
se = make_serialized_item()
serial_nos = get_serial_nos(se.doclist[1].serial_no)
- sr = frappe.bean("Serial No", serial_nos[0])
+ sr = frappe.get_doc("Serial No", serial_nos[0])
sr.status = "Not Available"
sr.save()
- dn = frappe.bean(copy=test_records[0])
+ dn = frappe.get_doc(copy=test_records[0])
dn.doclist[1].item_code = "_Test Serialized Item With Series"
dn.doclist[1].qty = 1
dn.doclist[1].serial_no = serial_nos[0]
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index 8d99b2f..0ad6be2 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -13,7 +13,7 @@
class TestItem(unittest.TestCase):
def test_default_warehouse(self):
from erpnext.stock.doctype.item.item import WarehouseNotSet
- item = frappe.bean(copy=test_records[0])
+ item = frappe.get_doc(copy=test_records[0])
item.is_stock_item = "Yes"
item.default_warehouse = None
self.assertRaises(WarehouseNotSet, item.insert)
diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py
index 4585e38..310c7d9 100644
--- a/erpnext/stock/doctype/item_price/test_item_price.py
+++ b/erpnext/stock/doctype/item_price/test_item_price.py
@@ -8,7 +8,7 @@
class TestItem(unittest.TestCase):
def test_duplicate_item(self):
from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem
- bean = frappe.bean(copy=test_records[0])
+ bean = frappe.get_doc(copy=test_records[0])
self.assertRaises(ItemPriceDuplicateItem, bean.insert)
test_records = [
diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
index 2a80a4d..3850cec 100644
--- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
+++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
@@ -34,7 +34,7 @@
total_amt = self.get_total_pr_amt(purchase_receipts)
for pr in purchase_receipts:
- pr_bean = frappe.bean('Purchase Receipt', pr)
+ pr_bean = frappe.get_doc('Purchase Receipt', pr)
pr_items = pr_bean.get("purchase_tax_details")
for lc in self.get("landed_cost_details"):
@@ -76,7 +76,7 @@
def cancel_pr(self, purchase_receipts):
for pr in purchase_receipts:
- pr_bean = frappe.bean("Purchase Receipt", pr)
+ pr_bean = frappe.get_doc("Purchase Receipt", pr)
pr_bean.run_method("update_ordered_qty")
@@ -87,7 +87,7 @@
def submit_pr(self, purchase_receipts):
for pr in purchase_receipts:
- pr_bean = frappe.bean("Purchase Receipt", pr)
+ pr_bean = frappe.get_doc("Purchase Receipt", pr)
pr_bean.run_method("update_ordered_qty")
pr_bean.run_method("update_stock")
pr_bean.run_method("make_gl_entries")
\ No newline at end of file
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 30ebb1b..c8f38ed 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -218,7 +218,7 @@
})
def set_missing_values(source, target_doc):
- po = frappe.bean(target_doc)
+ po = frappe.get_doc(target_doc)
po.run_method("set_missing_values")
def update_item(obj, target, source_parent):
@@ -343,7 +343,7 @@
def set_missing_values(source, target):
target[0].purpose = "Material Transfer"
- se = frappe.bean(target)
+ se = frappe.get_doc(target)
se.run_method("get_stock_and_rate")
doclist = get_mapped_doc("Material Request", source_name, {
diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py
index f70f14c..66c4dd2 100644
--- a/erpnext/stock/doctype/material_request/test_material_request.py
+++ b/erpnext/stock/doctype/material_request/test_material_request.py
@@ -15,12 +15,12 @@
def test_make_purchase_order(self):
from erpnext.stock.doctype.material_request.material_request import make_purchase_order
- mr = frappe.bean(copy=test_records[0]).insert()
+ mr = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_purchase_order,
mr.name)
- mr = frappe.bean("Material Request", mr.name)
+ mr = frappe.get_doc("Material Request", mr.name)
mr.submit()
po = make_purchase_order(mr.name)
@@ -30,12 +30,12 @@
def test_make_supplier_quotation(self):
from erpnext.stock.doctype.material_request.material_request import make_supplier_quotation
- mr = frappe.bean(copy=test_records[0]).insert()
+ mr = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_supplier_quotation,
mr.name)
- mr = frappe.bean("Material Request", mr.name)
+ mr = frappe.get_doc("Material Request", mr.name)
mr.submit()
sq = make_supplier_quotation(mr.name)
@@ -46,12 +46,12 @@
def test_make_stock_entry(self):
from erpnext.stock.doctype.material_request.material_request import make_stock_entry
- mr = frappe.bean(copy=test_records[0]).insert()
+ mr = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_stock_entry,
mr.name)
- mr = frappe.bean("Material Request", mr.name)
+ mr = frappe.get_doc("Material Request", mr.name)
mr.material_request_type = "Transfer"
mr.submit()
se = make_stock_entry(mr.name)
@@ -71,7 +71,7 @@
"warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty2)
def _insert_stock_entry(self, qty1, qty2):
- se = frappe.bean([
+ se = frappe.get_doc([
{
"company": "_Test Company",
"doctype": "Stock Entry",
@@ -112,7 +112,7 @@
frappe.db.sql("""delete from `tabBin`""")
# submit material request of type Purchase
- mr = frappe.bean(copy=test_records[0])
+ mr = frappe.get_doc(copy=test_records[0])
mr.insert()
mr.submit()
@@ -133,14 +133,14 @@
# check for stopped status of Material Request
- po = frappe.bean(copy=po_doclist)
+ po = frappe.get_doc(copy=po_doclist)
po.insert()
mr.obj.update_status('Stopped')
self.assertRaises(frappe.ValidationError, po.submit)
self.assertRaises(frappe.ValidationError, po.cancel)
mr.obj.update_status('Submitted')
- po = frappe.bean(copy=po_doclist)
+ po = frappe.get_doc(copy=po_doclist)
po.insert()
po.submit()
@@ -160,7 +160,7 @@
frappe.db.sql("""delete from `tabStock Ledger Entry`""")
# submit material request of type Purchase
- mr = frappe.bean(copy=test_records[0])
+ mr = frappe.get_doc(copy=test_records[0])
mr.material_request_type = "Transfer"
mr.insert()
mr.submit()
@@ -196,14 +196,14 @@
self._insert_stock_entry(27.0, 1.5)
# check for stopped status of Material Request
- se = frappe.bean(copy=se_doclist)
+ se = frappe.get_doc(copy=se_doclist)
se.insert()
mr.obj.update_status('Stopped')
self.assertRaises(frappe.ValidationError, se.submit)
self.assertRaises(frappe.ValidationError, se.cancel)
mr.obj.update_status('Submitted')
- se = frappe.bean(copy=se_doclist)
+ se = frappe.get_doc(copy=se_doclist)
se.insert()
se.submit()
@@ -223,7 +223,7 @@
frappe.db.sql("""delete from `tabStock Ledger Entry`""")
# submit material request of type Purchase
- mr = frappe.bean(copy=test_records[0])
+ mr = frappe.get_doc(copy=test_records[0])
mr.material_request_type = "Transfer"
mr.insert()
mr.submit()
@@ -259,14 +259,14 @@
self._insert_stock_entry(60.0, 3.0)
# check for stopped status of Material Request
- se = frappe.bean(copy=se_doclist)
+ se = frappe.get_doc(copy=se_doclist)
se.insert()
mr.obj.update_status('Stopped')
self.assertRaises(frappe.ValidationError, se.submit)
self.assertRaises(frappe.ValidationError, se.cancel)
mr.obj.update_status('Submitted')
- se = frappe.bean(copy=se_doclist)
+ se = frappe.get_doc(copy=se_doclist)
se.insert()
se.submit()
@@ -283,7 +283,7 @@
def test_incorrect_mapping_of_stock_entry(self):
# submit material request of type Purchase
- mr = frappe.bean(copy=test_records[0])
+ mr = frappe.get_doc(copy=test_records[0])
mr.material_request_type = "Transfer"
mr.insert()
mr.submit()
@@ -312,12 +312,12 @@
})
# check for stopped status of Material Request
- se = frappe.bean(copy=se_doclist)
+ se = frappe.get_doc(copy=se_doclist)
self.assertRaises(frappe.MappingMismatchError, se.insert)
def test_warehouse_company_validation(self):
from erpnext.stock.utils import InvalidWarehouseCompany
- mr = frappe.bean(copy=test_records[0])
+ mr = frappe.get_doc(copy=test_records[0])
mr.company = "_Test Company 1"
self.assertRaises(InvalidWarehouseCompany, mr.insert)
diff --git a/erpnext/stock/doctype/price_list/price_list.py b/erpnext/stock/doctype/price_list/price_list.py
index bfb3ea7..7f5d7e7 100644
--- a/erpnext/stock/doctype/price_list/price_list.py
+++ b/erpnext/stock/doctype/price_list/price_list.py
@@ -44,7 +44,7 @@
def on_trash(self):
def _update_default_price_list(module):
- b = frappe.bean(module + " Settings")
+ b = frappe.get_doc(module + " Settings")
price_list_fieldname = module.lower() + "_price_list"
if self.name == b.fields[price_list_fieldname]:
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 74c8cff..f970d94 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -299,7 +299,7 @@
from frappe.model.mapper import get_mapped_doc
def set_missing_values(source, target):
- bean = frappe.bean(target)
+ bean = frappe.get_doc(target)
bean.run_method("set_missing_values")
doclist = get_mapped_doc("Purchase Receipt", source_name, {
diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index 58b8d7d..0b22425 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -14,12 +14,12 @@
set_perpetual_inventory(0)
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
- pr = frappe.bean(copy=test_records[0]).insert()
+ pr = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises(frappe.ValidationError, make_purchase_invoice,
pr.name)
- pr = frappe.bean("Purchase Receipt", pr.name)
+ pr = frappe.get_doc("Purchase Receipt", pr.name)
pr.submit()
pi = make_purchase_invoice(pr.name)
@@ -28,12 +28,12 @@
# modify rate
pi[1]["rate"] = 200
- self.assertRaises(frappe.ValidationError, frappe.bean(pi).submit)
+ self.assertRaises(frappe.ValidationError, frappe.get_doc(pi).submit)
def test_purchase_receipt_no_gl_entry(self):
self._clear_stock_account_balance()
set_perpetual_inventory(0)
- pr = frappe.bean(copy=test_records[0])
+ pr = frappe.get_doc(copy=test_records[0])
pr.insert()
pr.submit()
@@ -56,7 +56,7 @@
set_perpetual_inventory()
self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
- pr = frappe.bean(copy=test_records[0])
+ pr = frappe.get_doc(copy=test_records[0])
pr.insert()
pr.submit()
@@ -90,7 +90,7 @@
frappe.db.sql("""delete from `tabGL Entry`""")
def test_subcontracting(self):
- pr = frappe.bean(copy=test_records[1])
+ pr = frappe.get_doc(copy=test_records[1])
pr.run_method("calculate_taxes_and_totals")
pr.insert()
@@ -98,7 +98,7 @@
self.assertEquals(len(pr.get("pr_raw_material_details")), 2)
def test_serial_no_supplier(self):
- pr = frappe.bean(copy=test_records[0])
+ pr = frappe.get_doc(copy=test_records[0])
pr.doclist[1].item_code = "_Test Serialized Item With Series"
pr.doclist[1].qty = 1
pr.doclist[1].received_qty = 1
@@ -123,7 +123,7 @@
order by account desc""", (voucher_type, voucher_no), as_dict=1)
def set_perpetual_inventory(enable=1):
- accounts_settings = frappe.bean("Accounts Settings")
+ accounts_settings = frappe.get_doc("Accounts Settings")
accounts_settings.auto_accounting_for_stock = enable
accounts_settings.save()
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index 333f3f7..7f4c438 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -66,7 +66,7 @@
"""
Validate whether serial no is required for this item
"""
- item = frappe.doc("Item", self.item_code)
+ item = frappe.get_doc("Item", self.item_code)
if item.has_serial_no!="Yes":
frappe.throw(_("Item must have 'Has Serial No' as 'Yes'") + ": " + self.item_code)
@@ -223,7 +223,7 @@
for serial_no in serial_nos:
if frappe.db.exists("Serial No", serial_no):
- sr = frappe.bean("Serial No", serial_no)
+ sr = frappe.get_doc("Serial No", serial_no)
if sr.item_code!=sle.item_code:
frappe.throw(_("Serial No does not belong to Item") +
@@ -263,7 +263,7 @@
serial_nos = get_serial_nos(sle.serial_no)
for serial_no in serial_nos:
if frappe.db.exists("Serial No", serial_no):
- sr = frappe.bean("Serial No", serial_no)
+ sr = frappe.get_doc("Serial No", serial_no)
sr.make_controller().via_stock_ledger = True
sr.warehouse = sle.warehouse if sle.actual_qty > 0 else None
sr.save()
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index eeb8d82..92f7746 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -337,7 +337,7 @@
self.production_order)
if self.production_order:
- pro_bean = frappe.bean("Production Order", self.production_order)
+ pro_bean = frappe.get_doc("Production Order", self.production_order)
_validate_production_order(pro_bean)
self.update_produced_qty(pro_bean)
if self.purpose == "Manufacture/Repack":
@@ -749,7 +749,7 @@
@frappe.whitelist()
def make_return_jv(stock_entry):
- se = frappe.bean("Stock Entry", stock_entry)
+ se = frappe.get_doc("Stock Entry", stock_entry)
if not se.purpose in ["Sales Return", "Purchase Return"]:
return
@@ -840,7 +840,7 @@
for se_item in se.get("mtn_details"):
for sales_invoice in invoices_against_delivery:
- si = frappe.bean("Sales Invoice", sales_invoice)
+ si = frappe.get_doc("Sales Invoice", sales_invoice)
if se_item.item_code in packing_item_parent_map:
ref_item = si.doclist.get({"item_code": packing_item_parent_map[se_item.item_code]})
@@ -897,7 +897,7 @@
for se_item in se.get("mtn_details"):
for purchase_invoice in invoice_against_receipt:
- pi = frappe.bean("Purchase Invoice", purchase_invoice)
+ pi = frappe.get_doc("Purchase Invoice", purchase_invoice)
ref_item = pi.doclist.get({"item_code": se_item.item_code})
if not ref_item:
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index bcdc0fe..db816fd 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -22,11 +22,11 @@
frappe.db.set_value("Stock Settings", None, "auto_indent", True)
- st1 = frappe.bean(copy=test_records[0])
+ st1 = frappe.get_doc(copy=test_records[0])
st1.insert()
st1.submit()
- st2 = frappe.bean(copy=test_records[1])
+ st2 = frappe.get_doc(copy=test_records[1])
st2.insert()
st2.submit()
@@ -45,7 +45,7 @@
self._clear_stock_account_balance()
set_perpetual_inventory()
- mr = frappe.bean(copy=test_records[0])
+ mr = frappe.get_doc(copy=test_records[0])
mr.insert()
mr.submit()
@@ -77,7 +77,7 @@
self._insert_material_receipt()
- mi = frappe.bean(copy=test_records[1])
+ mi = frappe.get_doc(copy=test_records[1])
mi.insert()
mi.submit()
@@ -113,7 +113,7 @@
self._insert_material_receipt()
- mtn = frappe.bean(copy=test_records[2])
+ mtn = frappe.get_doc(copy=test_records[2])
mtn.insert()
mtn.submit()
@@ -149,7 +149,7 @@
self._insert_material_receipt()
- repack = frappe.bean(copy=test_records[3])
+ repack = frappe.get_doc(copy=test_records[3])
repack.insert()
repack.submit()
@@ -170,7 +170,7 @@
self._insert_material_receipt()
- repack = frappe.bean(copy=test_records[3])
+ repack = frappe.get_doc(copy=test_records[3])
repack.doclist[2].incoming_rate = 6000
repack.insert()
repack.submit()
@@ -218,11 +218,11 @@
def _insert_material_receipt(self):
self._clear_stock_account_balance()
- se1 = frappe.bean(copy=test_records[0])
+ se1 = frappe.get_doc(copy=test_records[0])
se1.insert()
se1.submit()
- se2 = frappe.bean(copy=test_records[0])
+ se2 = frappe.get_doc(copy=test_records[0])
se2.doclist[1].item_code = "_Test Item Home Desktop 100"
se2.insert()
se2.submit()
@@ -240,11 +240,11 @@
import test_records as sales_invoice_test_records
# invalid sales invoice as update stock not checked
- si = frappe.bean(copy=sales_invoice_test_records[1])
+ si = frappe.get_doc(copy=sales_invoice_test_records[1])
si.insert()
si.submit()
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Sales Return"
se.sales_invoice_no = si.name
se.doclist[1].qty = returned_qty
@@ -257,7 +257,7 @@
actual_qty_0 = self._get_actual_qty()
# insert a pos invoice with update stock
- si = frappe.bean(copy=sales_invoice_test_records[1])
+ si = frappe.get_doc(copy=sales_invoice_test_records[1])
si.is_pos = si.update_stock = 1
si.doclist[1].warehouse = "_Test Warehouse - _TC"
si.doclist[1].item_code = item_code
@@ -271,7 +271,7 @@
self.assertEquals(actual_qty_0 - delivered_qty, actual_qty_1)
# check if item is validated
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Sales Return"
se.sales_invoice_no = si.name
se.posting_date = "2013-03-10"
@@ -284,7 +284,7 @@
self.assertRaises(frappe.DoesNotExistError, se.insert)
# try again
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Sales Return"
se.posting_date = "2013-03-10"
se.fiscal_year = "_Test Fiscal Year 2013"
@@ -321,7 +321,7 @@
actual_qty_0 = self._get_actual_qty()
# make a delivery note based on this invoice
- dn = frappe.bean(copy=delivery_note_test_records[0])
+ dn = frappe.get_doc(copy=delivery_note_test_records[0])
dn.doclist[1].item_code = item_code
dn.insert()
dn.submit()
@@ -332,7 +332,7 @@
si_doclist = make_sales_invoice(dn.name)
- si = frappe.bean(si_doclist)
+ si = frappe.get_doc(si_doclist)
si.posting_date = dn.posting_date
si.debit_to = "_Test Customer - _TC"
for d in si.get("entries"):
@@ -342,7 +342,7 @@
si.submit()
# insert and submit stock entry for sales return
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Sales Return"
se.delivery_note_no = dn.name
se.posting_date = "2013-03-10"
@@ -410,7 +410,7 @@
actual_qty_0 = self._get_actual_qty()
- so = frappe.bean(copy=sales_order_test_records[0])
+ so = frappe.get_doc(copy=sales_order_test_records[0])
so.doclist[1].item_code = item_code
so.doclist[1].qty = 5.0
so.insert()
@@ -418,7 +418,7 @@
dn_doclist = make_delivery_note(so.name)
- dn = frappe.bean(dn_doclist)
+ dn = frappe.get_doc(dn_doclist)
dn.status = "Draft"
dn.posting_date = so.delivery_date
dn.insert()
@@ -430,7 +430,7 @@
si_doclist = make_sales_invoice(so.name)
- si = frappe.bean(si_doclist)
+ si = frappe.get_doc(si_doclist)
si.posting_date = dn.posting_date
si.debit_to = "_Test Customer - _TC"
for d in si.get("entries"):
@@ -440,7 +440,7 @@
si.submit()
# insert and submit stock entry for sales return
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Sales Return"
se.delivery_note_no = dn.name
se.posting_date = "2013-03-10"
@@ -466,7 +466,7 @@
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
# submit purchase receipt
- pr = frappe.bean(copy=purchase_receipt_test_records[0])
+ pr = frappe.get_doc(copy=purchase_receipt_test_records[0])
pr.insert()
pr.submit()
@@ -476,7 +476,7 @@
pi_doclist = make_purchase_invoice(pr.name)
- pi = frappe.bean(pi_doclist)
+ pi = frappe.get_doc(pi_doclist)
pi.posting_date = pr.posting_date
pi.credit_to = "_Test Supplier - _TC"
for d in pi.get("entries"):
@@ -492,7 +492,7 @@
pi.submit()
# submit purchase return
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Purchase Return"
se.purchase_receipt_no = pr.name
se.posting_date = "2013-03-01"
@@ -518,7 +518,7 @@
prev_se, pr_docname = self.test_purchase_receipt_return()
# submit purchase return - return another 6 qtys so that exception is raised
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Purchase Return"
se.purchase_receipt_no = pr_docname
se.posting_date = "2013-03-01"
@@ -559,7 +559,7 @@
make_purchase_receipt, make_purchase_invoice
# submit purchase receipt
- po = frappe.bean(copy=purchase_order_test_records[0])
+ po = frappe.get_doc(copy=purchase_order_test_records[0])
po.is_subcontracted = None
po.doclist[1].item_code = "_Test Item"
po.doclist[1].rate = 50
@@ -568,7 +568,7 @@
pr_doclist = make_purchase_receipt(po.name)
- pr = frappe.bean(pr_doclist)
+ pr = frappe.get_doc(pr_doclist)
pr.posting_date = po.transaction_date
pr.insert()
pr.submit()
@@ -579,7 +579,7 @@
pi_doclist = make_purchase_invoice(po.name)
- pi = frappe.bean(pi_doclist)
+ pi = frappe.get_doc(pi_doclist)
pi.posting_date = pr.posting_date
pi.credit_to = "_Test Supplier - _TC"
for d in pi.get("entries"):
@@ -594,7 +594,7 @@
pi.submit()
# submit purchase return
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Purchase Return"
se.purchase_receipt_no = pr.name
se.posting_date = "2013-03-01"
@@ -621,13 +621,13 @@
frappe.db.set_default("company", "_Test Company")
def test_serial_no_not_reqd(self):
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.doclist[1].serial_no = "ABCD"
se.insert()
self.assertRaises(SerialNoNotRequiredError, se.submit)
def test_serial_no_reqd(self):
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.doclist[1].item_code = "_Test Serialized Item"
se.doclist[1].qty = 2
se.doclist[1].transfer_qty = 2
@@ -635,7 +635,7 @@
self.assertRaises(SerialNoRequiredError, se.submit)
def test_serial_no_qty_more(self):
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.doclist[1].item_code = "_Test Serialized Item"
se.doclist[1].qty = 2
se.doclist[1].serial_no = "ABCD\nEFGH\nXYZ"
@@ -644,7 +644,7 @@
self.assertRaises(SerialNoQtyError, se.submit)
def test_serial_no_qty_less(self):
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.doclist[1].item_code = "_Test Serialized Item"
se.doclist[1].qty = 2
se.doclist[1].serial_no = "ABCD"
@@ -654,7 +654,7 @@
def test_serial_no_transfer_in(self):
self._clear_stock_account_balance()
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.doclist[1].item_code = "_Test Serialized Item"
se.doclist[1].qty = 2
se.doclist[1].serial_no = "ABCD\nEFGH"
@@ -670,7 +670,7 @@
def test_serial_no_not_exists(self):
self._clear_stock_account_balance()
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Material Issue"
se.doclist[1].item_code = "_Test Serialized Item"
se.doclist[1].qty = 2
@@ -685,7 +685,7 @@
self._clear_stock_account_balance()
self.test_serial_by_series()
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.doclist[1].item_code = "_Test Serialized Item With Series"
se.doclist[1].qty = 1
se.doclist[1].serial_no = "ABCD00001"
@@ -708,7 +708,7 @@
self._clear_stock_account_balance()
self.test_serial_by_series()
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Material Transfer"
se.doclist[1].item_code = "_Test Serialized Item"
se.doclist[1].qty = 1
@@ -724,7 +724,7 @@
se = make_serialized_item()
serial_no = get_serial_nos(se.doclist[1].serial_no)[0]
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Material Transfer"
se.doclist[1].item_code = "_Test Serialized Item With Series"
se.doclist[1].qty = 1
@@ -743,7 +743,7 @@
self._clear_stock_account_balance()
make_serialized_item()
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.purpose = "Material Transfer"
se.doclist[1].item_code = "_Test Serialized Item With Series"
se.doclist[1].qty = 1
@@ -765,12 +765,12 @@
def test_warehouse_company_validation(self):
set_perpetual_inventory(0)
self._clear_stock_account_balance()
- frappe.bean("User", "test2@example.com").get_controller()\
+ frappe.get_doc("User", "test2@example.com").get_controller()\
.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
frappe.set_user("test2@example.com")
from erpnext.stock.utils import InvalidWarehouseCompany
- st1 = frappe.bean(copy=test_records[0])
+ st1 = frappe.get_doc(copy=test_records[0])
st1.doclist[1].t_warehouse="_Test Warehouse 2 - _TC1"
st1.insert()
self.assertRaises(InvalidWarehouseCompany, st1.submit)
@@ -783,19 +783,19 @@
frappe.defaults.add_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", "Restriction")
frappe.defaults.add_default("Warehouse", "_Test Warehouse 2 - _TC1", "test2@example.com", "Restriction")
- frappe.bean("User", "test@example.com").get_controller()\
+ frappe.get_doc("User", "test@example.com").get_controller()\
.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
- frappe.bean("User", "test2@example.com").get_controller()\
+ frappe.get_doc("User", "test2@example.com").get_controller()\
.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
frappe.set_user("test@example.com")
- st1 = frappe.bean(copy=test_records[0])
+ st1 = frappe.get_doc(copy=test_records[0])
st1.company = "_Test Company 1"
st1.doclist[1].t_warehouse="_Test Warehouse 2 - _TC1"
self.assertRaises(BeanPermissionError, st1.insert)
frappe.set_user("test2@example.com")
- st1 = frappe.bean(copy=test_records[0])
+ st1 = frappe.get_doc(copy=test_records[0])
st1.company = "_Test Company 1"
st1.doclist[1].t_warehouse="_Test Warehouse 2 - _TC1"
st1.insert()
@@ -811,18 +811,18 @@
# test freeze_stocks_upto
date_newer_than_test_records = add_days(getdate(test_records[0][0]['posting_date']), 5)
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto", date_newer_than_test_records)
- se = frappe.bean(copy=test_records[0]).insert()
+ se = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises (StockFreezeError, se.submit)
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto", '')
# test freeze_stocks_upto_days
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 7)
- se = frappe.bean(copy=test_records[0]).insert()
+ se = frappe.get_doc(copy=test_records[0]).insert()
self.assertRaises (StockFreezeError, se.submit)
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 0)
def make_serialized_item():
- se = frappe.bean(copy=test_records[0])
+ se = frappe.get_doc(copy=test_records[0])
se.doclist[1].item_code = "_Test Serialized Item With Series"
se.doclist[1].qty = 2
se.doclist[1].transfer_qty = 2
diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
index d0fe60a..4f287ac 100644
--- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
@@ -42,7 +42,7 @@
def make_entry(self, args):
args.update({"doctype": "Stock Ledger Entry"})
- sle = frappe.bean([args])
+ sle = frappe.get_doc([args])
sle.ignore_permissions = 1
sle.insert()
return sle.name
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 60f37e1..2ddf831 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -97,7 +97,7 @@
# using try except to catch all validation msgs and display together
try:
- item = frappe.doc("Item", item_code)
+ item = frappe.get_doc("Item", item_code)
# end of life and stock item
validate_end_of_life(item_code, item.end_of_life, verbose=0)
diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
index ca1519c..0438d6e 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.bean([{
+ stock_reco = frappe.get_doc([{
"doctype": "Stock Reconciliation",
"posting_date": posting_date,
"posting_time": posting_time,
@@ -221,11 +221,11 @@
},
]
- pr = frappe.bean(copy=stock_entry)
+ pr = frappe.get_doc(copy=stock_entry)
pr.insert()
pr.submit()
- pr1 = frappe.bean(copy=stock_entry)
+ pr1 = frappe.get_doc(copy=stock_entry)
pr1.posting_date = "2012-12-15"
pr1.posting_time = "02:00"
pr1.doclist[1].qty = 10
@@ -234,7 +234,7 @@
pr1.insert()
pr1.submit()
- pr2 = frappe.bean(copy=stock_entry)
+ pr2 = frappe.get_doc(copy=stock_entry)
pr2.posting_date = "2012-12-25"
pr2.posting_time = "03:00"
pr2.purpose = "Material Issue"
@@ -246,7 +246,7 @@
pr2.insert()
pr2.submit()
- pr3 = frappe.bean(copy=stock_entry)
+ pr3 = frappe.get_doc(copy=stock_entry)
pr3.posting_date = "2012-12-31"
pr3.posting_time = "08:00"
pr3.purpose = "Material Issue"
@@ -259,7 +259,7 @@
pr3.submit()
- pr4 = frappe.bean(copy=stock_entry)
+ pr4 = frappe.get_doc(copy=stock_entry)
pr4.posting_date = "2013-01-05"
pr4.fiscal_year = "_Test Fiscal Year 2013"
pr4.posting_time = "07:00"
diff --git a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
index 28972d3..48f5a3d 100644
--- a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
+++ b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
@@ -34,7 +34,7 @@
raise Exception
def update_item_master(self):
- item_bean = frappe.bean("Item", self.item_code)
+ item_bean = frappe.get_doc("Item", self.item_code)
item_bean.stock_uom = self.new_stock_uom
item_bean.save()
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index d621985..0bb70a5 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -28,7 +28,7 @@
{"account_type": "Warehouse", "company": self.company,
"master_name": self.name}, ["name", "parent_account"])
if warehouse_account and warehouse_account[1] != self.create_account_under:
- acc_bean = frappe.bean("Account", warehouse_account[0])
+ acc_bean = frappe.get_doc("Account", warehouse_account[0])
acc_bean.parent_account = self.create_account_under
acc_bean.save()
@@ -43,7 +43,7 @@
if self.get("__islocal") or not frappe.db.get_value(
"Stock Ledger Entry", {"warehouse": self.name}):
self.validate_parent_account()
- ac_bean = frappe.bean({
+ ac_bean = frappe.get_doc({
"doctype": "Account",
'account_name': self.warehouse_name,
'parent_account': self.create_account_under,
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 1bf431a..f4588f5 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -47,7 +47,7 @@
elif not args.item_code and args.serial_no:
args.item_code = get_item_code(serial_no=args.serial_no)
- item_bean = frappe.bean("Item", args.item_code)
+ item_bean = frappe.get_doc("Item", args.item_code)
item = item_bean.doc
validate_item_details(args, item)
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index e812285..c8921d6 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.bean([args])
+ sle = frappe.get_doc([args])
sle.ignore_permissions = 1
sle.insert()
sle.submit()
@@ -137,7 +137,7 @@
# update bin
if not frappe.db.exists({"doctype": "Bin", "item_code": args["item_code"],
"warehouse": args["warehouse"]}):
- bin_wrapper = frappe.bean([{
+ bin_wrapper = frappe.get_doc([{
"doctype": "Bin",
"item_code": args["item_code"],
"warehouse": args["warehouse"],
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 981f674..2f28e1a 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -40,7 +40,7 @@
def get_bin(item_code, warehouse):
bin = frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse})
if not bin:
- bin_wrapper = frappe.bean([{
+ bin_wrapper = frappe.get_doc([{
"doctype": "Bin",
"item_code": item_code,
"warehouse": warehouse,
@@ -246,7 +246,7 @@
}]
for d in items:
- item = frappe.doc("Item", d.item_code)
+ item = frappe.get_doc("Item", d.item_code)
mr.append({
"doctype": "Material Request Item",
"parenttype": "Material Request",
@@ -262,7 +262,7 @@
"brand": item.brand,
})
- mr_bean = frappe.bean(mr)
+ mr_bean = frappe.get_doc(mr)
mr_bean.insert()
mr_bean.submit()
mr_list.append(mr_bean)
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
index 0052ab2..c10d691 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.bean("Sales Person", d.sales_person).make_controller()
+ sp = frappe.get_doc("Sales Person", d.sales_person).make_controller()
email_map[d.sales_person] = sp.get_email_id()
scheduled_date = frappe.db.sql("""select scheduled_date from
@@ -69,7 +69,7 @@
if email_map[d.sales_person]:
description = "Reference: %s, Item Code: %s and Customer: %s" % \
(self.name, d.item_code, self.customer)
- frappe.bean({
+ frappe.get_doc({
"doctype": "Event",
"owner": email_map[d.sales_person] or self.owner,
"subject": description,
@@ -203,7 +203,7 @@
def update_amc_date(self, serial_nos, amc_expiry_date=None):
for serial_no in serial_nos:
- serial_no_bean = frappe.bean("Serial No", serial_no)
+ serial_no_bean = frappe.get_doc("Serial No", serial_no)
serial_no_bean.amc_expiry_date = amc_expiry_date
serial_no_bean.save()
diff --git a/erpnext/support/doctype/newsletter/newsletter.py b/erpnext/support/doctype/newsletter/newsletter.py
index f28afa8..a2ac2de 100644
--- a/erpnext/support/doctype/newsletter/newsletter.py
+++ b/erpnext/support/doctype/newsletter/newsletter.py
@@ -130,7 +130,7 @@
if frappe.db.get_value("Lead", {"email_id": email_id}):
return
- lead = frappe.bean({
+ lead = frappe.get_doc({
"doctype": "Lead",
"email_id": email_id,
"lead_name": real_name or email_id,
diff --git a/erpnext/support/doctype/newsletter/test_newsletter.py b/erpnext/support/doctype/newsletter/test_newsletter.py
index f94c8d5..01ed84e 100644
--- a/erpnext/support/doctype/newsletter/test_newsletter.py
+++ b/erpnext/support/doctype/newsletter/test_newsletter.py
@@ -5,7 +5,7 @@
class TestNewsletter(unittest.TestCase):
def test_get_recipients_lead(self):
- w = frappe.bean(test_records[0])
+ w = frappe.get_doc(test_records[0])
w.insert()
self.assertTrue("test_lead@example.com" in w.controller.get_recipients())
frappe.db.sql("""delete from `tabBulk Email`""")
@@ -13,24 +13,24 @@
self.assertTrue(frappe.db.get_value("Bulk Email", {"recipient": "test_lead@example.com"}))
def test_get_recipients_lead_by_status(self):
- w = frappe.bean(test_records[0])
+ w = frappe.get_doc(test_records[0])
w.lead_status="Converted"
w.insert()
self.assertTrue("test_lead3@example.com" in w.controller.get_recipients())
def test_get_recipients_contact_customer(self):
- w = frappe.bean(test_records[1])
+ w = frappe.get_doc(test_records[1])
w.insert()
self.assertTrue("test_contact_customer@example.com" in w.controller.get_recipients())
def test_get_recipients_contact_supplier(self):
- w = frappe.bean(test_records[1])
+ w = frappe.get_doc(test_records[1])
w.contact_type="Supplier"
w.insert()
self.assertTrue("test_contact_supplier@example.com" in w.controller.get_recipients())
def test_get_recipients_custom(self):
- w = frappe.bean(test_records[2])
+ w = frappe.get_doc(test_records[2])
w.insert()
self.assertTrue("test_custom2@example.com" in w.controller.get_recipients())
self.assertTrue(frappe.db.get("Lead",
diff --git a/erpnext/support/doctype/support_ticket/get_support_mails.py b/erpnext/support/doctype/support_ticket/get_support_mails.py
index 0edf54a..fa3b283 100644
--- a/erpnext/support/doctype/support_ticket/get_support_mails.py
+++ b/erpnext/support/doctype/support_ticket/get_support_mails.py
@@ -10,7 +10,7 @@
class SupportMailbox(POP3Mailbox):
def setup(self, args=None):
- self.email_settings = frappe.doc("Support Email Settings", "Support Email Settings")
+ self.email_settings = frappe.get_doc("Support Email Settings", "Support Email Settings")
self.settings = args or frappe._dict({
"use_ssl": self.email_settings.use_ssl,
"host": self.email_settings.mail_server,
@@ -58,12 +58,12 @@
def add_support_communication(subject, content, sender, docname=None, mail=None):
if docname:
- ticket = frappe.bean("Support Ticket", docname)
+ ticket = frappe.get_doc("Support Ticket", docname)
ticket.status = 'Open'
ticket.ignore_permissions = True
ticket.save()
else:
- ticket = frappe.bean([decode_dict({
+ ticket = frappe.get_doc([decode_dict({
"doctype":"Support Ticket",
"description": content,
"subject": subject,
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.py b/erpnext/support/doctype/support_ticket/support_ticket.py
index 6aa5b78..9517ea4 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.py
+++ b/erpnext/support/doctype/support_ticket/support_ticket.py
@@ -57,7 +57,7 @@
@frappe.whitelist()
def set_status(name, status):
- st = frappe.bean("Support Ticket", name)
+ st = frappe.get_doc("Support Ticket", name)
st.status = status
st.save()
diff --git a/erpnext/utilities/doctype/contact/contact.py b/erpnext/utilities/doctype/contact/contact.py
index 96cc879..28597ef 100644
--- a/erpnext/utilities/doctype/contact/contact.py
+++ b/erpnext/utilities/doctype/contact/contact.py
@@ -56,7 +56,7 @@
@frappe.whitelist()
def get_contact_details(contact):
- contact = frappe.doc("Contact", contact)
+ contact = frappe.get_doc("Contact", contact)
out = {
"contact_person": contact.get("name"),
"contact_display": " ".join(filter(None,