mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 07:29:22 +00:00
[minor] [fix]
This commit is contained in:
@@ -109,14 +109,6 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
|
||||
cur_frm.script_manager.make(erpnext.selling.QuotationController);
|
||||
|
||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({
|
||||
customer: doc.customer,
|
||||
address: doc.customer_address,
|
||||
contact: doc.contact_person
|
||||
}),'', doc, dt, dn, 1);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) {
|
||||
return{ query:"controllers.queries.lead_query" } }
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
return {
|
||||
filters: [
|
||||
['Sales Taxes and Charges Master', 'company', '=', me.frm.doc.company],
|
||||
['Sales Taxes and Charges Master', 'company', 'is not', 'NULL'],
|
||||
['Sales Taxes and Charges Master', 'docstatus', '!=', 2]
|
||||
]
|
||||
}
|
||||
@@ -146,6 +145,29 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
},
|
||||
|
||||
customer_address: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.customer) {
|
||||
this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
args: {
|
||||
customer: this.frm.doc.customer,
|
||||
address: this.frm.doc.customer_address,
|
||||
contact: this.frm.doc.contact_person
|
||||
},
|
||||
method: "get_customer_address",
|
||||
freeze: true,
|
||||
callback: function(r) {
|
||||
me.frm.refresh_fields();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
contact_person: function() {
|
||||
this.customer_address();
|
||||
},
|
||||
|
||||
barcode: function(doc, cdt, cdn) {
|
||||
this.item_code(doc, cdt, cdn);
|
||||
},
|
||||
|
||||
@@ -141,11 +141,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
// for backward compatibility: combine new and previous states
|
||||
$.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));
|
||||
|
||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.new_contact = function(){
|
||||
tn = wn.model.make_new_doc_and_get_name('Contact');
|
||||
locals['Contact'][tn].is_customer = 1;
|
||||
|
||||
@@ -80,27 +80,11 @@ class DocType(SellingController):
|
||||
def validate_for_items(self):
|
||||
check_list, flag = [], 0
|
||||
chk_dupl_itm = []
|
||||
# Sales Order Items Validations
|
||||
for d in getlist(self.doclist, 'sales_order_details'):
|
||||
if self.doc.quotation_no and cstr(self.doc.quotation_no) == cstr(d.prevdoc_docname):
|
||||
flag = 1
|
||||
if d.prevdoc_docname:
|
||||
if self.doc.quotation_date and getdate(self.doc.quotation_date) > getdate(self.doc.transaction_date):
|
||||
msgprint("Sales Order Date cannot be before Quotation Date")
|
||||
raise Exception
|
||||
# validates whether quotation no in doctype and in table is same
|
||||
if not cstr(d.prevdoc_docname) == cstr(self.doc.quotation_no):
|
||||
msgprint("Items in table does not belong to the Quotation No mentioned.")
|
||||
raise Exception
|
||||
|
||||
# validates whether item is not entered twice
|
||||
e = [d.item_code, d.description, d.reserved_warehouse, d.prevdoc_docname or '']
|
||||
f = [d.item_code, d.description]
|
||||
|
||||
#check item is stock item
|
||||
st_itm = sql("select is_stock_item from `tabItem` where name = %s", d.item_code)
|
||||
|
||||
if st_itm and st_itm[0][0] == 'Yes':
|
||||
if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes':
|
||||
if not d.reserved_warehouse:
|
||||
msgprint("""Please enter Reserved Warehouse for item %s
|
||||
as it is stock Item""" % d.item_code, raise_exception=1)
|
||||
@@ -109,7 +93,7 @@ class DocType(SellingController):
|
||||
msgprint("Item %s has been entered twice." % d.item_code)
|
||||
else:
|
||||
check_list.append(e)
|
||||
elif st_itm and st_itm[0][0]== 'No':
|
||||
else:
|
||||
if f in chk_dupl_itm:
|
||||
msgprint("Item %s has been entered twice." % d.item_code)
|
||||
else:
|
||||
@@ -121,9 +105,6 @@ class DocType(SellingController):
|
||||
tot_avail_qty = sql("select projected_qty from `tabBin` \
|
||||
where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.reserved_warehouse))
|
||||
d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
|
||||
|
||||
if getlist(self.doclist, 'sales_order_details') and self.doc.quotation_no and flag == 0:
|
||||
msgprint("There are no items of the quotation selected", raise_exception=1)
|
||||
|
||||
def validate_sales_mntc_quotation(self):
|
||||
for d in getlist(self.doclist, 'sales_order_details'):
|
||||
|
||||
Reference in New Issue
Block a user