diff --git a/.gitignore b/.gitignore index ba0a9a311b..99a0c8a95a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,13 +5,12 @@ patch.log lib conf.py version.num -public/*.html -!public/blank.html -!public/unsupported.html -!public/app.html public/js/lib public/images/lib public/files public/backups public/css/wn-web.css public/js/wn-web.js +backups +files +logs \ No newline at end of file diff --git a/erpnext/buying/DocType Mapper/Purchase Request-Supplier Quotation/Purchase Request-Supplier Quotation.txt b/erpnext/buying/DocType Mapper/Purchase Request-Supplier Quotation/Purchase Request-Supplier Quotation.txt new file mode 100644 index 0000000000..95b13ba447 --- /dev/null +++ b/erpnext/buying/DocType Mapper/Purchase Request-Supplier Quotation/Purchase Request-Supplier Quotation.txt @@ -0,0 +1,124 @@ +# DocType Mapper, Purchase Request-Supplier Quotation +[ + + # These values are common in all dictionaries + { + 'creation': '2012-08-02 18:36:26', + 'docstatus': 0, + 'modified': '2012-08-02 18:37:32', + 'modified_by': u'Administrator', + 'owner': u'Administrator' + }, + + # These values are common for all Table Mapper Detail + { + 'doctype': u'Table Mapper Detail', + 'name': '__common__', + 'parent': u'Purchase Request-Supplier Quotation', + 'parentfield': u'table_mapper_details', + 'parenttype': u'DocType Mapper' + }, + + # These values are common for all Field Mapper Detail + { + 'doctype': u'Field Mapper Detail', + 'name': '__common__', + 'parent': u'Purchase Request-Supplier Quotation', + 'parentfield': u'field_mapper_details', + 'parenttype': u'DocType Mapper' + }, + + # These values are common for all DocType Mapper + { + 'doctype': u'DocType Mapper', + 'from_doctype': u'Purchase Request', + 'module': u'Buying', + 'name': '__common__', + 'ref_doc_submitted': 1, + 'to_doctype': u'Supplier Quotation' + }, + + # DocType Mapper, Purchase Request-Supplier Quotation + { + 'doctype': u'DocType Mapper', + 'name': u'Purchase Request-Supplier Quotation' + }, + + # Field Mapper Detail + { + 'checking_operator': u'=', + 'doctype': u'Field Mapper Detail', + 'from_field': u'company', + 'map': u'Yes', + 'match_id': 0, + 'to_field': u'company' + }, + + # Field Mapper Detail + { + 'doctype': u'Field Mapper Detail', + 'from_field': u'parenttype', + 'map': u'Yes', + 'match_id': 1, + 'to_field': u'prevdoc_doctype' + }, + + # Field Mapper Detail + { + 'doctype': u'Field Mapper Detail', + 'from_field': u'parent', + 'map': u'Yes', + 'match_id': 1, + 'to_field': u'prevdoc_docname' + }, + + # Field Mapper Detail + { + 'doctype': u'Field Mapper Detail', + 'from_field': u'name', + 'map': u'Yes', + 'match_id': 1, + 'to_field': u'prevdoc_detail_docname' + }, + + # Field Mapper Detail + { + 'doctype': u'Field Mapper Detail', + 'from_field': u'uom', + 'map': u'Yes', + 'match_id': 1, + 'to_field': u'stock_uom' + }, + + # Field Mapper Detail + { + 'checking_operator': u'>=', + 'doctype': u'Field Mapper Detail', + 'from_field': u'transaction_date', + 'map': u'No', + 'match_id': 0, + 'to_field': u'transaction_date' + }, + + # Table Mapper Detail + { + 'doctype': u'Table Mapper Detail', + 'from_table': u'Purchase Request', + 'match_id': 0, + 'reference_key': u'prevdoc_docname', + 'to_table': u'Supplier Quotation', + 'validation_logic': u'docstatus = 1' + }, + + # Table Mapper Detail + { + 'doctype': u'Table Mapper Detail', + 'from_field': u'indent_details', + 'from_table': u'Purchase Request Item', + 'match_id': 1, + 'reference_doctype_key': u'prevdoc_doctype', + 'to_field': u'quotation_details', + 'to_table': u'Supplier Quotation Item', + 'validation_logic': u'docstatus =1' + } +] \ No newline at end of file diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 82a9953df1..81d5fbf813 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -121,27 +121,21 @@ var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) { //------------------------------------------------------------------ cur_frm.cscript.dynamic_label = function(doc, cdt, cdn, callback1) { - var callback = function(r, rt) { - if (r.message) base_curr = r.message; - else base_curr = sys_defaults['currency']; - - if (base_curr == doc.currency) { - set_multiple(cdt, cdn, {conversion_rate:1}); - hide_field(['conversion_rate', 'net_total_import','grand_total_import', 'in_words_import', 'other_charges_added_import', 'other_charges_deducted_import']); - } else unhide_field(['conversion_rate', 'net_total_import','grand_total_import', 'in_words_import', 'other_charges_added_import', 'other_charges_deducted_import']); - - set_dynamic_label_par(doc, cdt, cdn, base_curr); - set_dynamic_label_child(doc, cdt, cdn, base_curr); - - if(callback1) callback1(doc, cdt, cdn); + var base_currency = wn.boot.company[doc.company].default_currency || sys_defaults['currency']; + + if (doc.currency === base_currency) { + set_multiple(cdt, cdn, {conversion_rate:1}); + hide_field(['conversion_rate', 'net_total_import','grand_total_import', + 'in_words_import', 'other_charges_added_import', 'other_charges_deducted_import']); + } else { + unhide_field(['conversion_rate', 'net_total_import','grand_total_import', + 'in_words_import', 'other_charges_added_import', 'other_charges_deducted_import']); } - - if (doc.company == sys_defaults['company']) callback('', ''); - else wn.call({ - method: 'selling.doctype.sales_common.sales_common.get_comp_base_currency', - args: {company: doc.company}, - callback: callback - }); + + set_dynamic_label_par(doc, cdt, cdn, base_currency); + set_dynamic_label_child(doc, cdt, cdn, base_currency); + + if (callback1) callback1(doc, cdt, cdn); } cur_frm.cscript.currency = function(doc, cdt, cdn) { diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index 7240a2d229..5a65d5219a 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -615,7 +615,7 @@ class DocType(TransactionBase): sql("update `tab%s` set %s = '%s', modified = '%s' where name = '%s'" % (self.ref_doctype_dict[ref_dn][0], self.update_percent_field[self.ref_doctype_dict[ref_dn][2]], percent_complete, obj.doc.modified, ref_dn)) - def validate_fiscal_year(self,fiscal_year,transaction_date,dn): + def validate_fiscal_year(self, fiscal_year, transaction_date, dn): fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%fiscal_year) ysd=fy and fy[0][0] or "" yed=add_days(str(ysd),365) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 9d50020952..a27f6ff73b 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -23,7 +23,6 @@ wn.require('erpnext/buying/doctype/purchase_common/purchase_common.js'); wn.require('erpnext/utilities/doctype/sms_control/sms_control.js'); wn.require('erpnext/setup/doctype/notification_control/notification_control.js'); -//========================== On Load ================================================= cur_frm.cscript.onload = function(doc, cdt, cdn) { if(!doc.fiscal_year && doc.__islocal){ //set_default_values(doc); @@ -37,22 +36,14 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { } cur_frm.cscript.onload_post_render = function(doc, dt, dn) { - var callback = function(doc, dt, dn) { - if(doc.__islocal){ - cur_frm.cscript.get_default_schedule_date(doc); - } - } - cur_frm.cscript.dynamic_label(doc, dt, dn, callback); + if(doc.__islocal) cur_frm.cscript.get_default_schedule_date(doc); } -// ================================== Refresh ========================================== cur_frm.cscript.refresh = function(doc, cdt, cdn) { - // Show buttons - // --------------------------------- cur_frm.clear_custom_buttons(); erpnext.hide_naming_series(); - if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, cdt, cdn); + cur_frm.cscript.dynamic_label(doc, cdt, cdn); if(doc.docstatus == 1 && doc.status != 'Stopped'){ cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']); @@ -68,7 +59,6 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { else $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(false); } -//Supplier cur_frm.cscript.supplier = function(doc,dt,dn) { if (doc.supplier) { get_server_fields('get_default_supplier_address', @@ -102,33 +92,14 @@ cur_frm.fields_dict.contact_person.on_new = function(dn) { locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name; } - - - - -//================ create new contact ============================================================================ -cur_frm.cscript.new_contact = function(){ - tn = createLocal('Contact'); - locals['Contact'][tn].is_supplier = 1; - if(doc.supplier) locals['Contact'][tn].supplier = doc.supplier; - loaddoc('Contact', tn); -} - -//======================= transaction date ============================= cur_frm.cscript.transaction_date = function(doc,cdt,cdn){ - if(doc.__islocal){ - cur_frm.cscript.get_default_schedule_date(doc); - } + if(doc.__islocal){ cur_frm.cscript.get_default_schedule_date(doc); } } - -// ---------------------- Get project name -------------------------- cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) { return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; } -//==================== Purchase Request No Get Query ======================================================= -//===== Only those Purchase Requests status != 'Completed' and docstatus = 1 i.e. submitted================= cur_frm.fields_dict['indent_no'].get_query = function(doc) { return 'SELECT DISTINCT `tabPurchase Request`.`name` FROM `tabPurchase Request` WHERE `tabPurchase Request`.company = "' + doc.company + '" and `tabPurchase Request`.`docstatus` = 1 and `tabPurchase Request`.`status` != "Stopped" and ifnull(`tabPurchase Request`.`per_ordered`,0) < 100 and `tabPurchase Request`.%(key)s LIKE "%s" ORDER BY `tabPurchase Request`.`name` DESC LIMIT 50'; } @@ -203,10 +174,6 @@ cur_frm.cscript['Unstop Purchase Order'] = function() { } } -// ***************** Get Print Heading ***************** -cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) { - return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; -} //****************** For print sales order no and date************************* cur_frm.pformat.indent_no = function(doc, cdt, cdn){ //function to make row of table diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 9b7e99c26f..40b7281f84 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -83,7 +83,6 @@ class DocType(TransactionBase): # Pull Purchase Request def get_indent_details(self): - #self.validate_prev_docname() 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') @@ -101,26 +100,13 @@ class DocType(TransactionBase): else: d.purchase_ref_rate = d.discount_rate = d.purchase_rate = d.import_ref_rate = d.import_rate = 0.0 - # GET TERMS & CONDITIONS - # ===================================================================================== def get_tc_details(self): + """get terms & conditions""" return get_obj('Purchase Common').get_tc_details(self) - - - # validate if indent has been pulled twice - def validate_prev_docname(self): - for d in getlist(self.doclist, 'po_details'): - if d.prevdoc_docname and self.doc.indent_no == d.prevdoc_docname: - msgprint(cstr(self.doc.indent_no) + " indent details have already been pulled. ") - raise Exception - - # get last purchase rate def get_last_purchase_rate(self): get_obj('Purchase Common').get_last_purchase_rate(self) - # validation - #------------------------------------------------------------------------------------------------------------- def validate_doc(self,pc_obj): # Validate values with reference document pc_obj.validate_reference_value(obj = self) @@ -233,16 +219,14 @@ class DocType(TransactionBase): get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total) # Step 4 :=> Update Current PO No. in Supplier as last_purchase_order. - update_supplier = sql("update `tabSupplier` set last_purchase_order = '%s' where name = '%s'" % (self.doc.name, self.doc.supplier)) + update_supplier = webnotes.conn.set_value("Supplier", self.doc.supplier, + "last_purchase_order", self.doc.name) # Step 5 :=> Update last purchase rate pc_obj.update_last_purchase_rate(self, is_submit = 1) # Step 6 :=> Set Status set(self.doc,'status','Submitted') - - self.doc.indent_no = ''; - # On Cancel # ------------------------------------------------------------------------------------------------------- diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.txt b/erpnext/buying/doctype/purchase_order/purchase_order.txt index 13210f2e4d..318ebda35b 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.txt +++ b/erpnext/buying/doctype/purchase_order/purchase_order.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-11 12:00:15', + 'creation': '2012-07-02 14:44:19', 'docstatus': 0, - 'modified': '2012-05-11 16:59:10', + 'modified': '2012-08-02 13:43:50', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -962,23 +962,6 @@ 'width': u'50%' }, - # DocField - { - 'colour': u'White:FFF', - 'description': u'Track this Purchase Order against any Project', - 'doctype': u'DocField', - 'fieldname': u'project_name', - 'fieldtype': u'Link', - 'in_filter': 1, - 'label': u'Project Name', - 'oldfieldname': u'project_name', - 'oldfieldtype': u'Link', - 'options': u'Project', - 'permlevel': 0, - 'search_index': 1, - 'trigger': u'Client' - }, - # DocField { 'colour': u'White:FFF', diff --git a/erpnext/buying/doctype/supplier_quotation/__init__.py b/erpnext/buying/doctype/supplier_quotation/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js new file mode 100644 index 0000000000..4d2673c5ef --- /dev/null +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -0,0 +1,113 @@ +// ERPNext - web based ERP (http://erpnext.com) +// Copyright (C) 2012 Web Notes Technologies Pvt Ltd +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// define defaults for purchase common +cur_frm.cscript.tname = "Supplier Quotation Item"; +cur_frm.cscript.fname = "quotation_items"; +cur_frm.cscript.other_fname = "purchase_tax_details"; + +// attach required files +wn.require('erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js'); +wn.require('erpnext/buying/doctype/purchase_common/purchase_common.js'); + +cur_frm.cscript.onload = function(doc, dt, dn) { + // set missing values in parent doc + set_missing_values(doc, { + fiscal_year: sys_defaults.fiscal_year, + conversion_rate: 1, + currency: sys_defaults.currency, + status: "Draft", + transaction_date: get_today(), + is_subcontracted: "No" + }); +} + +cur_frm.cscript.refresh = function(doc, dt, dn) { + erpnext.hide_naming_series(); + cur_frm.cscript.dynamic_label(doc, dt, dn); + + cur_frm.cscript.toggle_contact_section(doc); + + cur_frm.clear_custom_buttons(); + if (doc.docstatus === 1) { + cur_frm.add_custom_button("Make Purchase Order", cur_frm.cscript.make_purchase_order); + } +} + +cur_frm.cscript.toggle_contact_section = function(doc) { + console.log(doc.supplier); + doc.supplier ? unhide_field("contact_section") : hide_field("contact_section"); +} + +cur_frm.cscript.make_purchase_order = function(doc, dt, dn) { + +} + +cur_frm.cscript.supplier = function(doc, dt, dn) { + if (doc.supplier) { + get_server_fields('get_default_supplier_address', + JSON.stringify({ supplier: doc.supplier }), '', doc, dt, dn, 1, + function() { cur_frm.refresh(); }); + cur_frm.cscript.toggle_contact_section(doc); + } +} + +cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query = + function(doc, cdt, cdn) { + return "select `tabProject`.name from `tabProject` \ + where `tabProject`.status = \"Open\" and `tabProject`.name like \"%s\" \ + order by `tabProject`.name ASC LIMIT 50"; + } + +cur_frm.fields_dict['indent_no'].get_query = function(doc) { + return "select distinct `tabPurchase Request`.`name` from `tabPurchase Request` \ + where `tabPurchase Request`.company = \"" + doc.company + + "\" and `tabPurchase Request`.`docstatus` = 1 and \ + `tabPurchase Request`.`status` != \"Stopped\" and \ + ifnull(`tabPurchase Request`.`per_ordered`,0) < 100 and \ + `tabPurchase Request`.%(key)s LIKE \"%s\" \ + order by `tabPurchase Request`.`name` desc limit 50"; +} + + +cur_frm.cscript.supplier_address = function(doc, dt, dn) { + if (doc.supplier) { + get_server_fields("get_supplier_address", JSON.stringify({supplier: doc.supplier, + address: doc.supplier_address, contact: doc.contact_person}), '', doc, dt, dn, 1); + } +} +cur_frm.cscript.contact_person = cur_frm.cscript.supplier_address; + +cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { + return "SELECT name, address_line1, city FROM tabAddress WHERE supplier = \"" + doc.supplier + + "\" AND docstatus != 2 AND name LIKE \"%s\" ORDER BY name ASC LIMIT 50"; +} + +cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { + return "SELECT name, CONCAT(first_name, \" \", ifnull(last_name,\"\")) As FullName, \ + department, designation FROM tabContact WHERE supplier = \"" + doc.supplier + +"\" AND docstatus != 2 AND name LIKE \"%s\" ORDER BY name ASC LIMIT 50"; +} + +cur_frm.fields_dict.supplier_address.on_new = function(dn) { + locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier; + locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name; +} + +cur_frm.fields_dict.contact_person.on_new = function(dn) { + locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier; + locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name; +} \ No newline at end of file diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py new file mode 100644 index 0000000000..f52e428744 --- /dev/null +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py @@ -0,0 +1,96 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import webnotes +from webnotes.model.code import get_obj +from utilities.transaction_base import TransactionBase + +class DocType(TransactionBase): + def __init__(self, doc, doclist=None): + self.doc, self.doclist = doc, doclist or [] + self.tname, self.fname = "Supplier Quotation Item", "quotation_item" + + def autoname(self): + """autoname based on naming series value""" + from webnotes.model.doc import make_autoname + self.doc.name = make_autoname(self.doc.naming_series + ".#####") + + def validate(self): + self.validate_fiscal_year() + self.validate_common() + self.set_in_words() + self.doc.status = "Draft" + + def on_submit(self): + webnotes.conn.set(self.doc, "status", "Submitted") + + def on_cancel(self): + webnotes.conn.set(self.doc, "status", "Cancelled") + + def on_trash(self): + pass + + def get_item_details(self, args=None): + if args: + return get_obj(dt='Purchase Common').get_item_details(self, args) + else: + obj = get_obj('Purchase Common') + for doc in self.doclist: + if doc.fields.get('item_code'): + temp = { + 'item_code': doc.fields.get('item_code'), + 'warehouse': doc.fields.get('warehouse') + } + ret = obj.get_item_details(self, json.dumps(temp)) + for r in ret: + if not doc.fields.get(r): + doc.fields[r] = ret[r] + + def get_indent_details(self): + if self.doc.indent_no: + mapper = get_obj("DocType Mapper", "Purchase Request-Supplier Quotation") + mapper.dt_map("Purchase Request", "Supplier Quotation", self.doc.indent_no, + self.doc, self.doclist, """[['Purchase Request', 'Supplier Quotation'], + ['Purchase Request Item', 'Supplier Quotation Item']]""") + + for d in getlist(self.doclist, "quotation_details"): + if d.item_code and not d.purchase_rate: + d.purchase_ref_rate = d.discount_rate = d.purchase_rate = 0.0 + d.import_ref_rate = d.import_rate = 0.0 + + def get_purchase_tax_details(self): + self.doclist = get_obj('Purchase Common').get_purchase_tax_details(self) + + def get_uom_details(self, args=None): + return get_obj('Purchase Common').get_uom_details(args) + + def validate_fiscal_year(self): + get_obj(dt = 'Purchase Common').validate_fiscal_year( \ + self.doc.fiscal_year, self.doc.transaction_date, 'Quotation Date') + + def validate_common(self): + pc = get_obj('Purchase Common') + pc.validate_mandatory(self) + pc.validate_for_items(self) + pc.validate_conversion_rate(self) + pc.get_prevdoc_date(self) + pc.validate_reference_value(self) + + def set_in_words(self): + pc = get_obj('Purchase Common') + company_currency = TransactionBase().get_company_currency(self.doc.company) + self.doc.in_words = pc.get_total_in_words(company_currency, self.doc.grand_total) + self.doc.in_words_import = pc.get_total_in_words(self.doc.currency, self.doc.grand_total_import) diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt new file mode 100644 index 0000000000..e4a33ca91b --- /dev/null +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt @@ -0,0 +1,924 @@ +# DocType, Supplier Quotation +[ + + # These values are common in all dictionaries + { + 'creation': '2012-08-01 20:03:35', + 'docstatus': 0, + 'modified': '2012-08-02 18:04:35', + 'modified_by': u'Administrator', + 'owner': u'Administrator' + }, + + # These values are common for all DocType + { + 'allow_attach': 1, + 'default_print_format': u'Standard', + 'doctype': 'DocType', + 'document_type': u'Transaction', + 'is_submittable': 1, + 'is_transaction_doc': 1, + 'module': u'Buying', + 'name': '__common__', + 'read_only_onload': 1, + 'search_fields': u'status, transaction_date, supplier,grand_total', + 'version': 1 + }, + + # These values are common for all DocField + { + 'doctype': u'DocField', + 'name': '__common__', + 'parent': u'Supplier Quotation', + 'parentfield': u'fields', + 'parenttype': u'DocType' + }, + + # These values are common for all DocPerm + { + 'doctype': u'DocPerm', + 'name': '__common__', + 'parent': u'Supplier Quotation', + 'parentfield': u'permissions', + 'parenttype': u'DocType', + 'read': 1 + }, + + # DocType, Supplier Quotation + { + 'doctype': 'DocType', + 'name': u'Supplier Quotation' + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Production Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 0, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase User', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Supplier', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'All', + 'submit': 0, + 'write': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'basic_info', + 'fieldtype': u'Section Break', + 'label': u'Basic Info', + 'oldfieldtype': u'Section Break', + 'permlevel': 0, + 'print_hide': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'column_break0', + 'fieldtype': u'Column Break', + 'oldfieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'To manage multiple series please go to Setup > Manage Series', + 'doctype': u'DocField', + 'fieldname': u'naming_series', + 'fieldtype': u'Select', + 'label': u'Series', + 'no_copy': 1, + 'oldfieldname': u'naming_series', + 'oldfieldtype': u'Select', + 'options': u'SQTN', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Supplier (vendor) name as entered in supplier master', + 'doctype': u'DocField', + 'fieldname': u'supplier', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Supplier', + 'oldfieldname': u'supplier', + 'oldfieldtype': u'Link', + 'options': u'Supplier', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1, + 'search_index': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'supplier_name', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u'Name', + 'permlevel': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'address_display', + 'fieldtype': u'Small Text', + 'hidden': 1, + 'label': u'Address', + 'permlevel': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'contact_display', + 'fieldtype': u'Small Text', + 'hidden': 1, + 'label': u'Contact', + 'permlevel': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'contact_mobile', + 'fieldtype': u'Text', + 'hidden': 1, + 'label': u'Mobile No', + 'permlevel': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'contact_email', + 'fieldtype': u'Text', + 'hidden': 1, + 'label': u'Contact Email', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'column_break1', + 'fieldtype': u'Column Break', + 'oldfieldtype': u'Column Break', + 'permlevel': 0, + 'print_hide': 0, + 'width': u'50%' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'The date at which current entry is made in system.', + 'doctype': u'DocField', + 'fieldname': u'transaction_date', + 'fieldtype': u'Date', + 'in_filter': 1, + 'label': u'Quotation Date', + 'oldfieldname': u'transaction_date', + 'oldfieldtype': u'Date', + 'permlevel': 0, + 'reqd': 1, + 'search_index': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'items', + 'fieldtype': u'Section Break', + 'label': u'Items', + 'oldfieldtype': u'Section Break', + 'permlevel': 0 + }, + + # DocField + { + 'allow_on_submit': 1, + 'doctype': u'DocField', + 'fieldname': u'quotation_items', + 'fieldtype': u'Table', + 'label': u'Quotation Items', + 'no_copy': 0, + 'oldfieldname': u'po_details', + 'oldfieldtype': u'Table', + 'options': u'Supplier Quotation Item', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'section_break0', + 'fieldtype': u'Section Break', + 'options': u'Simple', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'column_break2', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'net_total', + 'fieldtype': u'Currency', + 'label': u'Net Total*', + 'no_copy': 1, + 'oldfieldname': u'net_total', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1, + 'reqd': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'net_total_import', + 'fieldtype': u'Currency', + 'label': u'Net Total (Import)', + 'no_copy': 0, + 'oldfieldname': u'net_total_import', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'recalculate_values', + 'fieldtype': u'Button', + 'label': u'Re-Calculate Values', + 'oldfieldtype': u'Button', + 'permlevel': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'column_break3', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u"Supplier's currency", + 'doctype': u'DocField', + 'fieldname': u'currency', + 'fieldtype': u'Select', + 'label': u'Currency', + 'no_copy': 0, + 'oldfieldname': u'currency', + 'oldfieldtype': u'Select', + 'options': u'link:Currency', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'default': u'1', + 'description': u"Rate at which supplier's currency is converted to company's base currency", + 'doctype': u'DocField', + 'fieldname': u'conversion_rate', + 'fieldtype': u'Currency', + 'hidden': 0, + 'label': u'Conversion Rate', + 'no_copy': 1, + 'oldfieldname': u'conversion_rate', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'You can make a purchase order from multiple Purchase Requests. Select Purchase Requests one by one and click on the button below.', + 'doctype': u'DocField', + 'fieldname': u'indent_no', + 'fieldtype': u'Link', + 'hidden': 0, + 'label': u'Select Purchase Request', + 'no_copy': 1, + 'oldfieldname': u'indent_no', + 'oldfieldtype': u'Link', + 'options': u'Purchase Request', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'get_items', + 'fieldtype': u'Button', + 'hidden': 0, + 'label': u'Get Items', + 'oldfieldtype': u'Button', + 'options': u'get_indent_details', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'taxes', + 'fieldtype': u'Section Break', + 'label': u'Taxes', + 'oldfieldtype': u'Section Break', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.', + 'doctype': u'DocField', + 'fieldname': u'purchase_other_charges', + 'fieldtype': u'Link', + 'label': u'Purchase Taxes and Charges', + 'no_copy': 1, + 'oldfieldname': u'purchase_other_charges', + 'oldfieldtype': u'Link', + 'options': u'Purchase Taxes and Charges Master', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'get_tax_detail', + 'fieldtype': u'Button', + 'label': u'Get Tax Detail', + 'oldfieldtype': u'Button', + 'options': u'get_purchase_tax_details', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'purchase_tax_details', + 'fieldtype': u'Table', + 'label': u'Purchase Taxes and Charges', + 'no_copy': 0, + 'oldfieldname': u'purchase_tax_details', + 'oldfieldtype': u'Table', + 'options': u'Purchase Taxes and Charges', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'calculate_tax', + 'fieldtype': u'Button', + 'label': u'Calculate Tax', + 'oldfieldtype': u'Button', + 'permlevel': 0, + 'print_hide': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'tax_calculation', + 'fieldtype': u'HTML', + 'label': u'Tax Calculation', + 'no_copy': 1, + 'oldfieldtype': u'HTML', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'total_tax', + 'fieldtype': u'Currency', + 'label': u'Total Tax*', + 'no_copy': 1, + 'oldfieldname': u'total_tax', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'totals', + 'fieldtype': u'Section Break', + 'label': u'Totals', + 'oldfieldtype': u'Section Break', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'grand_total', + 'fieldtype': u'Currency', + 'label': u'Grand Total', + 'no_copy': 1, + 'oldfieldname': u'grand_total', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'rounded_total', + 'fieldtype': u'Currency', + 'label': u'Rounded Total', + 'oldfieldname': u'rounded_total', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'In Words will be visible once you save the Purchase Order.', + 'doctype': u'DocField', + 'fieldname': u'in_words', + 'fieldtype': u'Data', + 'label': u'In Words', + 'oldfieldname': u'in_words', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'other_charges_added', + 'fieldtype': u'Currency', + 'label': u'Taxes and Charges Added', + 'no_copy': 0, + 'oldfieldname': u'other_charges_added', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'other_charges_deducted', + 'fieldtype': u'Currency', + 'label': u'Taxes and Charges Deducted', + 'no_copy': 0, + 'oldfieldname': u'other_charges_deducted', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'column_break4', + 'fieldtype': u'Column Break', + 'oldfieldtype': u'Column Break', + 'permlevel': 0, + 'print_hide': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'grand_total_import', + 'fieldtype': u'Currency', + 'label': u'Grand Total (Import)', + 'no_copy': 0, + 'oldfieldname': u'grand_total_import', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1, + 'report_hide': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'in_words_import', + 'fieldtype': u'Data', + 'label': u'In Words(Import)', + 'oldfieldname': u'in_words_import', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'other_charges_added_import', + 'fieldtype': u'Currency', + 'label': u'Taxes and Charges Added (Import)', + 'no_copy': 0, + 'oldfieldname': u'other_charges_added_import', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1, + 'report_hide': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'other_charges_deducted_import', + 'fieldtype': u'Currency', + 'label': u'Taxes and Charges Deducted (Import)', + 'no_copy': 0, + 'oldfieldname': u'other_charges_deducted_import', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1, + 'report_hide': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'terms_section_break', + 'fieldtype': u'Section Break', + 'label': u'Terms and Conditions', + 'oldfieldtype': u'Section Break', + 'permlevel': 0 + }, + + # DocField + { + 'allow_on_submit': 1, + 'doctype': u'DocField', + 'fieldname': u'letter_head', + 'fieldtype': u'Select', + 'label': u'Letter Head', + 'oldfieldname': u'letter_head', + 'oldfieldtype': u'Select', + 'options': u'link:Letter Head', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'tc_name', + 'fieldtype': u'Link', + 'label': u'Select Terms and Conditions', + 'oldfieldname': u'tc_name', + 'oldfieldtype': u'Link', + 'options': u'Terms and Conditions', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'get_terms', + 'fieldtype': u'Button', + 'label': u'Get Terms and Conditions', + 'oldfieldtype': u'Button', + 'options': u'get_tc_details', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'terms_html', + 'fieldtype': u'HTML', + 'label': u'Terms and Conditions HTML', + 'oldfieldtype': u'HTML', + 'options': u'You can add Terms and Notes that will be printed in the Transaction', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'terms', + 'fieldtype': u'Text Editor', + 'label': u'Terms and Conditions1', + 'oldfieldname': u'terms', + 'oldfieldtype': u'Text Editor', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'contact_section', + 'fieldtype': u'Section Break', + 'label': u'Contact Info', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'supplier_address', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Supplier Address', + 'options': u'Address', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'contact_person', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Contact Person', + 'options': u'Contact', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'more_info', + 'fieldtype': u'Section Break', + 'label': u'More Info', + 'oldfieldtype': u'Section Break', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'status', + 'fieldtype': u'Select', + 'in_filter': 1, + 'label': u'Status', + 'no_copy': 1, + 'oldfieldname': u'status', + 'oldfieldtype': u'Select', + 'options': u'\nDraft\nSubmitted\nStopped\nCancelled', + 'permlevel': 1, + 'print_hide': 1, + 'reqd': 1, + 'search_index': 1 + }, + + # DocField + { + 'default': u'No', + 'doctype': u'DocField', + 'fieldname': u'is_subcontracted', + 'fieldtype': u'Select', + 'label': u'Is Subcontracted', + 'options': u'\nYes\nNo', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'amended_from', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u'Amended From', + 'no_copy': 1, + 'oldfieldname': u'amended_from', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 1, + 'report_hide': 0 + }, + + # DocField + { + 'description': u'The date at which current entry is corrected in the system.', + 'doctype': u'DocField', + 'fieldname': u'amendment_date', + 'fieldtype': u'Date', + 'hidden': 1, + 'label': u'Amendment Date', + 'no_copy': 1, + 'oldfieldname': u'amendment_date', + 'oldfieldtype': u'Date', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Select the relevant company name if you have multiple companies', + 'doctype': u'DocField', + 'fieldname': u'company', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Company', + 'no_copy': 0, + 'oldfieldname': u'company', + 'oldfieldtype': u'Link', + 'options': u'Company', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1, + 'search_index': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'fiscal_year', + 'fieldtype': u'Select', + 'in_filter': 1, + 'label': u'Fiscal Year', + 'no_copy': 0, + 'oldfieldname': u'fiscal_year', + 'oldfieldtype': u'Select', + 'options': u'link:Fiscal Year', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1, + 'search_index': 1 + }, + + # DocField + { + 'allow_on_submit': 1, + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'select_print_heading', + 'fieldtype': u'Link', + 'label': u'Select Print Heading', + 'no_copy': 1, + 'oldfieldname': u'select_print_heading', + 'oldfieldtype': u'Link', + 'options': u'Print Heading', + 'permlevel': 0, + 'print_hide': 1, + 'report_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'column_break5', + 'fieldtype': u'Column Break', + 'oldfieldtype': u'Column Break', + 'permlevel': 0, + 'print_hide': 1, + 'width': u'50%' + }, + + # DocField + { + 'colour': u'White:FFF', + 'depends_on': u'eval:!doc.__islocal', + 'doctype': u'DocField', + 'fieldname': u'cancel_reason', + 'fieldtype': u'Data', + 'hidden': 0, + 'label': u'Cancel Reason', + 'no_copy': 1, + 'oldfieldname': u'cancel_reason', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'file_list', + 'fieldtype': u'Text', + 'hidden': 1, + 'label': u'File List', + 'no_copy': 1, + 'permlevel': 0, + 'print_hide': 1 + } +] \ No newline at end of file diff --git a/erpnext/buying/doctype/supplier_quotation_item/__init__.py b/erpnext/buying/doctype/supplier_quotation_item/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt new file mode 100644 index 0000000000..1ee10ae496 --- /dev/null +++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt @@ -0,0 +1,402 @@ +# DocType, Supplier Quotation Item +[ + + # These values are common in all dictionaries + { + 'creation': '2012-08-01 20:07:22', + 'docstatus': 0, + 'modified': '2012-08-02 16:00:52', + 'modified_by': u'Administrator', + 'owner': u'Administrator' + }, + + # These values are common for all DocType + { + 'autoname': u'SQI-.#####', + 'default_print_format': u'Standard', + 'doctype': 'DocType', + 'istable': 1, + 'module': u'Buying', + 'name': '__common__', + 'version': 1 + }, + + # These values are common for all DocField + { + 'doctype': u'DocField', + 'name': '__common__', + 'parent': u'Supplier Quotation Item', + 'parentfield': u'fields', + 'parenttype': u'DocType' + }, + + # DocType, Supplier Quotation Item + { + 'doctype': 'DocType', + 'name': u'Supplier Quotation Item' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'item_code', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Item Code', + 'oldfieldname': u'item_code', + 'oldfieldtype': u'Link', + 'options': u'Item', + 'permlevel': 0, + 'print_hide': 0, + 'reqd': 1, + 'search_index': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'If Supplier Part Number exists for given Item, it gets stored here', + 'doctype': u'DocField', + 'fieldname': u'supplier_part_no', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u'Supplier Part Number', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'item_name', + 'fieldtype': u'Data', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Item Name', + 'oldfieldname': u'item_name', + 'oldfieldtype': u'Data', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1, + 'search_index': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'description', + 'fieldtype': u'Small Text', + 'label': u'Description', + 'oldfieldname': u'description', + 'oldfieldtype': u'Small Text', + 'permlevel': 0, + 'reqd': 1, + 'width': u'300px' + }, + + # DocField + { + 'default': u'0.00', + 'doctype': u'DocField', + 'fieldname': u'qty', + 'fieldtype': u'Currency', + 'label': u'Quantity', + 'oldfieldname': u'qty', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'reqd': 1, + 'trigger': u'Client', + 'width': u'60px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'import_ref_rate', + 'fieldtype': u'Currency', + 'label': u'Ref Rate ', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'discount_rate', + 'fieldtype': u'Currency', + 'label': u'Discount %', + 'permlevel': 0, + 'print_hide': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'import_rate', + 'fieldtype': u'Currency', + 'hidden': 0, + 'label': u'Rate ', + 'oldfieldname': u'import_rate', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'print_hide': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'import_amount', + 'fieldtype': u'Currency', + 'label': u'Amount', + 'oldfieldname': u'import_amount', + 'oldfieldtype': u'Currency', + 'permlevel': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'purchase_ref_rate', + 'fieldtype': u'Currency', + 'label': u'Ref Rate *', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'default': u'0.00', + 'doctype': u'DocField', + 'fieldname': u'purchase_rate', + 'fieldtype': u'Currency', + 'label': u'Rate (Default Curr.) *', + 'oldfieldname': u'purchase_rate', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1, + 'trigger': u'Client', + 'width': u'100px' + }, + + # DocField + { + 'default': u'0.00', + 'doctype': u'DocField', + 'fieldname': u'amount', + 'fieldtype': u'Currency', + 'label': u'Amount (Default Curr.)', + 'oldfieldname': u'amount', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 1, + 'reqd': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'warehouse', + 'fieldtype': u'Link', + 'hidden': 0, + 'label': u'Warehouse', + 'oldfieldname': u'warehouse', + 'oldfieldtype': u'Link', + 'options': u'Warehouse', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'project_name', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Project Name', + 'options': u'Project', + 'permlevel': 0, + 'print_hide': 1, + 'report_hide': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'uom', + 'fieldtype': u'Link', + 'label': u'UOM', + 'oldfieldname': u'uom', + 'oldfieldtype': u'Link', + 'options': u'UOM', + 'permlevel': 0, + 'print_hide': 0, + 'reqd': 1, + 'trigger': u'Client', + 'width': u'100px' + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'conversion_factor', + 'fieldtype': u'Currency', + 'hidden': 0, + 'label': u'UOM Conversion Factor', + 'oldfieldname': u'conversion_factor', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1, + 'trigger': u'Client', + 'width': u'100px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'stock_uom', + 'fieldtype': u'Data', + 'hidden': 0, + 'label': u'Stock UOM', + 'oldfieldname': u'stock_uom', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 1, + 'reqd': 1, + 'width': u'100px' + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'prevdoc_doctype', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u'Prevdoc DocType', + 'no_copy': 0, + 'oldfieldname': u'prevdoc_doctype', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'prevdoc_docname', + 'fieldtype': u'Link', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Purchase Request No', + 'no_copy': 0, + 'oldfieldname': u'prevdoc_docname', + 'oldfieldtype': u'Link', + 'options': u'Purchase Request', + 'permlevel': 1, + 'print_hide': 1, + 'search_index': 1, + 'width': u'120px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'prevdoc_date', + 'fieldtype': u'Date', + 'hidden': 1, + 'in_filter': 1, + 'label': u'Purchase Request Date', + 'oldfieldname': u'prevdoc_date', + 'oldfieldtype': u'Date', + 'permlevel': 1, + 'print_hide': 1, + 'search_index': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'prevdoc_detail_docname', + 'fieldtype': u'Data', + 'hidden': 1, + 'in_filter': 1, + 'label': u'Purchase Request Detail No', + 'no_copy': 0, + 'oldfieldname': u'prevdoc_detail_docname', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 1, + 'search_index': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'brand', + 'fieldtype': u'Link', + 'hidden': 1, + 'label': u'Brand', + 'oldfieldname': u'brand', + 'oldfieldtype': u'Link', + 'options': u'Brand', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'item_group', + 'fieldtype': u'Link', + 'hidden': 1, + 'in_filter': 1, + 'label': u'Item Group', + 'oldfieldname': u'item_group', + 'oldfieldtype': u'Link', + 'options': u'Item Group', + 'permlevel': 1, + 'print_hide': 1, + 'search_index': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges', + 'doctype': u'DocField', + 'fieldname': u'item_tax_rate', + 'fieldtype': u'Small Text', + 'hidden': 1, + 'label': u'Item Tax Rate', + 'oldfieldname': u'item_tax_rate', + 'oldfieldtype': u'Small Text', + 'permlevel': 1, + 'print_hide': 1, + 'report_hide': 1 + }, + + # DocField + { + 'allow_on_submit': 1, + 'doctype': u'DocField', + 'fieldname': u'page_break', + 'fieldtype': u'Check', + 'hidden': 0, + 'label': u'Page Break', + 'no_copy': 1, + 'oldfieldname': u'page_break', + 'oldfieldtype': u'Check', + 'permlevel': 0, + 'print_hide': 1 + } +] \ No newline at end of file diff --git a/erpnext/buying/page/buying_home/buying_home.html b/erpnext/buying/page/buying_home/buying_home.html index 8e28e1b1e1..cd9312c7f1 100644 --- a/erpnext/buying/page/buying_home/buying_home.html +++ b/erpnext/buying/page/buying_home/buying_home.html @@ -5,6 +5,9 @@

Purchase Request

Request for purchase


+

Supplier Quotation

+

Track Quotations received from Suppliers

+

Purchase Order

Purchase Orders given to Suppliers

diff --git a/erpnext/patches/july_2012/project_patch_repeat.py b/erpnext/patches/july_2012/project_patch_repeat.py new file mode 100644 index 0000000000..4bb549c3f1 --- /dev/null +++ b/erpnext/patches/july_2012/project_patch_repeat.py @@ -0,0 +1,18 @@ +def execute(): + import webnotes + webnotes.conn.sql("""update `tabPurchase Order Item` t1, `tabPurchase Order` t2 + set t1.project_name = t2.project_name where t1.parent = t2.name + and ifnull(t1.project_name, '') = ''""") + webnotes.conn.sql("""update `tabPurchase Invoice Item` t1, `tabPurchase Invoice` t2 + set t1.project_name = t2.project_name where t1.parent = t2.name + and ifnull(t1.project_name, '') = ''""") + webnotes.conn.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 + set t1.project_name = t2.project_name where t1.parent = t2.name + and ifnull(t1.project_name, '') = ''""") + + webnotes.conn.commit() + from webnotes.model.sync import sync + sync("buying", "purchase_order") + sync("buying", "purchase_request") + sync("accounts", "purchase_invoice") + webnotes.conn.begin() \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index b84c956b36..e74206ab94 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -505,4 +505,8 @@ patch_list = [ 'patch_module': 'patches.july_2012', 'patch_file': 'bin_permission', }, + { + 'patch_module': 'patches.july_2012', + 'patch_file': 'project_patch_repeat', + }, ] \ No newline at end of file diff --git a/public/js/all-app.js b/public/js/all-app.js index 6e2fa3e36f..f7fc897a7f 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -2129,13 +2129,12 @@ _f.frm_dialog.cur_frm.fields_dict[n].refresh();}else{var g=_f.cur_grid_cell;if(g cur_frm.fields_dict[n].refresh();}} set_field_options=function(n,txt){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.options=txt;refresh_field(n);} set_field_permlevel=function(n,level){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.permlevel=level;refresh_field(n);} -hide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df){df.hidden=hidden;refresh_field(n);} -else{console.log("hide_field cannot find field "+n);}} -if(cur_frm){if(n.substr)_hide_field(n,1);else{for(var i in n)_hide_field(n[i],1)}}} -unhide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df){df.hidden=hidden;refresh_field(n);} -else{console.log("unhide_field cannot find field "+n);}} -if(cur_frm){if(n.substr)_hide_field(n,0);else{for(var i in n)_hide_field(n[i],0)}}} +toggle_field=function(n,hidden){var df_obj=get_field_obj(n);var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df){if(df_obj.df.fieldtype==="Section Break"){$(df_obj.row.wrapper).toggle(hidden?false:true);}else if(df_obj.df.fieldtype==="Column Break"){$(df_obj.cell.wrapper).toggle(hidden?false:true);}else{df.hidden=hidden;refresh_field(n);}} +else{console.log((hidden?"hide_field":"unhide_field")+" cannot find field "+n);}} +hide_field=function(n){if(cur_frm){if(n.substr)toggle_field(n,1);else{for(var i in n)toggle_field(n[i],1)}}} +unhide_field=function(n){if(cur_frm){if(n.substr)toggle_field(n,0);else{for(var i in n)toggle_field(n[i],0)}}} get_field_obj=function(fn){return cur_frm.fields_dict[fn];} +set_missing_values=function(doc,dict){var fields_to_set={};$.each(dict,function(i,v){if(!doc[i]){fields_to_set[i]=v;}});if(fields_to_set){set_multiple(doc.doctype,doc.name,fields_to_set);}} /* * lib/js/legacy/widgets/form/form_comments.js */