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 from __future__ import unicode_literals
import frappe import frappe
from frappe import throw, _ 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): def validate(self):
self.validate_mandatory() self.validate_mandatory()
self.cleanup_fields_value() self.cleanup_fields_value()

View File

@@ -4,9 +4,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cint 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): def validate(self):
if self.is_default == 1: if self.is_default == 1:
frappe.db.sql("""update `tabSales Taxes and Charges Master` set is_default = 0 frappe.db.sql("""update `tabSales Taxes and Charges Master` set is_default = 0

View File

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

View File

@@ -5,8 +5,7 @@ from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import flt from frappe.utils import flt
from frappe import msgprint, _, throw from frappe import msgprint, _, throw
from frappe.model.document import Document
from frappe.model.controller import DocListController
status_map = { status_map = {
"Contact": [ "Contact": [
@@ -53,7 +52,7 @@ status_map = {
], ],
} }
class StatusUpdater(DocListController): class StatusUpdater(Document):
""" """
Updates the status of the calling records Updates the status of the calling records
Delivery Note: Update Delivered Qty, Update Percent and Validate over delivery 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, _ from frappe import throw, _
import frappe.permissions import frappe.permissions
from frappe.defaults import get_restrictions 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): def autoname(self):
naming_method = frappe.db.get_value("HR Settings", None, "emp_created_by") naming_method = frappe.db.get_value("HR Settings", None, "emp_created_by")
if not naming_method: if not naming_method:

View File

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

View File

@@ -27,8 +27,8 @@ class ItemGroup(NestedSet, WebsiteGenerator):
self.validate_one_root() self.validate_one_root()
def after_rename(self, olddn, newdn, merge=False): def after_rename(self, olddn, newdn, merge=False):
NestedSet.after_rename(self) NestedSet.after_rename(self, olddn, newdn, merge)
WebsiteGenerator.after_rename(self) WebsiteGenerator.after_rename(self, olddn, newdn, merge)
def on_trash(self): def on_trash(self):
NestedSet.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 from erpnext.controllers.stock_controller import StockController
class StockReconciliation(StockController): class StockReconciliation(StockController):
def setup(self): def validate(self):
self.head_row = ["Item Code", "Warehouse", "Quantity", "Valuation Rate"] self.head_row = ["Item Code", "Warehouse", "Quantity", "Valuation Rate"]
self.entries = [] self.entries = []
def validate(self):
self.validate_data() self.validate_data()
self.validate_expense_account() self.validate_expense_account()