added button, method in Purchase Order to fetch Supplier Quotation Items

This commit is contained in:
Anand Doshi 2012-08-06 18:26:07 +05:30
parent da85a8363f
commit b6029d2d13
2 changed files with 44 additions and 4 deletions

View File

@ -86,7 +86,7 @@ class DocType(TransactionBase):
if self.doc.indent_no:
get_obj('DocType Mapper','Purchase Request-Purchase Order').dt_map('Purchase Request','Purchase Order',self.doc.indent_no, self.doc, self.doclist, "[['Purchase Request','Purchase Order'],['Purchase Request Item', 'Purchase Order Item']]")
pcomm = get_obj('Purchase Common')
for d in getlist(self.doclist, 'po_details'):
for d in getlist(self.doclist, 'po_details'):
if d.item_code and not d.purchase_rate:
last_purchase_details, last_purchase_date = pcomm.get_last_purchase_details(d.item_code, self.doc.name)
if last_purchase_details:
@ -99,6 +99,19 @@ class DocType(TransactionBase):
d.import_rate = d.purchase_rate / conversion_rate
else:
d.purchase_ref_rate = d.discount_rate = d.purchase_rate = d.import_ref_rate = d.import_rate = 0.0
def get_supplier_quotation_items(self):
if self.doc.supplier_quotation:
get_obj("DocType Mapper", "Supplier Quotation-Purchase Order").dt_map("Supplier Quotation",
"Purchase Order", self.doc.supplier_quotation, self.doc, self.doclist,
"""[['Supplier Quotation', 'Purchase Order'],
['Supplier Quotation Item', 'Purchase Order Item'],
['Purchase Taxes and Charges', 'Purchase Taxes and Charges']]""")
self.get_default_schedule_date()
for d in getlist(self.doclist, 'po_details'):
if d.prevdoc_detail_docname and not d.schedule_date:
d.schedule_date = webnotes.conn.get_value("Purchase Request Item",
d.prevdoc_detail_docname, "schedule_date")
def get_tc_details(self):
"""get terms & conditions"""

View File

@ -5,7 +5,7 @@
{
'creation': '2012-07-02 14:44:19',
'docstatus': 0,
'modified': '2012-08-02 13:43:50',
'modified': '2012-08-06 17:14:19',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -464,9 +464,35 @@
'fieldtype': u'Button',
'hidden': 0,
'label': u'Get Items',
'no_copy': 0,
'oldfieldtype': u'Button',
'options': u'get_indent_details',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'description': u'You can make a purchase order from multiple Supplier Quotations. Select Supplier Quotations one by one and click on the button below.',
'doctype': u'DocField',
'fieldname': u'supplier_quotation',
'fieldtype': u'Link',
'label': u'Select Supplier Quotation',
'no_copy': 1,
'options': u'Supplier Quotation',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'get_supplier_quotation_items',
'fieldtype': u'Button',
'label': u'Get Items',
'options': u'get_supplier_quotation_items',
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -477,7 +503,8 @@
'fieldtype': u'Section Break',
'label': u'Taxes',
'oldfieldtype': u'Section Break',
'permlevel': 0
'permlevel': 0,
'print_hide': 0
},
# DocField