diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 18ae244fd9f..094edd0d2c2 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -3,12 +3,8 @@ from __future__ import unicode_literals import frappe - from frappe.utils import flt, fmt_money, cstr, cint from frappe import msgprint, throw, _ - -get_value = frappe.db.get_value - from frappe.model.document import Document class Account(Document): @@ -19,10 +15,7 @@ class Account(Document): frappe.db.get_value("Company", self.company, "abbr") def get_address(self): - return { - 'address': frappe.db.get_value(self.master_type, - self.master_name, "address") - } + return {'address': frappe.db.get_value(self.master_type, self.master_name, "address")} def validate(self): self.validate_master_name() @@ -32,24 +25,19 @@ class Account(Document): self.validate_mandatory() self.validate_warehouse_account() self.validate_frozen_accounts_modifier() - - if not self.parent_account: - self.parent_account = '' def validate_master_name(self): - """Remind to add master name""" if self.master_type in ('Customer', 'Supplier') or self.account_type == "Warehouse": if not self.master_name: msgprint(_("Please enter Master Name once the account is created.")) - elif not frappe.db.exists(self.master_type or self.account_type, - self.master_name): + elif not frappe.db.exists(self.master_type or self.account_type, self.master_name): throw(_("Invalid Master Name")) def validate_parent(self): """Fetch Parent Details and validation for account not to be created under ledger""" if self.parent_account: - par = frappe.db.sql("""select name, group_or_ledger, report_type - from tabAccount where name =%s""", self.parent_account, as_dict=1) + par = frappe.db.get_value("Account", self.parent_account, + ["name", "group_or_ledger", "report_type"], as_dict=1) if not par: throw(_("Parent account does not exists")) elif par[0]["name"] == self.name: @@ -63,14 +51,13 @@ class Account(Document): def validate_duplicate_account(self): if self.get('__islocal') or not self.name: company_abbr = frappe.db.get_value("Company", self.company, "abbr") - if frappe.db.sql("""select name from tabAccount where name=%s""", - (self.account_name + " - " + company_abbr)): - throw("{name}: {acc_name} {exist}, {rename}".format(**{ - "name": _("Account Name"), - "acc_name": self.account_name, - "exist": _("already exists"), - "rename": _("please rename") - })) + if frappe.db.exists("Account", (self.account_name + " - " + company_abbr)): + throw("{name}: {acc_name} {exist}, {rename}".format(**{ + "name": _("Account Name"), + "acc_name": self.account_name, + "exist": _("already exists"), + "rename": _("please rename") + })) def validate_root_details(self): #does not exists parent diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py index 10883d9ddee..5cecab42bf0 100644 --- a/erpnext/accounts/doctype/account/test_account.py +++ b/erpnext/accounts/doctype/account/test_account.py @@ -35,12 +35,12 @@ def _make_test_records(verbose): ] for company, abbr in [["_Test Company", "_TC"], ["_Test Company 1", "_TC1"]]: - test_objects = make_test_objects("Account", [[{ + test_objects = make_test_objects("Account", [{ "doctype": "Account", "account_name": account_name, "parent_account": parent_account + " - " + abbr, "company": company, "group_or_ledger": group_or_ledger - }] for account_name, parent_account, group_or_ledger in accounts]) + } for account_name, parent_account, group_or_ledger in accounts]) return test_objects \ No newline at end of file diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py index 0559559a205..89d7c00074d 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py @@ -7,18 +7,16 @@ from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import cint - from frappe.model.document import Document class AccountsSettings(Document): - def on_update(self): frappe.db.set_default("auto_accounting_for_stock", self.auto_accounting_for_stock) 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) diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index d8edb20def9..dc7d57becbe 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -3,20 +3,25 @@ from __future__ import unicode_literals import frappe - -from frappe.utils import cstr, flt, getdate, now, nowdate -from frappe import msgprint - +from frappe.utils import cstr, flt, getdate, nowdate +from frappe import msgprint, _ from frappe.model.document import Document class BankReconciliation(Document): - def get_details(self): if not (self.bank_account and self.from_date and self.to_date): msgprint("Bank Account, From Date and To Date are Mandatory") return - dl = frappe.db.sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.bank_account, self.from_date, self.to_date)) + dl = frappe.db.sql("""select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, + t2.credit, t1.posting_date, t2.against_account + from + `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 + where + t2.parent = t1.name and t2.account = %s + and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') + and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1""", + (self.bank_account, self.from_date, self.to_date)) self.set('entries', []) self.total_amount = 0.0 @@ -37,15 +42,14 @@ class BankReconciliation(Document): for d in self.get('entries'): if d.clearance_date: if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date): - msgprint("Clearance Date can not be before Cheque Date (Row #%s)" % - d.idx, raise_exception=1) + frappe.throw("Clearance Date can not be before Cheque Date (Row #%s)" % d.idx) - frappe.db.sql("""update `tabJournal Voucher` - set clearance_date = %s, modified = %s where name=%s""", - (d.clearance_date, nowdate(), d.voucher_id)) + frappe.db.set_value("Journal Voucher", d.voucher_id, "clearance_date", d.clearance_date) + frappe.db.sql("""update `tabJournal Voucher` set clearance_date = %s, modified = %s + where name=%s""", (d.clearance_date, nowdate(), d.voucher_id)) vouchers.append(d.voucher_id) if vouchers: msgprint("Clearance Date updated in %s" % ", ".join(vouchers)) else: - msgprint("Clearance Date not mentioned") \ No newline at end of file + msgprint(_("Clearance Date not mentioned")) \ No newline at end of file diff --git a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py index 93dca1da238..9be696cb0d3 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py +++ b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import frappe - from frappe.model.document import Document class BankReconciliationDetail(Document): diff --git a/erpnext/accounts/doctype/budget_detail/budget_detail.py b/erpnext/accounts/doctype/budget_detail/budget_detail.py index 58106a06ac8..ff4f8867f7d 100644 --- a/erpnext/accounts/doctype/budget_detail/budget_detail.py +++ b/erpnext/accounts/doctype/budget_detail/budget_detail.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import frappe - from frappe.model.document import Document class BudgetDetail(Document): diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py index 069c4d33900..2cc5015c4dc 100644 --- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py +++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py @@ -3,11 +3,8 @@ from __future__ import unicode_literals import frappe - from frappe.utils import flt -from frappe.model.bean import getlist -from frappe import msgprint, _ - +from frappe import _ from frappe.model.document import Document class BudgetDistribution(Document): @@ -17,13 +14,12 @@ class BudgetDistribution(Document): idx =1 for m in month_list: mnth = self.append('budget_distribution_details') - mnth.month = m or '' + mnth.month = m mnth.idx = idx idx += 1 def validate(self): - total = sum([flt(d.percentage_allocation, 2) for d in self.doclist.get( - {"parentfield": "budget_distribution_details"})]) + total = sum([flt(d.percentage_allocation) for d in self.get("budget_distribution_details")]) if total != 100.0: - msgprint(_("Percentage Allocation should be equal to ") + "100%", raise_exception=1) \ No newline at end of file + frappe.throw(_("Percentage Allocation should be equal to ") + "100%") \ No newline at end of file diff --git a/erpnext/accounts/doctype/budget_distribution/test_budget_distribution.py b/erpnext/accounts/doctype/budget_distribution/test_budget_distribution.py index 15b60db9965..57fc162fe53 100644 --- a/erpnext/accounts/doctype/budget_distribution/test_budget_distribution.py +++ b/erpnext/accounts/doctype/budget_distribution/test_budget_distribution.py @@ -2,69 +2,48 @@ # License: GNU General Public License v3. See license.txt test_records = [ - [{ + { "doctype": "Budget Distribution", "distribution_id": "_Test Distribution", "fiscal_year": "_Test Fiscal Year 2013", - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "January", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "February", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "March", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "April", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "May", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "June", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "July", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "August", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "September", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "October", - "percentage_allocation": "8" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "November", - "percentage_allocation": "10" - }, { - "doctype": "Budget Distribution Detail", - "parentfield": "budget_distribution_details", - "month": "December", - "percentage_allocation": "10" - }] + "budget_distribution_details": [ + { + "month": "January", + "percentage_allocation": "8" + }, { + "month": "February", + "percentage_allocation": "8" + }, { + "month": "March", + "percentage_allocation": "8" + }, { + "month": "April", + "percentage_allocation": "8" + }, { + "month": "May", + "percentage_allocation": "8" + }, { + "month": "June", + "percentage_allocation": "8" + }, { + "month": "July", + "percentage_allocation": "8" + }, { + "month": "August", + "percentage_allocation": "8" + }, { + "month": "September", + "percentage_allocation": "8" + }, { + "month": "October", + "percentage_allocation": "8" + }, { + "month": "November", + "percentage_allocation": "10" + }, { + "month": "December", + "percentage_allocation": "10" + } + ] + } ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py index 84d8060731d..87d38fd36ad 100644 --- a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py +++ b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import frappe - from frappe.model.document import Document class BudgetDistributionDetail(Document): diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py index d0df2e4aedb..95e2e4060f0 100644 --- a/erpnext/accounts/doctype/c_form/c_form.py +++ b/erpnext/accounts/doctype/c_form/c_form.py @@ -3,14 +3,11 @@ from __future__ import unicode_literals import frappe -from frappe.utils import flt, getdate -from frappe.model.bean import getlist - +from frappe.utils import flt +from frappe import _ from frappe.model.document import Document class CForm(Document): - - def validate(self): """Validate invoice that c-form is applicable and no other c-form is received for that""" @@ -21,18 +18,17 @@ class CForm(Document): `tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no) if not inv: - frappe.msgprint("""Invoice: %s is not exists in the system or - is not submitted, please check.""" % d.invoice_no, raise_exception=1) + frappe.throw("""Invoice: %s is not exists in the system or + is not submitted, please check.""" % d.invoice_no) elif inv[0][0] != 'Yes': - frappe.msgprint("C-form is not applicable for Invoice: %s" % - d.invoice_no, raise_exception=1) + frappe.throw("C-form is not applicable for Invoice: %s" % d.invoice_no) elif inv[0][1] and inv[0][1] != self.name: - frappe.msgprint("""Invoice %s is tagged in another C-form: %s. + frappe.throw("""Invoice %s is tagged in another C-form: %s. If you want to change C-form no for this invoice, please remove invoice no from the previous c-form and then try again""" % - (d.invoice_no, inv[0][1]), raise_exception=1) + (d.invoice_no, inv[0][1])) def on_update(self): """ Update C-Form No on invoices""" @@ -43,22 +39,19 @@ class CForm(Document): def before_cancel(self): # remove cform reference - frappe.db.sql("""update `tabSales Invoice` set c_form_no=null - where c_form_no=%s""", self.name) + frappe.db.sql("""update `tabSales Invoice` set c_form_no=null where c_form_no=%s""", self.name) def set_cform_in_sales_invoices(self): inv = [d.invoice_no for d in self.get('invoice_details')] if inv: - frappe.db.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s - where name in (%s)""" % ('%s', '%s', ', '.join(['%s'] * len(inv))), - tuple([self.name, self.modified] + inv)) + frappe.db.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s where name in (%s)""" % + ('%s', '%s', ', '.join(['%s'] * len(inv))), tuple([self.name, self.modified] + inv)) frappe.db.sql("""update `tabSales Invoice` set c_form_no = null, modified = %s where name not in (%s) and ifnull(c_form_no, '') = %s""" % - ('%s', ', '.join(['%s']*len(inv)), '%s'), - tuple([self.modified] + inv + [self.name])) + ('%s', ', '.join(['%s']*len(inv)), '%s'), tuple([self.modified] + inv + [self.name])) else: - frappe.msgprint("Please enter atleast 1 invoice in the table", raise_exception=1) + frappe.throw(_("Please enter atleast 1 invoice in the table")) def set_total_invoiced_amount(self): total = sum([flt(d.grand_total) for d in self.get('invoice_details')]) @@ -67,13 +60,13 @@ class CForm(Document): def get_invoice_details(self, invoice_no): """ Pull details from invoices for referrence """ - inv = frappe.db.sql("""select posting_date, territory, net_total, grand_total - from `tabSales Invoice` where name = %s""", invoice_no) + inv = frappe.db.get_value("Sales Invoice", invoice_no, + ["posting_date", "territory", "net_total", "grand_total"], as_dict=True) return { - 'invoice_date' : inv and getdate(inv[0][0]).strftime('%Y-%m-%d') or '', - 'territory' : inv and inv[0][1] or '', - 'net_total' : inv and flt(inv[0][2]) or '', - 'grand_total' : inv and flt(inv[0][3]) or '' + 'invoice_date' : inv.posting_date, + 'territory' : inv.territory, + 'net_total' : inv.net_total, + 'grand_total' : inv.grand_total } def get_invoice_nos(doctype, txt, searchfield, start, page_len, filters): diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py index 8e3bc2974ac..f6b54746866 100644 --- a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py +++ b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import frappe - from frappe.model.document import Document class CFormInvoiceDetail(Document): 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 536b1998c39..d6b9eebde1d 100644 --- a/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py +++ b/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py @@ -5,25 +5,21 @@ from __future__ import unicode_literals import frappe, os, json from frappe.utils import cstr from unidecode import unidecode - - from frappe.model.document import Document class ChartOfAccounts(Document): - self.no_report_type = False + no_report_type = False def create_accounts(self, company): chart = {} - with open(os.path.join(os.path.dirname(__file__), "charts", - self.source_file), "r") as f: + with open(os.path.join(os.path.dirname(__file__), "charts", self.source_file), "r") as f: chart = json.loads(f.read()) - from erpnext.accounts.doctype.chart_of_accounts.charts.account_properties \ - import account_properties + from erpnext.accounts.doctype.chart_of_accounts.charts.account_properties import account_properties if chart: accounts = [] - + def _import_accounts(children, parent): for child in children: account_name = child.get("name") @@ -33,10 +29,9 @@ class ChartOfAccounts(Document): count = accounts.count(account_name_in_db) account_name = account_name + " " + cstr(count) - child.update(account_properties.get(chart.get("name"), {})\ - .get(account_name, {})) + child.update(account_properties.get(chart.get("name"), {}).get(account_name, {})) - account = frappe.bean({ + account = frappe.new_doc({ "doctype": "Account", "account_name": account_name, "company": company, @@ -63,5 +58,5 @@ class ChartOfAccounts(Document): @frappe.whitelist() def get_charts_for_country(country): - return frappe.db.sql_list("select chart_name from `tabChart of Accounts` where country=%s", - country) \ No newline at end of file + return frappe.db.sql_list("""select chart_name from `tabChart of Accounts` + where country=%s""", country) \ No newline at end of file diff --git a/erpnext/accounts/doctype/chart_of_accounts/import_charts.py b/erpnext/accounts/doctype/chart_of_accounts/import_charts.py index 1d34ab2be07..3806f080861 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 @@ def import_charts(): chart = json.loads(f.read()) country = frappe.db.get_value("Country", {"code": fname.split("_", 1)[0]}) if country: - bean = frappe.bean({ + bean = frappe.new_doc({ "doctype":"Chart of Accounts", "chart_name": chart.get("name"), "source_file": fname, diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py index 79bd1213bf7..ac69e75f13c 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.py +++ b/erpnext/accounts/doctype/cost_center/cost_center.py @@ -3,19 +3,17 @@ from __future__ import unicode_literals import frappe -from frappe.model.bean import getlist + from frappe import msgprint, _ from frappe.utils.nestedset import DocTypeNestedSet class CostCenter(DocTypeNestedSet): - - self.nsm_parent_field = 'parent_cost_center' - + nsm_parent_field = 'parent_cost_center' + def autoname(self): - company_abbr = frappe.db.sql("select abbr from tabCompany where name=%s", - self.company)[0][0] - self.name = self.cost_center_name.strip() + ' - ' + company_abbr + self.name = self.cost_center_name.strip() + ' - ' + \ + frappe.get_value("Company", self.company, "abbr") def validate_mandatory(self): if not self.group_or_ledger: @@ -78,7 +76,7 @@ class CostCenter(DocTypeNestedSet): new_cost_center = get_name_with_abbr(newdn, self.company) # Validate properties before merging - super(DocType, self).before_rename(olddn, new_cost_center, merge, "group_or_ledger") + super(CostCenter, self).before_rename(olddn, new_cost_center, merge, "group_or_ledger") return new_cost_center @@ -87,5 +85,5 @@ class CostCenter(DocTypeNestedSet): frappe.db.set_value("Cost Center", newdn, "cost_center_name", " - ".join(newdn.split(" - ")[:-1])) else: - super(DocType, self).after_rename(olddn, newdn, merge) + super(CostCenter, self).after_rename(olddn, newdn, merge) diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py index fb1508e8bd9..36b4e95213d 100644 --- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py +++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import flt -from frappe.model.bean import getlist + from frappe import msgprint, _ from frappe.model.document import Document diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index f9e9481b23e..eb8b93a5d67 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cint, cstr, flt, formatdate -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import msgprint, _ from erpnext.setup.utils import get_company_currency diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 449fca0f3a3..6413f91dc68 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -10,7 +10,7 @@ from frappe.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, from frappe.utils import comma_and from frappe.model.naming import make_autoname -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import _, msgprint diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 066afe02b12..bc6e17f3ce1 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import msgprint diff --git a/erpnext/hr/doctype/appraisal/appraisal.py b/erpnext/hr/doctype/appraisal/appraisal.py index b7b14211337..1f7f255c8bf 100644 --- a/erpnext/hr/doctype/appraisal/appraisal.py +++ b/erpnext/hr/doctype/appraisal/appraisal.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt, getdate -from frappe.model.bean import getlist + from frappe import msgprint, _ from frappe.model.mapper import get_mapped_doc from frappe.model.document import Document diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py index 1d3697be3d3..6a1be6e35c7 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.py +++ b/erpnext/hr/doctype/expense_claim/expense_claim.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe -from frappe.model.bean import getlist + from frappe import msgprint from frappe.model.document import Document diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index c81f22da28f..cfd39fc5e13 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -6,7 +6,7 @@ import frappe from frappe.utils import add_days, cint, cstr, flt, getdate, nowdate, _round from frappe.model.naming import make_autoname -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import msgprint, _ from erpnext.setup.utils import get_company_currency diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index e3199f983bb..0799a60efa2 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cint, cstr, flt, now, nowdate -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import msgprint, _ 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 cdda05ed26f..fa85eb1d364 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt, cint, nowdate, add_days -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import msgprint, _ diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py index db6d7ec519a..91f1a07e933 100644 --- a/erpnext/selling/doctype/installation_note/installation_note.py +++ b/erpnext/selling/doctype/installation_note/installation_note.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, getdate -from frappe.model.bean import getlist + from frappe import msgprint from erpnext.stock.utils import get_valid_serial_nos diff --git a/erpnext/selling/doctype/opportunity/opportunity.py b/erpnext/selling/doctype/opportunity/opportunity.py index 8a103be30f7..b9e873dafd6 100644 --- a/erpnext/selling/doctype/opportunity/opportunity.py +++ b/erpnext/selling/doctype/opportunity/opportunity.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, cint -from frappe.model.bean import getlist + from frappe import msgprint, _ diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index bcccdaa4111..2730dc56668 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import _, msgprint diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index ff235b147fa..679bffe9379 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -6,7 +6,7 @@ import frappe import frappe.utils from frappe.utils import cstr, flt, getdate -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import msgprint from frappe.model.mapper import get_mapped_doc diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py index 6e2485996af..a50eb2f8c66 100644 --- a/erpnext/setup/doctype/authorization_control/authorization_control.py +++ b/erpnext/setup/doctype/authorization_control/authorization_control.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt, has_common, make_esc -from frappe.model.bean import getlist + from frappe import session, msgprint from erpnext.setup.utils import get_company_currency diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py index 9139bab259f..db2057db109 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.py +++ b/erpnext/setup/doctype/sales_person/sales_person.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from frappe.model.bean import getlist + from frappe.utils import flt from frappe.utils.nestedset import DocTypeNestedSet diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py index 67669d99024..ed2d5f1de81 100644 --- a/erpnext/setup/doctype/territory/territory.py +++ b/erpnext/setup/doctype/territory/territory.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe -from frappe.model.bean import getlist + from frappe.utils import flt from frappe.utils.nestedset import DocTypeNestedSet diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index d48024f0816..100a5994821 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt, cint -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import msgprint, _ import frappe.defaults diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 9f556db2a14..ea43b167fc2 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt, getdate, now_datetime, formatdate -from frappe.model.bean import getlist + from frappe import msgprint, _ from frappe.model.controller import DocListController diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py index 6c7ee517bb4..232e60149d1 100644 --- a/erpnext/stock/doctype/packed_item/packed_item.py +++ b/erpnext/stock/doctype/packed_item/packed_item.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt -from frappe.model.bean import getlist + from frappe.model.document import Document diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 74c8cffd432..b1abf123d93 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt, cint -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import msgprint, _ import frappe.defaults diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index eeb8d82bd6f..25f3157f52e 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -6,7 +6,7 @@ import frappe import frappe.defaults from frappe.utils import cstr, cint, flt, comma_or, nowdate -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import msgprint, _ from erpnext.stock.utils import get_incoming_rate diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py index d0fe60a7eb4..615352fb236 100644 --- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py +++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import add_days, cstr, flt, nowdate, cint, now -from frappe.model.bean import getlist + from frappe.model.code import get_obj from frappe import session, msgprint from erpnext.stock.utils import get_valid_serial_nos diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py index 0052ab28e4a..b3ed19c1a60 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import add_days, cstr, getdate, cint -from frappe.model.bean import getlist + from frappe import throw, _ from erpnext.utilities.transaction_base import TransactionBase, delete_events from erpnext.stock.utils import get_valid_serial_nos diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py index f8eb96a4282..b11d6562c24 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr -from frappe.model.bean import getlist + from frappe import msgprint diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py index 74b6e41a3dc..d16e54d8cc9 100644 --- a/erpnext/utilities/doctype/sms_control/sms_control.py +++ b/erpnext/utilities/doctype/sms_control/sms_control.py @@ -7,7 +7,7 @@ import frappe, json from frappe.utils import nowdate, cstr from frappe.model.code import get_obj from frappe import msgprint, throw, _ -from frappe.model.bean import getlist + from frappe.model.document import Document