deleted supp quotation

This commit is contained in:
Nabin Hait 2012-02-21 14:33:45 +05:30
parent b461e1788a
commit e1f976ce05
4 changed files with 0 additions and 793 deletions

View File

@ -1,82 +0,0 @@
cur_frm.cscript.tname = "Supplier Quotation Detail";
cur_frm.cscript.fname = "supplier_quotation_details";
$import(Purchase Common)
// ======================= OnLoad =============================================
cur_frm.cscript.onload = function(doc,cdt,cdn){
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
if(!doc.conversion_rate) set_multiple(cdt,cdn,{conversion_rate:'1'});
if(!doc.currency) set_multiple(cdt,cdn,{currency:sys_defaults.currency});
if(doc.__islocal && has_common(user_roles,['Partner','Supplier'])){
get_server_fields('get_contact_details','','',doc,cdt,cdn,1);
}
else if(doc.__islocal && doc.supplier){
get_server_fields('get_supplier_details',doc.supplier,'',doc,cdt,cdn,1);
}
}
//======================= Refresh ==============================================
cur_frm.cscript.refresh = function(doc,cdt,cdn){
if(has_common(user_roles,['Purchase User','Purchase Manager'])){
unhide_field(['Approve / Unapprove']);
if(doc.approval_status == 'Approved' && doc.status == 'Submitted') { unhide_field(['Create PO']);}
else { hide_field(['Create PO']);}
}
else{
hide_field(['Create PO']);
hide_field(['Approve / Unapprove']);
}
}
//======================= RFQ NO Get Query ===============================================
cur_frm.fields_dict['rfq_no'].get_query = function(doc){
return 'SELECT DISTINCT `tabRFQ`.name FROM `tabRFQ` WHERE `tabRFQ`.docstatus = 1 AND `tabRFQ`.name LIKE "%s"';
}
// ***************** Get Contact Person based on supplier selected *****************
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_supplier = 1 AND `tabContact`.supplier = "'+ doc.supplier+'" AND `tabContact`.docstatus != 2 AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
}
//=================== On Button Click Functions =====================
//======================== Create Purchase Order =========================================
cur_frm.cscript['Create PO'] = function(doc,cdt,cdn){
n = createLocal("Purchase Order");
$c('dt_map', args={
'docs':compress_doclist([locals["Purchase Order"][n]]),
'from_doctype':'Supplier Quotation',
'to_doctype':'Purchase Order',
'from_docname':doc.name,
'from_to_list':"[['Supplier Quotation', 'Purchase Order'], ['Supplier Quotation Detail', 'PO Detail']]"
}
, function(r,rt) {
loaddoc("Purchase Order", n);
}
);
}
//======================== Get Report ===================================================
cur_frm.cscript['Get Report'] = function(doc,cdt,cdn) {
var callback = function(report){
report.set_filter('PO Detail', 'Ref Doc',doc.name)
}
loadreport('PO Detail','Itemwise Purchase Details', callback);
}
cur_frm.cscript['Approve / Unapprove'] = function(doc, cdt, cdn){
var d = locals[cdt][cdn];
$c_obj(make_doclist(doc.doctype, doc.name),'update_approval_status','', function(r,rt){
refresh_field('approval_status');
doc.approval_status = r.message;
cur_frm.cscript.refresh(d, d.cdt, d.cdn);
});
}

View File

