Removed controller.py

This commit is contained in:
Anand Doshi 2014-04-21 15:06:56 +05:30
parent 40b2b03bcb
commit 424c033395
8 changed files with 20 additions and 24 deletions

View File

@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe
from frappe import throw, _
from frappe.model.controller import DocListController
from frappe.model.document import Document
class PricingRule(DocListController):
class PricingRule(Document):
def validate(self):
self.validate_mandatory()
self.cleanup_fields_value()

View File

@ -4,14 +4,14 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cint
from frappe.model.controller import DocListController
from frappe.model.document import Document
class SalesTaxesandChargesMaster(DocListController):
class SalesTaxesandChargesMaster(Document):
def validate(self):
if self.is_default == 1:
frappe.db.sql("""update `tabSales Taxes and Charges Master` set is_default = 0
where ifnull(is_default,0) = 1 and name != %s and company = %s""",
frappe.db.sql("""update `tabSales Taxes and Charges Master` set is_default = 0
where ifnull(is_default,0) = 1 and name != %s and company = %s""",
(self.name, self.company))
# at least one territory
self.validate_table_has_rows("valid_for_territories")
self.validate_table_has_rows("valid_for_territories")

View File

@ -7,15 +7,14 @@ from __future__ import unicode_literals
import frappe
from frappe import _, msgprint, throw
from frappe.utils import flt, fmt_money
from frappe.model.controller import DocListController
from frappe.model.document import Document
from erpnext.setup.utils import get_company_currency
class OverlappingConditionError(frappe.ValidationError): pass
class FromGreaterThanToError(frappe.ValidationError): pass
class ManyBlankToValuesError(frappe.ValidationError): pass
class ShippingRule(DocListController):
class ShippingRule(Document):
def validate(self):
self.validate_value("calculate_based_on", "in", ["Net Total", "Net Weight"])
self.shipping_rule_conditions = self.get("shipping_rule_conditions")

View File

@ -5,8 +5,7 @@ from __future__ import unicode_literals
import frappe
from frappe.utils import flt
from frappe import msgprint, _, throw
from frappe.model.controller import DocListController
from frappe.model.document import Document
status_map = {
"Contact": [
@ -53,7 +52,7 @@ status_map = {
],
}
class StatusUpdater(DocListController):
class StatusUpdater(Document):
"""
Updates the status of the calling records
Delivery Note: Update Delivered Qty, Update Percent and Validate over delivery

View File

@ -9,9 +9,9 @@ from frappe.model.naming import make_autoname
from frappe import throw, _
import frappe.permissions
from frappe.defaults import get_restrictions
from frappe.model.controller import DocListController
from frappe.model.document import Document
class Employee(DocListController):
class Employee(Document):
def autoname(self):
naming_method = frappe.db.get_value("HR Settings", None, "emp_created_by")
if not naming_method:

View File

@ -14,15 +14,14 @@ class OverlapError(frappe.ValidationError): pass
class InvalidLeaveApproverError(frappe.ValidationError): pass
class LeaveApproverIdentityError(frappe.ValidationError): pass
from frappe.model.controller import DocListController
class LeaveApplication(DocListController):
def setup(self):
from frappe.model.document import Document
class LeaveApplication(Document):
def validate(self):
if not getattr(self, "__islocal", None) and frappe.db.exists(self.doctype, self.name):
self.previous_doc = frappe.db.get_value(self.doctype, self.name, "*", as_dict=True)
else:
self.previous_doc = None
def validate(self):
self.validate_to_date()
self.validate_balance_leaves()
self.validate_leave_overlap()

View File

@ -27,8 +27,8 @@ class ItemGroup(NestedSet, WebsiteGenerator):
self.validate_one_root()
def after_rename(self, olddn, newdn, merge=False):
NestedSet.after_rename(self)
WebsiteGenerator.after_rename(self)
NestedSet.after_rename(self, olddn, newdn, merge)
WebsiteGenerator.after_rename(self, olddn, newdn, merge)
def on_trash(self):
NestedSet.on_trash(self)

View File

@ -11,11 +11,10 @@ from erpnext.stock.stock_ledger import update_entries_after
from erpnext.controllers.stock_controller import StockController
class StockReconciliation(StockController):
def setup(self):
def validate(self):
self.head_row = ["Item Code", "Warehouse", "Quantity", "Valuation Rate"]
self.entries = []
def validate(self):
self.validate_data()
self.validate_expense_account()