mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
validate with prevdoc
This commit is contained in:
@@ -118,11 +118,26 @@ class DocType(SellingController):
|
||||
|
||||
# Set actual qty for each item in selected warehouse
|
||||
self.update_current_stock()
|
||||
|
||||
|
||||
self.validate_with_previous_doc()
|
||||
|
||||
self.doc.status = 'Draft'
|
||||
if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
|
||||
if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
|
||||
|
||||
if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
|
||||
|
||||
def validate_with_previous_doc(self):
|
||||
super(DocType, self).validate_with_previous_doc(self.tname, {
|
||||
"Sales Order": {
|
||||
"ref_dn_field": "prevdoc_docname",
|
||||
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
|
||||
["currency", "="]],
|
||||
},
|
||||
"Sales Order Item": {
|
||||
"ref_dn_field": "prevdoc_detail_docname",
|
||||
"compare_fields": [["export_rate", "="]],
|
||||
"is_child_table": True
|
||||
}
|
||||
})
|
||||
|
||||
def validate_proj_cust(self):
|
||||
"""check for does customer belong to same project as entered.."""
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:09",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-06 19:04:46",
|
||||
"modified": "2013-07-08 13:17:51",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -101,7 +101,7 @@
|
||||
"fieldname": "customer_address",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Select Shipping Address",
|
||||
"label": "Billing Address Name",
|
||||
"options": "Address",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
@@ -111,6 +111,22 @@
|
||||
"fieldname": "address_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Billing Address",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "shipping_address_name",
|
||||
"fieldtype": "Link",
|
||||
"label": "Shipping Address Name",
|
||||
"options": "Address",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "shipping_address",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Shipping Address",
|
||||
"read_only": 1
|
||||
},
|
||||
|
||||
@@ -91,6 +91,20 @@ class DocType(BuyingController):
|
||||
if exists:
|
||||
webnotes.msgprint("Another Purchase Receipt using the same Challan No. already exists.\
|
||||
Please enter a valid Challan No.", raise_exception=1)
|
||||
|
||||
def validate_with_previous_doc(self):
|
||||
super(DocType, self).validate_with_previous_doc(self.tname, {
|
||||
"Purchase Order": {
|
||||
"ref_dn_field": "prevdoc_docname",
|
||||
"compare_fields": [["supplier", "="], ["company", "="], ["currency", "="]],
|
||||
},
|
||||
"Purchase Order Item": {
|
||||
"ref_dn_field": "prevdoc_detail_docname",
|
||||
"compare_fields": [["export_rate", "="], ["project_name", "="], ["warehouse", "="],
|
||||
["uom", "="], ["item_code", "="]],
|
||||
"is_child_table": True
|
||||
}
|
||||
})
|
||||
|
||||
def po_required(self):
|
||||
if webnotes.conn.get_single_value("Buying Settings", "po_required") == 'Yes':
|
||||
@@ -111,6 +125,7 @@ class DocType(BuyingController):
|
||||
import utilities
|
||||
utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Cancelled"])
|
||||
|
||||
self.validate_with_previous_doc()
|
||||
self.validate_accepted_rejected_qty()
|
||||
self.validate_inspection() # Validate Inspection
|
||||
get_obj('Stock Ledger').validate_serial_no(self, 'purchase_receipt_details')
|
||||
@@ -119,7 +134,6 @@ class DocType(BuyingController):
|
||||
pc_obj = get_obj(dt='Purchase Common')
|
||||
pc_obj.validate_for_items(self)
|
||||
pc_obj.get_prevdoc_date(self)
|
||||
pc_obj.validate_reference_value(self)
|
||||
self.check_for_stopped_status(pc_obj)
|
||||
|
||||
# sub-contracting
|
||||
|
||||
Reference in New Issue
Block a user