This commit is contained in:
Nabin Hait 2014-04-04 11:06:10 +05:30
parent c10213d861
commit 312ba99e71
11 changed files with 13 additions and 14 deletions

View File

@ -8,7 +8,7 @@ from frappe.utils import cint
from frappe.model.document import Document from frappe.model.document import Document
class PosSetting(Document): class POSSetting(Document):
def get_series(self): def get_series(self):
frappe.get_meta("Sales Invoice").get_field("naming_series").options or "" frappe.get_meta("Sales Invoice").get_field("naming_series").options or ""

View File

@ -4,7 +4,6 @@
import frappe import frappe
import unittest, json import unittest, json
from frappe.utils import flt from frappe.utils import flt
from frappe.model.doc import DocstatusTransitionError, TimestampMismatchError
from erpnext.accounts.utils import get_stock_and_account_difference from erpnext.accounts.utils import get_stock_and_account_difference
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
@ -25,7 +24,7 @@ class TestSalesInvoice(unittest.TestCase):
w.submit() w.submit()
w = frappe.get_doc(w2) w = frappe.get_doc(w2)
self.assertRaises(DocstatusTransitionError, w.submit) self.assertRaises(frappe.DocstatusTransitionError, w.submit)
def test_timestamp_change(self): def test_timestamp_change(self):
w = frappe.copy_doc(test_records[0]) w = frappe.copy_doc(test_records[0])
@ -40,7 +39,7 @@ class TestSalesInvoice(unittest.TestCase):
import time import time
time.sleep(1) time.sleep(1)
self.assertRaises(TimestampMismatchError, w2.save) self.assertRaises(frappe.TimestampMismatchError, w2.save)
def test_sales_invoice_calculation_base_currency(self): def test_sales_invoice_calculation_base_currency(self):
si = frappe.copy_doc(test_records[2]) si = frappe.copy_doc(test_records[2])

View File

@ -35,7 +35,7 @@ class PurchaseOrder(BuyingController):
validate_status(self.status, ["Draft", "Submitted", "Stopped", validate_status(self.status, ["Draft", "Submitted", "Stopped",
"Cancelled"]) "Cancelled"])
pc_obj = frappe.get_doc(dt='Purchase Common') pc_obj = frappe.get_doc('Purchase Common')
pc_obj.validate_for_items(self) pc_obj.validate_for_items(self)
self.check_for_stopped_status(pc_obj) self.check_for_stopped_status(pc_obj)

View File

@ -16,7 +16,6 @@ class Supplier(TransactionBase):
def autoname(self): def autoname(self):
supp_master_name = frappe.defaults.get_global_default('supp_master_name') supp_master_name = frappe.defaults.get_global_default('supp_master_name')
if supp_master_name == 'Supplier Name': if supp_master_name == 'Supplier Name':
if frappe.db.exists("Customer", self.supplier_name): if frappe.db.exists("Customer", self.supplier_name):
frappe.msgprint(_("A Customer exists with same name"), raise_exception=1) frappe.msgprint(_("A Customer exists with same name"), raise_exception=1)

View File

@ -210,7 +210,7 @@ class AccountsController(TransactionBase):
"row_range": row_range "row_range": row_range
}) })
if cint(tax.included_in_print_rate): if cint(getattr(tax, "included_in_print_rate", None)):
if tax.charge_type == "Actual": if tax.charge_type == "Actual":
# inclusive tax cannot be of type Actual # inclusive tax cannot be of type Actual
throw((_("Row") throw((_("Row")
@ -259,7 +259,7 @@ class AccountsController(TransactionBase):
tax.tax_amount_after_discount_amount += current_tax_amount tax.tax_amount_after_discount_amount += current_tax_amount
if tax.category: if getattr(tax, "category", None):
# if just for valuation, do not add the tax amount in total # if just for valuation, do not add the tax amount in total
# hence, setting it as 0 for further steps # hence, setting it as 0 for further steps
current_tax_amount = 0.0 if (tax.category == "Valuation") \ current_tax_amount = 0.0 if (tax.category == "Valuation") \

View File

@ -50,7 +50,7 @@ class BuyingController(StockController):
from erpnext.stock.utils import validate_warehouse_company from erpnext.stock.utils import validate_warehouse_company
warehouses = list(set([d.warehouse for d in warehouses = list(set([d.warehouse for d in
self.get(self.fname) if d.warehouse])) self.get(self.fname) if getattr(d, "warehouse", None)]))
for w in warehouses: for w in warehouses:
validate_warehouse_company(w, self.company) validate_warehouse_company(w, self.company)

View File

@ -38,7 +38,7 @@ class BOM(Document):
def on_update(self): def on_update(self):
self.check_recursion() self.check_recursion()
self.update_exploded_items() self.update_exploded_items()
self.save() self.db_update()
def on_submit(self): def on_submit(self):
self.manage_default_bom() self.manage_default_bom()

View File

@ -137,7 +137,8 @@ def feature_setup():
doc.save() doc.save()
def set_single_defaults(): def set_single_defaults():
for dt in frappe.db.sql_list("""select name from `tabDocType` where issingle=1"""): for dt in frappe.db.sql_list("""select name from `tabDocType`
where issingle=1 and paent != 'Control Panel'"""):
default_values = frappe.db.sql("""select fieldname, `default` from `tabDocField` default_values = frappe.db.sql("""select fieldname, `default` from `tabDocField`
where parent=%s""", dt) where parent=%s""", dt)
if default_values: if default_values:

View File

@ -124,7 +124,7 @@ class MaterialRequest(BuyingController):
def on_cancel(self): def on_cancel(self):
# Step 1:=> Get Purchase Common Obj # Step 1:=> Get Purchase Common Obj
pc_obj = frappe.get_doc(dt='Purchase Common') pc_obj = frappe.get_doc('Purchase Common')
# Step 2:=> Check for stopped status # Step 2:=> Check for stopped status
pc_obj.check_for_stopped_status(self.doctype, self.name) pc_obj.check_for_stopped_status(self.doctype, self.name)

View File

@ -53,7 +53,7 @@ class PurchaseReceipt(BuyingController):
self.validate_uom_is_integer("stock_uom", "stock_qty") self.validate_uom_is_integer("stock_uom", "stock_qty")
self.validate_challan_no() self.validate_challan_no()
pc_obj = frappe.get_doc(dt='Purchase Common') pc_obj = frappe.get_doc('Purchase Common')
pc_obj.validate_for_items(self) pc_obj.validate_for_items(self)
self.check_for_stopped_status(pc_obj) self.check_for_stopped_status(pc_obj)

View File

@ -721,7 +721,7 @@ def get_return_doc_and_details(args):
ref = frappe._dict() ref = frappe._dict()
# get ref_doc # get ref_doc
if args["purpose"] in return_map: if args.get("purpose") in return_map:
for fieldname, val in return_map[args["purpose"]].items(): for fieldname, val in return_map[args["purpose"]].items():
if args.get(fieldname): if args.get(fieldname):
ref.fieldname = fieldname ref.fieldname = fieldname