@ -1,104 +0,0 @@
class DocType:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
self.fname = 'supplier_quotation_details'
self.tname = 'Supplier Quotation Detail'
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
def get_contact_details(self):
cd = sql("select concat_ws(' ',t2.first_name,t2.last_name),t2.contact_no, t2.email_id, t2.supplier, t2.supplier_name, t2.supplier_address from `tabProfile` t1, `tabContact` t2 where t1.email=t2.email_id and t1.name=%s", session['user'])
ret = {
'contact_person' : cd and cd[0][0] or '',
'contact_no' : cd and cd[0][1] or '',
'email' : cd and cd[0][2] or '',
'supplier' : cd and cd[0][3] or '',
'supplier_name' : cd and cd[0][4] or '',
'supplier_address': cd and cd[0][5] or ''
}
return ret
def get_rfq_details(self):
self.doc.clear_table(self.doclist, 'supplier_quotation_details')
get_obj('DocType Mapper','RFQ-Supplier Quotation').dt_map('RFQ','Supplier Quotation',self.doc.rfq_no, self.doc, self.doclist, "[['RFQ Detail', 'Supplier Quotation Detail']]")
#update approval status
def update_approval_status(self):
if not self.doc.approval_status or self.doc.approval_status == 'Not Approved':
set(self.doc, 'approval_status','Approved')
return self.doc.approval_status
elif self.doc.approval_status == 'Approved':
pc_obj = get_obj('Purchase Common')
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
set(self.doc, 'approval_status', 'Not Approved')
return self.doc.approval_status
def validate_item_list(self):
if not getlist(self.doclist, 'supplier_quotation_details'):
msgprint("Please fetch RFQ details against which this quotation is prapared")
raise Exception
# On Validate
#---------------------------------------------------------------------------------------------------------
def validate(self):
self.validate_item_list()
pc_obj = get_obj(dt='Purchase Common')
pc_obj.validate_for_items(self)
pc_obj.validate_conversion_rate(self)
pc_obj.validate_doc(obj = self, prevdoc_doctype = 'RFQ', prevdoc_docname = self.doc.rfq_no)
def on_update(self):
set(self.doc, 'status', 'Draft')
# checks whether previous documents doctstatus is submitted.
def check_previous_docstatus(self):
pc_obj = get_obj(dt = 'Purchase Common')
for d in getlist(self.doclist, 'rfq_details'):
if d.prevdoc_docname:
pc_obj.check_docstatus(check = 'Previous', doctype = 'Indent', docname = d.prevdoc_docname)
#update rfq
def update_rfq(self, status):
prevdoc=''
for d in getlist(self.doclist, 'supplier_quotation_details'):
if d.prevdoc_docname:
prevdoc = d.prevdoc_docname
if status == 'Submitted':
sql("update `tabRFQ` set status = 'Quotation Received' where name=%s", prevdoc)
elif status == 'Cancelled':
sql("update `tabRFQ` set status = 'Submitted' where name=%s", prevdoc)
# On Submit
def on_submit(self):
# checks whether previous documents doctstatus is submitted.
self.check_previous_docstatus()
set(self.doc, 'status', 'Submitted')
self.update_rfq('Submitted')
# On Cancel
#---------------------------------------------------------------------------------------------------------
#def check_next_docstatus(self):
# submitted = sql("selct name from `tabPurchase Order` where ref_sq = '%s' and docstatus = 1" % self.doc.name)
# if submitted:
# msgprint("Purchase Order : " + cstr(submitted[0][0]) + " has already been submitted !")
# raise Exception
def on_cancel(self):
pc_obj = get_obj('Purchase Common')
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
#self.check_next_docstatus()
set(self.doc, 'status', 'Cancelled')
self.update_rfq('Cancelled')
# GET TERMS & CONDITIONS
# =====================================================================================
def get_tc_details(self):
return get_obj('Purchase Common').get_tc_details(self)
# Get Supplier Details
# --------------------
def get_supplier_details(self, name = ''):
return get_obj('Purchase Common').get_supplier_details(name)

View File

