merge latest
This commit is contained in:
commit
085617ed12
@ -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);
|
||||
});
|
||||
}
|
@ -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)
|
@ -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'
|
||||
}
|
||||
]
|
20
erpnext/patches/jan_mar_2012/fix_packing_slip.py
Normal file
20
erpnext/patches/jan_mar_2012/fix_packing_slip.py
Normal file
@ -0,0 +1,20 @@
|
||||
def execute():
|
||||
"""
|
||||
* Change DN to PS mapper
|
||||
+ Set Ref doc should be submitted to 0
|
||||
+ Set validation logic of DN PS Table mapper record to docstatus=0
|
||||
"""
|
||||
import webnotes
|
||||
webnotes.conn.sql("""\
|
||||
UPDATE `tabDocType Mapper`
|
||||
SET ref_doc_submitted=0
|
||||
WHERE name='Delivery Note-Packing Slip'""")
|
||||
|
||||
webnotes.conn.sql("""\
|
||||
UPDATE `tabTable Mapper Detail`
|
||||
SET validation_logic='docstatus=0'
|
||||
WHERE parent='Delivery Note-Packing Slip'
|
||||
AND docstatus=0
|
||||
AND from_table='Delivery Note'
|
||||
AND to_table='Packing Slip'""")
|
||||
|
3
erpnext/patches/jan_mar_2012/no_copy_patch.py
Normal file
3
erpnext/patches/jan_mar_2012/no_copy_patch.py
Normal file
@ -0,0 +1,3 @@
|
||||
def execute():
|
||||
import webnotes
|
||||
webnotes.conn.sql("update `tabDocField` set no_copy = 1 where fieldname = 'insert_after' and parent = 'Custom Field'")
|
6
erpnext/patches/jan_mar_2012/reload_item.py
Normal file
6
erpnext/patches/jan_mar_2012/reload_item.py
Normal file
@ -0,0 +1,6 @@
|
||||
def execute():
|
||||
import webnotes
|
||||
from webnotes.modules.module_manager import reload_doc
|
||||
reload_doc('stock', 'doctype', 'item')
|
||||
|
||||
webnotes.conn.sql("update `tabItem` set re_order_qty = min_order_qty")
|
24
erpnext/patches/jan_mar_2012/remove_archive.py
Normal file
24
erpnext/patches/jan_mar_2012/remove_archive.py
Normal file
@ -0,0 +1,24 @@
|
||||
# TODO take backup before running this patch
|
||||
def execute():
|
||||
"""
|
||||
* Restore archived data from arc tables
|
||||
* Drop arc tables
|
||||
"""
|
||||
import webnotes
|
||||
from webnotes.utils import archive
|
||||
arc_tables = webnotes.conn.sql('show tables like "arc%"')
|
||||
try:
|
||||
webnotes.conn.auto_commit_on_excess = 1
|
||||
for tab in arc_tables:
|
||||
tab = tab[0]
|
||||
dt = tab[3:]
|
||||
res = webnotes.conn.sql("SELECT name FROM `%s`" % tab)
|
||||
for dn in res:
|
||||
archive.archive_doc(dt, dn[0], restore=1)
|
||||
except Exception, e:
|
||||
raise e
|
||||
else:
|
||||
webnotes.conn.commit()
|
||||
for tab in arc_tables:
|
||||
webnotes.conn.sql("DROP TABLE `%s`" % tab[0])
|
||||
webnotes.conn.begin()
|
@ -79,5 +79,30 @@ patch_list = [
|
||||
'patch_module': 'patches.jan_mar_2012',
|
||||
'patch_file': 'subcon_default_val',
|
||||
'description': 'Default value of is_subcontracted in PO, PR is No'
|
||||
}
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.jan_mar_2012.website',
|
||||
'patch_file': 'all',
|
||||
'description': 'Run all website related patches'
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.jan_mar_2012',
|
||||
'patch_file': 'remove_archive',
|
||||
'description': 'unarchive all records and drop archive tables'
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.jan_mar_2012',
|
||||
'patch_file': 'no_copy_patch',
|
||||
'description': 'insert after fld in custom fld should be no_copy'
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.jan_mar_2012',
|
||||
'patch_file': 'reload_item',
|
||||
'description': 'reload item'
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.jan_mar_2012',
|
||||
'patch_file': 'fix_packing_slip',
|
||||
'description': 'Update Mapper Delivery Note-Packing Slip'
|
||||
},
|
||||
]
|
||||
|
@ -318,7 +318,6 @@ class DocType:
|
||||
ch.fields[i] = d[i]
|
||||
ch.docstatus = is_submit
|
||||
ch.save(1)
|
||||
|
||||
self.doc.save()
|
||||
|
||||
|
||||
@ -351,10 +350,6 @@ class DocType:
|
||||
""" Get all raw materials including items from child bom"""
|
||||
self.cur_flat_bom_items = []
|
||||
for d in getlist(self.doclist, 'bom_materials'):
|
||||
item = {}
|
||||
if d.bom_no:
|
||||
item = sql("select is_sub_contracted_item from `tabItem` where name = '%s'" % d.item_code)
|
||||
|
||||
self.cur_flat_bom_items.append({
|
||||
'item_code' : d.item_code,
|
||||
'description' : d.description,
|
||||
|
@ -181,7 +181,7 @@ class DocType(TransactionBase):
|
||||
# ------------------
|
||||
def validate_po_date(self):
|
||||
# validate p.o date v/s delivery date
|
||||
if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) >= getdate(self.doc.delivery_date):
|
||||
if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) > getdate(self.doc.delivery_date):
|
||||
msgprint("Expected Delivery Date cannot be before Purchase Order Date")
|
||||
raise Exception
|
||||
# amendment date is necessary if document is amended
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-02-13 11:28:48',
|
||||
'creation': '2012-02-02 11:50:33',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-13 11:28:48',
|
||||
'modified': '2012-02-21 16:11:29',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -34,7 +34,7 @@
|
||||
'from_doctype': u'Delivery Note',
|
||||
'module': u'Stock',
|
||||
'name': '__common__',
|
||||
'ref_doc_submitted': 1,
|
||||
'ref_doc_submitted': 0,
|
||||
'to_doctype': u'Packing Slip'
|
||||
},
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
'from_table': u'Delivery Note',
|
||||
'match_id': 0,
|
||||
'to_table': u'Packing Slip',
|
||||
'validation_logic': u'docstatus=1'
|
||||
'validation_logic': u'docstatus=0'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
|
@ -36,8 +36,8 @@ class DocType:
|
||||
self.doc.planned_qty = flt(self.doc.planned_qty) + flt(planned_qty)
|
||||
self.doc.projected_qty = flt(self.doc.actual_qty) + flt(self.doc.ordered_qty) + flt(self.doc.indented_qty) + flt(self.doc.planned_qty) - flt(self.doc.reserved_qty)
|
||||
self.doc.save()
|
||||
if(( flt(actual_qty)<0 or flt(reserved_qty)>0 )and is_cancelled == 'No' and is_amended=='No'):
|
||||
self.reorder_item(doc_type,doc_name)
|
||||
if(( flt(actual_qty)<0 or flt(reserved_qty)>0 ) and is_cancelled == 'No' and is_amended=='No'):
|
||||
self.reorder_item(doc_type,doc_name)
|
||||
|
||||
if actual_qty:
|
||||
# check actual qty with total number of serial no
|
||||
@ -304,26 +304,37 @@ class DocType:
|
||||
(flt(val_rate), cqty, flt(stock_val), self.doc.name))
|
||||
|
||||
|
||||
# item re-order
|
||||
# -------------
|
||||
|
||||
def reorder_item(self,doc_type,doc_name):
|
||||
""" Reorder item if stock reaches reorder level"""
|
||||
|
||||
if get_value('Manage Account', None, 'auto_indent'):
|
||||
#check if re-order is required
|
||||
indent_detail_fields = sql("select re_order_level,item_name,description,brand,item_group,lead_time_days,min_order_qty,email_notify from tabItem where item_code = %s",(self.doc.item_code),as_dict=1)
|
||||
i = indent_detail_fields[0]
|
||||
item_reorder_level = i['re_order_level'] or 0
|
||||
if ((flt(item_reorder_level) > flt(self.doc.projected_qty)) and item_reorder_level) :
|
||||
self.reorder_indent(i,item_reorder_level,doc_type,doc_name,email_notify=i['email_notify'])
|
||||
ret = sql("select re_order_level, item_name, description, brand, item_group, lead_time_days, min_order_qty, email_notify, re_order_qty from tabItem where item_code = %s", (self.doc.item_code), as_dict=1)
|
||||
|
||||
current_qty = sql("""
|
||||
select sum(t1.actual_qty) + sum(t1.indented_qty) + sum(t1.ordered_qty) -sum(t1.reserved_qty)
|
||||
from tabBin t1, tabWarehouse t2
|
||||
where t1.item_code = %s
|
||||
and t1.warehouse = t2.name
|
||||
and t2.warehouse_type in ('Stores', 'Reserved', 'Default Warehouse Type')
|
||||
and t1.docstatus != 2
|
||||
""", self.doc.item_code)
|
||||
|
||||
if ((flt(ret[0]['re_order_level']) > flt(current_qty)) and ret[0]['re_order_level']):
|
||||
self.create_auto_indent(ret[0], doc_type, doc_name)
|
||||
|
||||
|
||||
|
||||
def create_auto_indent(self, i , doc_type, doc_name):
|
||||
""" Create indent on reaching reorder level """
|
||||
|
||||
|
||||
# Re order Auto Intent Generation
|
||||
def reorder_indent(self,i,item_reorder_level,doc_type,doc_name,email_notify=1):
|
||||
indent = Document('Indent')
|
||||
indent.transaction_date = nowdate()
|
||||
indent.naming_series = 'IDT'
|
||||
indent.company = get_defaults()['company']
|
||||
indent.fiscal_year = get_defaults()['fiscal_year']
|
||||
indent.remark = "This is an auto generated Indent. It was raised because the projected quantity has fallen below the minimum re-order level when %s %s was created"%(doc_type,doc_name)
|
||||
indent.remark = "This is an auto generated Indent. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created"%(doc_type,doc_name)
|
||||
indent.save(1)
|
||||
indent_obj = get_obj('Indent',indent.name,with_children=1)
|
||||
indent_details_child = addchild(indent_obj.doc,'indent_details','Indent Detail',0)
|
||||
@ -334,26 +345,29 @@ class DocType:
|
||||
indent_details_child.item_name = i['item_name']
|
||||
indent_details_child.description = i['description']
|
||||
indent_details_child.item_group = i['item_group']
|
||||
if (i['min_order_qty'] < ( flt(item_reorder_level)-flt(self.doc.projected_qty) )):
|
||||
indent_details_child.qty =flt(flt(item_reorder_level)-flt(self.doc.projected_qty))
|
||||
else:
|
||||
indent_details_child.qty = i['min_order_qty']
|
||||
indent_details_child.qty = i['re_order_qty']
|
||||
indent_details_child.brand = i['brand']
|
||||
indent_details_child.save()
|
||||
indent_obj = get_obj('Indent',indent.name,with_children=1)
|
||||
indent_obj.validate()
|
||||
set(indent_obj.doc,'docstatus',1)
|
||||
indent_obj.on_submit()
|
||||
msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised.Was generated from %s %s"%(indent.name,doc_type, doc_name ))
|
||||
if(email_notify):
|
||||
msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised. It was generated from %s %s"%(indent.name,doc_type, doc_name ))
|
||||
if(i['email_notify']):
|
||||
send_email_notification(doc_type,doc_name)
|
||||
|
||||
|
||||
|
||||
def send_email_notification(self,doc_type,doc_name):
|
||||
""" Notify user about auto creation of indent"""
|
||||
|
||||
email_list=[d for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') ")]
|
||||
msg1='An Indent has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate())
|
||||
sendmail(email_list, sender='automail@webnotestech.com', \
|
||||
subject='Auto Indent Generation Notification', parts=[['text/plain',msg1]])
|
||||
# validate
|
||||
|
||||
|
||||
|
||||
def validate(self):
|
||||
self.validate_mandatory()
|
||||
|
||||
|
@ -52,7 +52,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
unhide_field(['SMS','Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']);
|
||||
}
|
||||
|
||||
if(doc.docstatus==1) {
|
||||
if(doc.docstatus==0 && !doc.__islocal) {
|
||||
cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']);
|
||||
}
|
||||
|
||||
|
@ -309,6 +309,7 @@ class DocType(TransactionBase):
|
||||
# ON SUBMIT
|
||||
# =================================================================================================
|
||||
def on_submit(self):
|
||||
self.validate_packed_qty()
|
||||
set(self.doc, 'message', 'Items against your Order #%s have been delivered. Delivery #%s: ' % (self.doc.po_no, self.doc.name))
|
||||
self.check_qty_in_stock()
|
||||
# Check for Approving Authority
|
||||
@ -326,6 +327,28 @@ class DocType(TransactionBase):
|
||||
set(self.doc, 'status', 'Submitted')
|
||||
|
||||
|
||||
def validate_packed_qty(self):
|
||||
"""
|
||||
Validate that if packed qty exists, it should be equal to qty
|
||||
"""
|
||||
if not any([d.fields.get('packed_qty') for d in self.doclist]):
|
||||
return
|
||||
packing_error_list = []
|
||||
for d in self.doclist:
|
||||
if d.doctype != 'Delivery Note Detail': continue
|
||||
if d.fields.get('qty') != d.fields.get('packed_qty'):
|
||||
packing_error_list.append([
|
||||
d.fields.get('item_code', ''),
|
||||
d.fields.get('qty', ''),
|
||||
d.fields.get('packed_qty', '')
|
||||
])
|
||||
if packing_error_list:
|
||||
from webnotes.utils import cstr
|
||||
err_msg = "\n".join([("Item: " + d[0] + ", Qty: " + cstr(d[1]) \
|
||||
+ ", Packed: " + cstr(d[2])) for d in packing_error_list])
|
||||
webnotes.msgprint("Packing Error:\n" + err_msg, raise_exception=1)
|
||||
|
||||
|
||||
# *********** Checks whether actual quantity is present in warehouse *************
|
||||
def check_qty_in_stock(self):
|
||||
for d in getlist(self.doclist, 'packing_details'):
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,12 @@
|
||||
cur_frm.fields_dict['delivery_note'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=1 AND %(key)s LIKE "%s"';
|
||||
return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=0 AND %(key)s LIKE "%s"';
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name, description FROM `tabItem` WHERE name IN ( \
|
||||
SELECT item_code FROM `tabDelivery Note Detail` \
|
||||
WHERE parent="' + doc.delivery_note + '") AND %(key)s LIKE "%s" LIMIT 50';
|
||||
SELECT item_code FROM `tabDelivery Note Detail` dnd \
|
||||
WHERE parent="' + doc.delivery_note + '" AND qty > packed_qty) AND %(key)s LIKE "%s" LIMIT 50';
|
||||
}
|
||||
|
||||
|
||||
@ -39,8 +39,7 @@ cur_frm.cscript.update_item_details = function(doc) {
|
||||
if(r.exc) {
|
||||
msgprint(r.exc);
|
||||
} else {
|
||||
refresh_field('item_details');
|
||||
refresh_field('naming_series');
|
||||
refresh_many(['item_details', 'naming_series', 'from_case_no', 'to_case_no'])
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -28,9 +28,10 @@ class DocType:
|
||||
WHERE name=%(delivery_note)s
|
||||
""", self.doc.fields)
|
||||
|
||||
if not(res and res[0][0]==1):
|
||||
if not(res and res[0][0]==0):
|
||||
webnotes.msgprint("""Invalid Delivery Note. Delivery Note should exist
|
||||
and should be submitted. Please rectify and try again.""", raise_exception=1)
|
||||
and should be in draft state. Please rectify and try again.""",
|
||||
raise_exception=1)
|
||||
|
||||
|
||||
def validate_case_nos(self):
|
||||
@ -46,12 +47,8 @@ class DocType:
|
||||
""", self.doc.fields)
|
||||
|
||||
if res:
|
||||
recommended_case_no = webnotes.conn.sql("""\
|
||||
SELECT MAX(to_case_no) FROM `tabPacking Slip`
|
||||
WHERE delivery_note = %(delivery_note)s AND docstatus=1""", self.doc.fields)
|
||||
|
||||
webnotes.msgprint("""Case No(s). already in use. Please rectify and try again.
|
||||
Recommended <b>From Case No. = %s</b>""" % (cint(recommended_case_no[0][0]) + 1),
|
||||
Recommended <b>From Case No. = %s</b>""" % self.get_recommended_case_no(),
|
||||
raise_exception=1)
|
||||
|
||||
|
||||
@ -75,13 +72,18 @@ class DocType:
|
||||
* Item Quantity dict of current packing slip doc
|
||||
* No. of Cases of this packing slip
|
||||
"""
|
||||
item_codes = ", ".join([('"' + d.item_code + '"') for d in self.doclist])
|
||||
item_codes = ", ".join([('"' + d.item_code + '"') for d in
|
||||
self.doclist])
|
||||
|
||||
if not item_codes: webnotes.msgprint("No Items to Pack",
|
||||
raise_exception=1)
|
||||
|
||||
res = webnotes.conn.sql("""\
|
||||
SELECT item_code, IFNULL(SUM(qty), 0) as qty, IFNULL(packed_qty, 0) as packed_qty, stock_uom
|
||||
FROM `tabDelivery Note Detail`
|
||||
WHERE parent = "%s" AND item_code IN (%s)
|
||||
GROUP BY item_code""" % (self.doc.delivery_note, item_codes), as_dict=1)
|
||||
GROUP BY item_code""" % (self.doc.delivery_note, item_codes),
|
||||
as_dict=1)
|
||||
|
||||
ps_item_qty = dict([[d.item_code, d.qty] for d in self.doclist])
|
||||
|
||||
@ -150,7 +152,23 @@ class DocType:
|
||||
"""
|
||||
Fill empty columns in Packing Slip Detail
|
||||
"""
|
||||
self.doc.from_case_no = self.get_recommended_case_no()
|
||||
|
||||
from webnotes.model.code import get_obj
|
||||
for d in self.doclist:
|
||||
psd_obj = get_obj(doc=d)
|
||||
psd_obj.get_item_details(self.doc.delivery_note)
|
||||
|
||||
|
||||
def get_recommended_case_no(self):
|
||||
"""
|
||||
Returns the next case no. for a new packing slip for a delivery
|
||||
note
|
||||
"""
|
||||
recommended_case_no = webnotes.conn.sql("""\
|
||||
SELECT MAX(to_case_no) FROM `tabPacking Slip`
|
||||
WHERE delivery_note = %(delivery_note)s AND docstatus=1""", self.doc.fields)
|
||||
|
||||
return cint(recommended_case_no[0][0]) + 1
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user