This commit is contained in:
Rushabh Mehta
2014-03-27 16:12:56 +05:30
parent 66d52b55c0
commit d2b34dc30c
214 changed files with 898 additions and 973 deletions

View File

@@ -6,9 +6,9 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class BuyingSettings(Document):
def validate(self):
for key in ["supplier_type", "supp_master_name", "maintain_same_rate", "buying_price_list"]:

View File

@@ -11,10 +11,7 @@ from frappe import msgprint, _
from erpnext.stock.doctype.item.item import get_last_purchase_details
from erpnext.controllers.buying_controller import BuyingController
class DocType(BuyingController):
def __init__(self, doc, doclist=None):
self.doc = doc
self.doclist = doclist
class PurchaseCommon(BuyingController):
def update_last_purchase_rate(self, obj, is_submit):
"""updates last_purchase_rate in item table for each item"""

View File

@@ -11,10 +11,7 @@ from frappe import msgprint
from erpnext.controllers.buying_controller import BuyingController
class DocType(BuyingController):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
class PurchaseOrder(BuyingController):
self.tname = 'Purchase Order Item'
self.fname = 'po_details'
self.status_updater = [{
@@ -65,7 +62,7 @@ class DocType(BuyingController):
})
def get_schedule_dates(self):
for d in getlist(self.doclist, 'po_details'):
for d in self.get('po_details'):
if d.prevdoc_detail_docname and not d.schedule_date:
d.schedule_date = frappe.db.get_value("Material Request Item",
d.prevdoc_detail_docname, "schedule_date")
@@ -76,7 +73,7 @@ class DocType(BuyingController):
# Check for Stopped status
def check_for_stopped_status(self, pc_obj):
check_list =[]
for d in getlist(self.doclist, 'po_details'):
for d in self.get('po_details'):
if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_docname not in check_list:
check_list.append(d.prevdoc_docname)
pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname)
@@ -85,7 +82,7 @@ class DocType(BuyingController):
def update_bin(self, is_submit, is_stopped = 0):
from erpnext.stock.utils import update_bin
pc_obj = get_obj('Purchase Common')
for d in getlist(self.doclist, 'po_details'):
for d in self.get('po_details'):
#1. Check if is_stock_item == 'Yes'
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == "Yes":
# this happens when item is changed from non-stock to stock item

View File

@@ -95,7 +95,7 @@ class TestPurchaseOrder(unittest.TestCase):
def test_subcontracting(self):
po = frappe.bean(copy=test_records[0])
po.insert()
self.assertEquals(len(po.doclist.get({"parentfield": "po_raw_material_details"})), 2)
self.assertEquals(len(po.get("po_raw_material_details")), 2)
def test_warehouse_company_validation(self):
from erpnext.stock.utils import InvalidWarehouseCompany

View File

@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class PurchaseOrderItem(Document):
pass

View File

@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class PurchaseOrderItemSupplied(Document):
pass

View File

@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class PurchaseReceiptItemSupplied(Document):
pass

View File

@@ -4,19 +4,17 @@
from __future__ import unicode_literals
import frappe
from frappe.model.doc import addchild
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
from frappe.model.document import Document
class QualityInspection(Document):
def get_item_specification_details(self):
self.doclist = self.doc.clear_table(self.doclist, 'qa_specification_details')
self.set('qa_specification_details', [])
specification = frappe.db.sql("select specification, value from `tabItem Quality Inspection Parameter` \
where parent = '%s' order by idx" % (self.doc.item_code))
for d in specification:
child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', self.doclist)
child = self.doc.append('qa_specification_details', {})
child.specification = d[0]
child.value = d[1]
child.status = 'Accepted'

View File

@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class QualityInspectionReading(Document):
pass

View File

@@ -12,10 +12,7 @@ from erpnext.accounts.party import create_party_account
from erpnext.utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
class Supplier(TransactionBase):
def autoname(self):
supp_master_name = frappe.defaults.get_global_default('supp_master_name')

View File

@@ -6,7 +6,7 @@ import frappe
from frappe.model.code import get_obj
from erpnext.controllers.buying_controller import BuyingController
class DocType(BuyingController):
class SupplierQuotation(BuyingController):
def __init__(self, doc, doclist=None):
self.doc, self.doclist = doc, doclist or []
self.tname, self.fname = "Supplier Quotation Item", "quotation_items"

View File

@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
from frappe.model.document import Document
class SupplierQuotationItem(Document):
pass