@ -1,607 +0,0 @@
# DocType, Supplier Quotation
[
# These values are common in all dictionaries
{
'creation': '2010-10-27 12:55:42',
'docstatus': 0,
'modified': '2011-01-28 11:41:36',
'modified_by': 'rakesh@iwebnotes.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'autoname': 'SQ.#####',
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'module': 'Buying',
'name': '__common__',
'read_only': 1,
'section_style': 'Tabbed',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 241
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Supplier Quotation',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Supplier Quotation',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1
},
# DocType, Supplier Quotation
{
'doctype': 'DocType',
'name': 'Supplier Quotation'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'role': 'System Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 0,
'role': 'Supplier',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 0,
'role': 'Purchase User',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 0,
'role': 'Purchase Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 1,
'role': 'All'
},
# DocPerm
{
'cancel': 0,
'doctype': 'DocPerm',
'idx': 6,
'permlevel': 2,
'role': 'Purchase User',
'submit': 0,
'write': 1
},
# DocPerm
{
'cancel': 0,
'doctype': 'DocPerm',
'idx': 7,
'permlevel': 2,
'role': 'Purchase Manager',
'submit': 0,
'write': 1
},
# DocField
{
'allow_on_submit': 1,
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 1,
'label': 'Create PO',
'oldfieldtype': 'Button',
'permlevel': 2,
'trigger': 'Client'
},
# DocField
{
'colour': 'White:FFF',
'description': 'Enter item rates and details of supplier who is providing quotation',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 2,
'label': 'Basic Info',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 3,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'naming_series',
'fieldtype': 'Select',
'idx': 4,
'in_filter': 1,
'label': 'Series',
'no_copy': 1,
'oldfieldname': 'naming_series',
'oldfieldtype': 'Select',
'options': '\nSQTN',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'default': 'Draft',
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
'idx': 5,
'in_filter': 1,
'label': 'Status',
'oldfieldname': 'status',
'oldfieldtype': 'Select',
'options': '\nDraft\nQuotation Sent\nOrder Confirmed\nCancelled',
'permlevel': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'default': 'Today',
'description': 'The date at which current entry is made in system.',
'doctype': 'DocField',
'fieldname': 'transaction_date',
'fieldtype': 'Date',
'idx': 6,
'in_filter': 1,
'label': 'Quotation Date',
'oldfieldname': 'transaction_date',
'oldfieldtype': 'Date',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'activity_log_text',
'fieldtype': 'Text',
'idx': 7,
'label': 'Activity Log Text',
'oldfieldname': 'activity_log_text',
'oldfieldtype': 'Text',
'permlevel': 2
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
'idx': 8,
'in_filter': 1,
'label': 'For Company',
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'Company',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'idx': 9,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'hidden': 1,
'idx': 10,
'label': 'Amended From',
'no_copy': 1,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'hidden': 1,
'idx': 11,
'label': 'Amendment Date',
'no_copy': 1,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 12,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'allow_on_submit': 0,
'description': 'You can create PO when quotation gets approved.',
'doctype': 'DocField',
'fieldname': 'approval_status',
'fieldtype': 'Select',
'idx': 13,
'label': 'Approval Status',
'oldfieldname': 'approval_status',
'oldfieldtype': 'Select',
'options': '\nApproved\nNot Approved',
'permlevel': 2
},
# DocField
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 14,
'label': 'Approve / Unapprove',
'oldfieldtype': 'Button',
'permlevel': 2,
'trigger': 'Client'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'supplier',
'fieldtype': 'Link',
'idx': 15,
'in_filter': 1,
'label': 'Supplier',
'oldfieldname': 'supplier',
'oldfieldtype': 'Link',
'options': 'Supplier',
'permlevel': 0,
'reqd': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'supplier_name',
'fieldtype': 'Data',
'idx': 16,
'in_filter': 1,
'label': 'Supplier Name',
'oldfieldname': 'supplier_name',
'oldfieldtype': 'Data',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'supplier_address',
'fieldtype': 'Text',
'idx': 17,
'label': 'Supplier Address',
'oldfieldname': 'supplier_address',
'oldfieldtype': 'Text',
'permlevel': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'contact_person',
'fieldtype': 'Link',
'idx': 18,
'in_filter': 0,
'label': 'Contact Person',
'oldfieldname': 'contact_person',
'oldfieldtype': 'Link',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'contact_no',
'fieldtype': 'Data',
'idx': 19,
'label': 'Contact No',
'oldfieldname': 'contact_no',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'email',
'fieldtype': 'Data',
'idx': 20,
'label': 'Email',
'oldfieldname': 'email',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 21,
'label': 'Item Details',
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'rfq_no',
'fieldtype': 'Link',
'hidden': 1,
'idx': 22,
'label': 'RFQ No',
'oldfieldname': 'rfq_no',
'oldfieldtype': 'Link',
'options': 'RFQ',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 23,
'label': 'Get Items',
'oldfieldtype': 'Button',
'options': 'get_rfq_details',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 24,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'colour': 'White:FFF',
'description': "Supplier's currency",
'doctype': 'DocField',
'fieldname': 'currency',
'fieldtype': 'Select',
'idx': 25,
'label': 'Currency',
'oldfieldname': 'currency',
'oldfieldtype': 'Select',
'options': 'link:Currency',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'default': '1',
'description': "Rate at which supplier's currency is converted to your currency",
'doctype': 'DocField',
'fieldname': 'conversion_rate',
'fieldtype': 'Currency',
'idx': 26,
'label': 'Conversion Rate',
'no_copy': 1,
'oldfieldname': 'conversion_rate',
'oldfieldtype': 'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 27,
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'supplier_quotation_details',
'fieldtype': 'Table',
'idx': 28,
'label': 'Quotation Details1',
'oldfieldname': 'supplier_quotation_details',
'oldfieldtype': 'Table',
'options': 'Supplier Quotation Detail',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'net_total',
'fieldtype': 'Currency',
'idx': 29,
'label': 'Net Total',
'oldfieldname': 'net_total',
'oldfieldtype': 'Currency',
'permlevel': 1
},
# DocField
{
'colour': 'White:FFF',
'description': 'Enter terms and conditions which you want to include',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 30,
'label': 'Terms',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'tc_name',
'fieldtype': 'Link',
'idx': 31,
'label': 'Select Terms',
'oldfieldname': 'tc_name',
'oldfieldtype': 'Link',
'options': 'Term',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 32,
'label': 'Get Terms',
'oldfieldtype': 'Button',
'options': 'get_tc_details',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 33,
'label': 'Terms HTML',
'oldfieldtype': 'HTML',
'options': 'You can add Terms and Notes that will be printed in the Transaction',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'terms',
'fieldtype': 'Text Editor',
'idx': 34,
'label': 'Terms and Conditions',
'oldfieldname': 'terms',
'oldfieldtype': 'Text Editor',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'description': "Next steps will be visible when you submit the supplier quotation and approval status is 'Approved'",
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 35,
'label': 'Next Steps',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 36,
'label': 'Get Report',
'oldfieldtype': 'Button',
'permlevel': 0,
'trigger': 'Client'
}
]