refactor unicode changes and merge with master with refactored email
This commit is contained in:
commit
49dc5da0dc
7
.gitignore
vendored
7
.gitignore
vendored
@ -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
|
@ -197,6 +197,7 @@ class DocType(TransactionBase):
|
||||
if ret['warehouse']:
|
||||
actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], ret['warehouse']))
|
||||
ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
|
||||
msgprint(ret)
|
||||
return ret
|
||||
|
||||
def get_barcode_details(self, barcode):
|
||||
|
@ -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'
|
||||
}
|
||||
]
|
@ -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) {
|
||||
|
@ -616,7 +616,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)
|
||||
|
@ -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
|
||||
|
@ -84,7 +84,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')
|
||||
@ -102,26 +101,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)
|
||||
@ -234,16 +220,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
|
||||
# -------------------------------------------------------------------------------------------------------
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-06-11 12:09:56',
|
||||
'creation': '2012-07-02 14:44:19',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-07-16 16:25:43',
|
||||
'modified': '2012-08-02 13:43:50',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -854,23 +854,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',
|
||||
|
113
erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
Normal file
113
erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 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;
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
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)
|
924
erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt
Normal file
924
erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt
Normal file
@ -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
|
||||
}
|
||||
]
|
@ -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
|
||||
}
|
||||
]
|
@ -5,6 +5,9 @@
|
||||
<h4><a href="#!List/Purchase Request">Purchase Request</a></h4>
|
||||
<p class="help">Request for purchase</p>
|
||||
<br>
|
||||
<h4><a href="#!List/Supplier Quotation">Supplier Quotation</a></h4>
|
||||
<p class="help">Track Quotations received from Suppliers</p>
|
||||
<br>
|
||||
<h4><a href="#!List/Purchase Order">Purchase Order</a></h4>
|
||||
<p class="help">Purchase Orders given to Suppliers</p>
|
||||
</div>
|
||||
|
@ -119,22 +119,6 @@ class DocType:
|
||||
out[dt][s[0]] = cint(cnt)
|
||||
return out
|
||||
|
||||
def send_feedback(self, args):
|
||||
args = json.loads(args)
|
||||
|
||||
fb_sender = sql("select concat_ws(' ',first_name, last_name), email from tabProfile where name=%s", session['user'])
|
||||
fb_subject = 'Feedback : ' + args['subject']
|
||||
|
||||
|
||||
fb_msg = '''
|
||||
<div style="font-size:14px; padding:8px; border:1px solid #DDF">
|
||||
<div style="margin-bottom:16px">%s wrote,</div>
|
||||
<div>%s</div>
|
||||
</div>
|
||||
''' % (fb_sender[0][0], args['feedback'])
|
||||
|
||||
sendmail('info@webnotestech.com', fb_sender[0][1], msg = fb_msg, subject=args['subject'],parts=[], cc=[], attach=[])
|
||||
|
||||
def get_dt_help(self,dt):
|
||||
return sql("select description from tabDocType where name=%s",dt)[0][0] or ''
|
||||
|
||||
|
@ -9,5 +9,6 @@ def execute():
|
||||
webnotes.conn.begin()
|
||||
|
||||
for user, password in webnotes.conn.sql("""select name, password from tabProfile"""):
|
||||
webnotes.conn.sql("""insert into __Auth (user, `password`) values (%s, %s)""",
|
||||
(user, password))
|
||||
if password:
|
||||
webnotes.conn.sql("""insert into __Auth (user, `password`) values (%s, %s)""",
|
||||
(user, password))
|
||||
|
@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
import webnotes
|
||||
webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Bin'")
|
@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
"""allocate read write permission to guest for doctype 'Blog'"""
|
||||
import webnotes
|
||||
|
19
erpnext/patches/july_2012/project_patch_repeat.py
Normal file
19
erpnext/patches/july_2012/project_patch_repeat.py
Normal file
@ -0,0 +1,19 @@
|
||||
from __future__ import unicode_literals
|
||||
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()
|
@ -1,31 +1,30 @@
|
||||
from __future__ import unicode_literals
|
||||
def repost_reserved_qty():
|
||||
import webnotes
|
||||
from webnotes.utils import flt
|
||||
bins = webnotes.conn.sql("select item_code, warehouse, name, reserved_qty from `tabBin`")
|
||||
for d in bins:
|
||||
reserved_qty = webnotes.conn.sql("""
|
||||
select sum((dnpi.qty/so_item.qty)*(so_item.qty - ifnull(so_item.delivered_qty, 0))), so.transaction_date
|
||||
select sum((dnpi.qty/so_item.qty)*(so_item.qty - ifnull(so_item.delivered_qty, 0)))
|
||||
|
||||
from `tabDelivery Note Packing Item` dnpi, `tabSales Order Item` so_item, `tabSales Order` so
|
||||
|
||||
where dnpi.parent = so.name
|
||||
where dnpi.item_code = %s
|
||||
and dnpi.warehouse = %s
|
||||
and dnpi.parent = so.name
|
||||
and so_item.parent = so.name
|
||||
and dnpi.parenttype = 'Sales Order'
|
||||
and dnpi.parent_detail_docname = so_item.name
|
||||
and dnpi.parent_item = so_item.item_code
|
||||
and so.docstatus = 1
|
||||
and so.status != 'Stopped'
|
||||
and dnpi.item_code = %s
|
||||
and dnpi.warehouse = %s
|
||||
""", (d[0], d[1]))
|
||||
if flt(d[3]) != flt(reserved_qty[0][0]):
|
||||
print d, reserved_qty
|
||||
#webnotes.conn.sql("""
|
||||
# update `tabBin` set reserved_qty = %s where name = %s
|
||||
#""", (reserved_qty and reserved_qty[0][0] or 0, d[2]))
|
||||
print d[3], reserved_qty[0][0]
|
||||
webnotes.conn.sql("""
|
||||
update `tabBin` set reserved_qty = %s where name = %s
|
||||
""", (reserved_qty and reserved_qty[0][0] or 0, d[2]))
|
||||
|
||||
repost_reserved_qty()
|
||||
|
||||
def cleanup_wrong_sle():
|
||||
sle = webnotes.conn.sql("""
|
||||
select item_code, warehouse, voucher_no, name
|
||||
@ -45,10 +44,10 @@ def cleanup_wrong_sle():
|
||||
""")
|
||||
if sle:
|
||||
print sle
|
||||
# for d in sle:
|
||||
# webnotes.conn.sql("update `tabStock Ledger Entry` set is_cancelled = 'Yes' where name = %s", d[3])
|
||||
# create_comment(d[3])
|
||||
# repost_bin(d[0], d[1])
|
||||
for d in sle:
|
||||
webnotes.conn.sql("update `tabStock Ledger Entry` set is_cancelled = 'Yes' where name = %s", d[3])
|
||||
create_comment(d[3])
|
||||
repost_bin(d[0], d[1])
|
||||
|
||||
def create_comment(dn):
|
||||
from webnotes.model.doc import Document
|
||||
|
@ -529,4 +529,8 @@ patch_list = [
|
||||
'patch_module': 'patches.july_2012',
|
||||
'patch_file': 'bin_permission',
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.july_2012',
|
||||
'patch_file': 'project_patch_repeat',
|
||||
},
|
||||
]
|
@ -156,7 +156,6 @@ def sent_reminder_task():
|
||||
<p>If you have already completed this task, please update the system</p>
|
||||
<p>Good Luck!</p>
|
||||
<p>(This notification is autogenerated)</p>""" % i
|
||||
sendmail(i['allocated_to'], sender='automail@webnotestech.com', msg=msg2,send_now=1, \
|
||||
subject='A task has been assigned')
|
||||
sendmail(i['allocated_to'], msg=msg2, subject='A task has been assigned')
|
||||
sql("update `tabTask` set sent_reminder='1' where name='%(name)s' and allocated_to= '%(allocated_to)s'" % i)
|
||||
|
||||
|
@ -116,10 +116,7 @@ class DocType:
|
||||
<p><b>Expected End Date:</b> %(exp_end_date)s</p>
|
||||
<p><b>Details:</b> %(description)s</p>
|
||||
<p>(This notification is autogenerated)</p>""" % i
|
||||
sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', msg=msg2,send_now=1,\
|
||||
subject= task_label + self.doc.subject)
|
||||
|
||||
|
||||
sendmail(self.doc.allocated_to, msg=msg2,subject= task_label + self.doc.subject)
|
||||
|
||||
#validate before closing task
|
||||
def validate_for_closed(self):
|
||||
|
@ -110,16 +110,6 @@ cur_frm.cscript['Create Customer'] = function(){
|
||||
);
|
||||
}
|
||||
|
||||
// send email
|
||||
// ===============================================================
|
||||
cur_frm.cscript.send_email = function(doc,cdt,cdn){
|
||||
if(doc.__islocal != 1){
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'send_mail','',function(r,rt){});
|
||||
}else{
|
||||
msgprint("Please save lead first before sending email")
|
||||
}
|
||||
}
|
||||
|
||||
// Create New Opportunity
|
||||
// ===============================================================
|
||||
cur_frm.cscript['Create Opportunity'] = function(){
|
||||
|
@ -83,15 +83,9 @@ class DocType:
|
||||
|
||||
|
||||
def on_update(self):
|
||||
# Add to calendar
|
||||
# ========================================================================
|
||||
if self.doc.contact_by:
|
||||
self.add_calendar_event()
|
||||
|
||||
if session['user'] == 'Guest':
|
||||
if self.doc.email_id:
|
||||
self.send_email_notification()
|
||||
|
||||
if not self.doc.naming_series:
|
||||
if session['user'] == 'Guest':
|
||||
import webnotes.model.doctype
|
||||
@ -103,37 +97,6 @@ class DocType:
|
||||
else:
|
||||
msgprint("Please specify naming series")
|
||||
raise Exception
|
||||
|
||||
def send_email_notification(self):
|
||||
if not validate_email_add(self.doc.email_id.strip(' ')):
|
||||
msgprint('error:%s is not a valid email id' % self.doc.email_id.strip(' '))
|
||||
raise Exception
|
||||
else:
|
||||
subject = 'Thank you for interest in erpnext'
|
||||
|
||||
sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
|
||||
msgprint("Mail Sent")
|
||||
|
||||
def get_notification_msg(self):
|
||||
t = """
|
||||
<html>
|
||||
<body>
|
||||
Dear %s,<br><br>
|
||||
|
||||
Thank you for contacting us.<br><br>
|
||||
|
||||
You have left following message for us,<br>
|
||||
%s
|
||||
<br><br>
|
||||
|
||||
You will receive reply on this shortly.<br><br>
|
||||
|
||||
Cheers!
|
||||
</body>
|
||||
</html>
|
||||
""" % (self.doc.lead_name, self.doc.remark)
|
||||
|
||||
return t
|
||||
|
||||
# Add to Calendar
|
||||
# ===========================================================================
|
||||
@ -158,25 +121,6 @@ class DocType:
|
||||
ev.ref_name = self.doc.name
|
||||
ev.save(1)
|
||||
|
||||
|
||||
#-----------------Email--------------------------------------------
|
||||
def send_emails(self, email=[], subject='', message=''):
|
||||
if email:
|
||||
sendmail(email, sender = webnotes.user.name, subject = subject , parts = [['text/html', message]])
|
||||
msgprint("Mail Sent")
|
||||
self.add_in_follow_up(message,'Email')
|
||||
|
||||
#-------------------------Checking Sent Mails Details----------------------------------------------
|
||||
def send_mail(self):
|
||||
if not self.doc.subject or not self.doc.message:
|
||||
msgprint("Please enter subject & message in their respective fields.")
|
||||
elif not self.doc.email_id:
|
||||
msgprint("Recipient not specified. Please add email id of lead in 'Email id' field provided in 'Contact Info' section.")
|
||||
raise Exception
|
||||
else :
|
||||
self.send_emails([self.doc.email_id.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
|
||||
|
||||
#---------------------- Add details in follow up table----------------
|
||||
def add_in_follow_up(self,message,type):
|
||||
import datetime
|
||||
child = addchild( self.doc, 'follow_up', 'Communication Log', 1, self.doclist)
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-05-15 12:14:52',
|
||||
'creation': '2012-06-05 20:03:20',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-05-30 12:43:03',
|
||||
'modified': '2012-08-03 10:49:22',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -505,23 +505,6 @@
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Probability of lead converting to customer',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'rating',
|
||||
'fieldtype': u'Select',
|
||||
'in_filter': 1,
|
||||
'label': u'Rating',
|
||||
'oldfieldname': u'rating',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nHot\nWarm\nCold',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': u'__user',
|
||||
@ -694,5 +677,23 @@
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'unsubscribed',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Unsubscribed',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'blog_subscriber',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Blog Subscriber',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
@ -4,8 +4,7 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({
|
||||
this.fields = this.fields.concat([
|
||||
'tabLead.lead_name',
|
||||
'tabLead.status',
|
||||
'tabLead.source',
|
||||
'tabLead.rating'
|
||||
'tabLead.source'
|
||||
]);
|
||||
this.stats = this.stats.concat(['status', 'source', 'rating', 'company']);
|
||||
},
|
||||
|
@ -198,118 +198,7 @@ class DocType(TransactionBase):
|
||||
set(self.doc, 'status', 'Opportunity Lost')
|
||||
set(self.doc, 'order_lost_reason', arg)
|
||||
return 'true'
|
||||
|
||||
|
||||
# On Send Email
|
||||
# ====================================================================================================================
|
||||
#def send_emails(self,email,sender,subject,message):
|
||||
# if email:
|
||||
# sendmail(email,sender,subject=subject or 'Opportunity',parts=[['text/plain',message or self.get_enq_summary()]])
|
||||
|
||||
# Prepare HTML Table and Enter Opportunity Items in it, which will be added in enq summary
|
||||
# ====================================================================================================================
|
||||
def quote_table(self):
|
||||
if getlist(self.doclist,'enq_details'):
|
||||
header_lbl = ['Item Code','Item Name','Description','Reqd Qty','UOM']
|
||||
item_tbl = '''<table style="width:90%%; border:1px solid #AAA; border-collapse:collapse"><tr>'''
|
||||
for i in header_lbl:
|
||||
item_header = '''<td style="width=20%%; border:1px solid #AAA; border-collapse:collapse;"><b>%s</b></td>''' % i
|
||||
item_tbl += item_header
|
||||
item_tbl += '''</tr>'''
|
||||
|
||||
for d in getlist(self.doclist,'enq_details'):
|
||||
item_det = '''
|
||||
<tr><td style="width:20%%; border:1px solid #AAA; border-collpase:collapse">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
|
||||
<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td></tr>
|
||||
''' % (d.item_code,d.item_name,d.description,d.reqd_qty,d.uom)
|
||||
item_tbl += item_det
|
||||
item_tbl += '''</table>'''
|
||||
return item_tbl
|
||||
|
||||
# Prepare HTML Page containing summary of Opportunity, which will be sent as message in E-mail
|
||||
# ====================================================================================================================
|
||||
def get_enq_summary(self):
|
||||
|
||||
t = """
|
||||
<html><head></head>
|
||||
<body>
|
||||
<div style="border:1px solid #AAA; padding:20px; width:100%%">
|
||||
<div style="text-align:center;font-size:14px"><b>Request For Quotation</b><br></div>
|
||||
<div style="text-align:center;font-size:12px"> %(from_company)s</div>
|
||||
<div style="text-align:center; font-size:10px"> %(company_address)s</div>
|
||||
<div style="border-bottom:1px solid #AAA; padding:10px"></div>
|
||||
|
||||
<div style="padding-top:10px"><b>Quotation Items</b></div>
|
||||
<div><table style="width:100%%">
|
||||
<tr><td style="width:40%%">Opportunity No:</td> <td style="width:60%%"> %(name)s</td></tr>
|
||||
<tr><td style="width:40%%">Opening Date:</td> <td style="width:60%%"> %(transaction_date)s</td></tr>
|
||||
<tr><td style="width:40%%">Expected By Date:</td> <td style="width:60%%"> %(expected_date)s</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="padding-top:10px"><b>Terms and Conditions</b></div>
|
||||
<div> %(terms_and_conditions)s</div>
|
||||
|
||||
<div style="padding-top:10px"><b>Contact Details</b></div>
|
||||
<div><table style="width:100%%">
|
||||
<tr><td style="width=40%%">Contact Person:</td><td style="width:60%%"> %(contact_person)s</td></tr>
|
||||
<tr><td style="width=40%%">Contact No:</td><td style="width:60%%"> %(contact_no)s</td></tr>
|
||||
<tr><td style="width=40%%">Email:</td><td style="width:60%%"> %(email)s</td></tr>
|
||||
</table></div>
|
||||
""" % (self.doc.fields)
|
||||
|
||||
t += """<br><div><b>Quotation Items</b><br></div><div style="width:100%%">%s</div>
|
||||
<br>
|
||||
To login into the system, use link : <div><a href='http://67.205.111.118/v160/login.html' target='_blank'>http://67.205.111.118/v160/login.html</a></div><br><br>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
""" % (self.quote_table())
|
||||
return t
|
||||
|
||||
#-----------------Email--------------------------------------------
|
||||
# ====================================================================================================================
|
||||
def send_emails(self, email=[], subject='', message=''):
|
||||
if email:
|
||||
sender_email= sql("Select email from `tabProfile` where name='%s'"%session['user'])
|
||||
if sender_email and sender_email[0][0]:
|
||||
attach_list=[]
|
||||
for at in getlist(self.doclist,'enquiry_attachment_detail'):
|
||||
if at.select_file:
|
||||
attach_list.append(at.select_file)
|
||||
cc_list=[]
|
||||
if self.doc.cc_to:
|
||||
for cl in (self.doc.cc_to.split(',')):
|
||||
if not validate_email_add(cl.strip(' ')):
|
||||
msgprint('error:%s is not a valid email id' % cl.strip(' '))
|
||||
raise Exception
|
||||
cc_list.append(cl.strip(' '))
|
||||
sendmail(cc_list, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], attach=attach_list)
|
||||
sendmail(email, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], cc=cc_list, attach=attach_list)
|
||||
#sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
|
||||
msgprint("Mail has been sent")
|
||||
self.add_in_follow_up(message,'Email')
|
||||
else:
|
||||
msgprint("Please enter your mail id in Profile")
|
||||
raise Exception
|
||||
|
||||
#-------------------------Checking Sent Mails Details----------------------------------------------
|
||||
# ====================================================================================================================
|
||||
def sent_mail(self):
|
||||
if not self.doc.subject or not self.doc.message:
|
||||
msgprint("Please enter subject & message in their respective fields.")
|
||||
elif not self.doc.email_id1:
|
||||
msgprint("Recipient not specified. Please add email id in 'Send To'.")
|
||||
raise Exception
|
||||
else :
|
||||
if not validate_email_add(self.doc.email_id1.strip(' ')):
|
||||
msgprint('error:%s is not a valid email id' % self.doc.email_id1)
|
||||
else:
|
||||
self.send_emails([self.doc.email_id1.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
|
||||
|
||||
|
||||
#---------------------- Add details in follow up table----------------
|
||||
# ====================================================================================================================
|
||||
def add_in_follow_up(self,message,type):
|
||||
|
@ -416,7 +416,6 @@ class DocType:
|
||||
|
||||
from webnotes.utils.email_lib import sendmail
|
||||
try:
|
||||
#webnotes.msgprint('in send')
|
||||
sendmail(
|
||||
recipients=recipient_list,
|
||||
sender='notifications+email_digest@erpnext.com',
|
||||
|
@ -25,44 +25,25 @@ class DocType:
|
||||
self.doc,self.doclist = doc,doclist
|
||||
|
||||
def validate(self):
|
||||
"""
|
||||
Checks connectivity to email servers before saving
|
||||
"""
|
||||
"""Checks connectivity to email servers before saving"""
|
||||
self.validate_outgoing()
|
||||
self.validate_incoming()
|
||||
|
||||
|
||||
def validate_outgoing(self):
|
||||
"""
|
||||
Checks incoming email settings
|
||||
"""
|
||||
"""Checks incoming email settings"""
|
||||
self.doc.encode()
|
||||
if self.doc.outgoing_mail_server:
|
||||
from webnotes.utils import cint, get_encoded_string
|
||||
import _socket
|
||||
from webnotes.utils.email_lib.send import EMail
|
||||
import smtplib
|
||||
out_email = EMail()
|
||||
out_email.server = get_encoded_string(self.doc.outgoing_mail_server)
|
||||
out_email.port = cint(self.doc.mail_port)
|
||||
out_email.use_ssl = self.doc.use_ssl
|
||||
try:
|
||||
err_msg = "Login Id or Mail Password missing. Please enter and try again."
|
||||
if not (self.doc.mail_login and self.doc.mail_password):
|
||||
raise AttributeError, err_msg
|
||||
out_email.login = get_encoded_string(self.doc.mail_login)
|
||||
out_email.password = get_encoded_string(self.doc.mail_password)
|
||||
except AttributeError, e:
|
||||
webnotes.msgprint(err_msg)
|
||||
raise e
|
||||
|
||||
# exceptions are handled in smtp_connect
|
||||
sess = out_email.smtp_connect()
|
||||
|
||||
try:
|
||||
sess.quit()
|
||||
except:
|
||||
pass
|
||||
|
||||
from webnotes.utils import cint
|
||||
from webnotes.utils.email_lib.smtp import SMTPServer
|
||||
smtpserver = SMTPServer(login = self.doc.mail_login,
|
||||
password = self.doc.mail_password,
|
||||
server = self.doc.outgoing_mail_server,
|
||||
port = cint(self.doc.mail_port),
|
||||
use_ssl = self.doc.use_ssl
|
||||
)
|
||||
|
||||
# exceptions are handled in session connect
|
||||
sess = smtpserver.sess
|
||||
|
||||
def validate_incoming(self):
|
||||
"""
|
||||
@ -72,17 +53,17 @@ class DocType:
|
||||
from webnotes.utils.email_lib.receive import POP3Mailbox
|
||||
from webnotes.model.doc import Document
|
||||
import _socket, poplib
|
||||
from webnotes.utils import get_encoded_string
|
||||
|
||||
inc_email = Document('Incoming Email Settings')
|
||||
inc_email.host = get_encoded_string(self.doc.support_host)
|
||||
inc_email.encode()
|
||||
inc_email.host = self.doc.support_host
|
||||
inc_email.use_ssl = self.doc.support_use_ssl
|
||||
try:
|
||||
err_msg = 'User Name or Support Password missing. Please enter and try again.'
|
||||
if not (self.doc.support_username and self.doc.support_password):
|
||||
raise AttributeError, err_msg
|
||||
inc_email.username = get_encoded_string(self.doc.support_username)
|
||||
inc_email.password = get_encoded_string(self.doc.support_password)
|
||||
inc_email.username = self.doc.support_username
|
||||
inc_email.password = self.doc.support_password
|
||||
except AttributeError, e:
|
||||
webnotes.msgprint(err_msg)
|
||||
raise e
|
||||
|
@ -14,14 +14,23 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# default settings that can be made for a profile.
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
product_name = "ERPNext"
|
||||
profile_defaults = {
|
||||
"Company": "company",
|
||||
"Territory": "territory"
|
||||
}
|
||||
|
||||
|
||||
# add startup propertes
|
||||
mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
|
||||
<a style="color: #888" href="https://erpnext.com">ERPNext</a></div>"""
|
||||
|
||||
def get_monthly_bulk_mail_limit():
|
||||
import webnotes
|
||||
# if global settings, then 500 or unlimited
|
||||
if webnotes.conn.get_value('Email Settings', None, 'outgoing_mail_server'):
|
||||
return 999999
|
||||
else:
|
||||
return 500
|
||||
|
@ -25,27 +25,26 @@ def execute_all():
|
||||
* get support email
|
||||
* recurring invoice
|
||||
"""
|
||||
try:
|
||||
from support.doctype.support_ticket import get_support_mails
|
||||
get_support_mails()
|
||||
except Exception, e:
|
||||
scheduler.log('get_support_mails')
|
||||
|
||||
try:
|
||||
from accounts.doctype.gl_control.gl_control import manage_recurring_invoices
|
||||
manage_recurring_invoices()
|
||||
except Exception, e:
|
||||
scheduler.log('manage_recurring_invoices')
|
||||
# pull emails
|
||||
from support.doctype.support_ticket import get_support_mails
|
||||
run_fn(get_support_mails)
|
||||
|
||||
# run recurring invoices
|
||||
from accounts.doctype.gl_control.gl_control import manage_recurring_invoices
|
||||
run_fn(manage_recurring_invoices)
|
||||
|
||||
# bulk email
|
||||
from webnotes.utils.email_lib.bulk import flush
|
||||
run_fn(flush)
|
||||
|
||||
def execute_daily():
|
||||
"""email digest"""
|
||||
try:
|
||||
from setup.doctype.email_digest.email_digest import send
|
||||
send()
|
||||
except Exception, e:
|
||||
scheduler.log('email_digest.send')
|
||||
# email digest
|
||||
from setup.doctype.email_digest.email_digest import send
|
||||
run_fn(send)
|
||||
|
||||
# send bulk emails
|
||||
from webnotes.utils.email_lib.bulk import clear_outbox
|
||||
run_fn(clear_outbox)
|
||||
|
||||
def execute_weekly():
|
||||
pass
|
||||
@ -55,3 +54,9 @@ def execute_monthly():
|
||||
|
||||
def execute_hourly():
|
||||
pass
|
||||
|
||||
def run_fn(fn):
|
||||
try:
|
||||
fn()
|
||||
except Exception, e:
|
||||
scheduler.log(fn.func_name)
|
||||
|
@ -182,27 +182,6 @@ class DocType:
|
||||
self.doc.is_asset_item = 'No'
|
||||
raise Exception
|
||||
|
||||
def check_min_inventory_level(self):
|
||||
if self.doc.minimum_inventory_level:
|
||||
total_qty = sql("select sum(projected_qty) from tabBin where item_code = %s",self.doc.name)
|
||||
if flt(total_qty) < flt(self.doc.minimum_inventory_level):
|
||||
msgprint("Your minimum inventory level is reached")
|
||||
send_to = []
|
||||
send = sql("select t1.email from `tabProfile` t1,`tabUserRole` t2 where t2.role IN ('Material Master Manager','Purchase Manager') and t2.parent = t1.name")
|
||||
for d in send:
|
||||
send_to.append(d[0])
|
||||
msg = '''
|
||||
Minimum Inventory Level Reached
|
||||
|
||||
Item Code: %s
|
||||
Item Name: %s
|
||||
Minimum Inventory Level: %s
|
||||
Total Available Qty: %s
|
||||
|
||||
''' % (self.doc.item_code, self.doc.item_name, self.doc.minimum_inventory_level, total_qty)
|
||||
|
||||
sendmail(send_to, sender='automail@webnotestech.com', subject='Minimum Inventory Level Reached', parts=[['text/plain', msg]])
|
||||
|
||||
def get_file_details(self, arg = ''):
|
||||
file = sql("select file_group, description from tabFile where name = %s", eval(arg)['file_name'], as_dict = 1)
|
||||
|
||||
|
@ -79,9 +79,8 @@ class DocType:
|
||||
def get_reconciliation_data(self,submit = 1):
|
||||
"""Read and validate csv data"""
|
||||
import csv
|
||||
from webnotes.utils import get_encoded_string
|
||||
from core.page.data_import_tool.data_import_tool import read_csv_content
|
||||
csv_content = get_encoded_string(self.get_csv_file_data(submit))
|
||||
csv_content = self.get_csv_file_data(submit).encode('utf-8')
|
||||
data = read_csv_content(csv_content)
|
||||
self.convert_into_list(data, submit)
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-07-02 19:57:48',
|
||||
'creation': '2012-07-03 14:22:38',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-07-03 12:54:52',
|
||||
'modified': '2012-08-02 13:16:48',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -38,133 +38,12 @@
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': u'Contact',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Contact
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Contact'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales Master Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Purchase Master Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Purchase Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Maintenance Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Purchase User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Maintenance User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'All'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
@ -356,6 +235,15 @@
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'unsubscribed',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Unsubscribed',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
|
@ -107,6 +107,25 @@ def add_comment(args=None):
|
||||
|
||||
return comment_html
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
def add_subscriber():
|
||||
"""add blog subscriber to lead"""
|
||||
full_name = webnotes.form_dict.get('your_name')
|
||||
email = webnotes.form_dict.get('your_email_address')
|
||||
name = webnotes.conn.sql("""select name from tabLead where email_id=%s""", email)
|
||||
|
||||
from webnotes.model.doc import Document
|
||||
if name:
|
||||
lead = Document('Lead', name[0][0])
|
||||
else:
|
||||
lead = Document('Lead')
|
||||
|
||||
lead.unsubscribed = 0
|
||||
lead.blog_subscriber = 1
|
||||
lead.lead_name = full_name
|
||||
lead.email_id = email
|
||||
lead.save()
|
||||
|
||||
def get_blog_content(blog_page_name):
|
||||
import website.web_cache
|
||||
content = website.web_cache.get_html(blog_page_name)
|
||||
|
@ -14,24 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pscript.onload_unsubscribe = function(wrapper) {
|
||||
var email = window.location.hash.split('/').splice(-1);
|
||||
$(wrapper).find('input[name="unsubscribe"]').val(email)
|
||||
|
||||
$('#btn-unsubscribe').click(function() {
|
||||
var email = $(wrapper).find('input[name="unsubscribe"]').val();
|
||||
if(email) {
|
||||
var btn = this;
|
||||
wn.call({
|
||||
module:'website',
|
||||
page:'unsubscribe',
|
||||
method:'unsubscribe',
|
||||
args:email,
|
||||
btn: this,
|
||||
callback: function() {
|
||||
$(wrapper).find('input[name="unsubscribe"]').val('');
|
||||
}
|
||||
cur_frm.cscript.refresh = function(doc) {
|
||||
if(!doc.__islocal && doc.published && !doc.email_sent) {
|
||||
cur_frm.add_custom_button('Email Subscribers', function() {
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
@ -30,6 +30,31 @@ class DocType(website.web_page.Page):
|
||||
super(DocType, self).__init__('Blog')
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def send_emails(self):
|
||||
"""send emails to subscribers"""
|
||||
if self.doc.email_sent:
|
||||
webnotes.msgprint("""Blog Subscribers already updated""", raise_exception=1)
|
||||
|
||||
from webnotes.utils.email_lib.bulk import send
|
||||
from markdown2 import markdown
|
||||
import webnotes.utils
|
||||
|
||||
# get leads that are subscribed to the blog
|
||||
recipients = [e[0] for e in webnotes.conn.sql("""select distinct email_id from tabLead where
|
||||
ifnull(blog_subscriber,0)=1""")]
|
||||
|
||||
# make heading as link
|
||||
content = '<h2><a href="%s/%s.html">%s</a></h2>\n\n%s' % (webnotes.utils.get_request_site_address(),
|
||||
self.doc.page_name, self.doc.title, markdown(self.doc.content))
|
||||
|
||||
# send the blog
|
||||
send(recipients = recipients, doctype='Lead', email_field='email_id',
|
||||
first_name_field = 'lead_name', last_name_field="", subject=self.doc.title,
|
||||
message = markdown(content))
|
||||
|
||||
webnotes.conn.set(self.doc, 'email_sent', 1)
|
||||
webnotes.msgprint("""Scheduled to send to %s subscribers""" % len(recipients))
|
||||
|
||||
def on_update(self):
|
||||
super(DocType, self).on_update()
|
||||
if not webnotes.utils.cint(self.doc.published):
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-07-13 13:02:27',
|
||||
'creation': '2012-07-27 19:32:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-07-27 14:15:24',
|
||||
'modified': '2012-08-03 12:18:36',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -113,6 +113,16 @@
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'email_sent',
|
||||
'fieldtype': u'Check',
|
||||
'hidden': 1,
|
||||
'label': u'Email Sent',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
|
@ -1,29 +0,0 @@
|
||||
# DocType, Blog Subscriber
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:36:47',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:36:47',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': u'Website',
|
||||
'name': '__common__',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# DocType, Blog Subscriber
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Blog Subscriber'
|
||||
}
|
||||
]
|
@ -1,13 +0,0 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="web-content">
|
||||
<h1>Unsubscribe</h1>
|
||||
<br>
|
||||
<div class="web-main-section">
|
||||
<input name="unsubscribe">
|
||||
<button class="btn" id="btn-unsubscribe">Unsubscribe</button>
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
@ -1,43 +0,0 @@
|
||||
# Page, unsubscribe
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-27 17:19:02',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-27 17:19:02',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'page_name': 'unsubscribe',
|
||||
'standard': 'Yes',
|
||||
'title': 'Unsubscribe'
|
||||
},
|
||||
|
||||
# These values are common for all Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'name': '__common__',
|
||||
'parent': 'unsubscribe',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Page',
|
||||
'role': 'Guest'
|
||||
},
|
||||
|
||||
# Page, unsubscribe
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': 'unsubscribe'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role'
|
||||
}
|
||||
]
|
@ -2,6 +2,7 @@
|
||||
|
||||
{% block javascript %}
|
||||
{% include "js/blog_page.js" %}
|
||||
{% include "js/blog_subscribe.js" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
@ -41,11 +42,9 @@
|
||||
<div class="layout-side-section">
|
||||
<p><a href="blog.html">All Blogs</a></p>
|
||||
<br />
|
||||
<h4>Subscribe</h4>
|
||||
<p>
|
||||
<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
|
||||
<a href="rss.xml" target="_blank">RSS Feed</a>
|
||||
</p>
|
||||
{% block blog_subscribe %}
|
||||
{% include "html/blog_subscribe.html" %}
|
||||
{% endblock %}
|
||||
<br />
|
||||
<h4>Recent Posts</h4>
|
||||
<div class="recent-posts" style="min-height: 100px;"></div>
|
||||
|
9
erpnext/website/templates/html/blog_subscribe.html
Normal file
9
erpnext/website/templates/html/blog_subscribe.html
Normal file
@ -0,0 +1,9 @@
|
||||
<h4>Subscribe</h4>
|
||||
<br>
|
||||
<p>
|
||||
<button class="btn btn-warning btn-blog-subscribe">Get Updates via Email</button>
|
||||
</p>
|
||||
<p>
|
||||
<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
|
||||
<a href="rss.xml" target="_blank">RSS Feed</a>
|
||||
</p>
|
@ -59,8 +59,9 @@ erpnext.blog.render_recent_list = function(wrapper) {
|
||||
hide_refresh: true,
|
||||
render_row: function(parent, data) {
|
||||
if(data.content && data.content.length>=100) data.content += '...';
|
||||
parent.innerHTML = repl('<a href="%(page_name)s.html">%(title)s</a>\
|
||||
<div class="comment">%(content)s</div><br>', data);
|
||||
parent.innerHTML = repl('<div style="font-size: 80%">\
|
||||
<a href="%(page_name)s.html">%(title)s</a>\
|
||||
<div class="comment">%(content)s</div><br></div>', data);
|
||||
|
||||
// adjust page height depending on sidebar height
|
||||
erpnext.blog.adjust_page_height(wrapper);
|
||||
|
33
erpnext/website/templates/js/blog_subscribe.js
Normal file
33
erpnext/website/templates/js/blog_subscribe.js
Normal file
@ -0,0 +1,33 @@
|
||||
wn.provide('erpnext.blog');
|
||||
|
||||
(function() {
|
||||
$('body').on('click', '.btn-blog-subscribe', function() {
|
||||
var d = new wn.ui.Dialog({
|
||||
title: "Get Blog Updates via Email",
|
||||
fields: [
|
||||
{label: "Your Name", fieldtype:"Data", reqd:1},
|
||||
{label: "Your Email Address", fieldtype:"Data", reqd:1
|
||||
,description: "You can unsubscribe anytime."},
|
||||
{label: "Subscribe", fieldtype:"Button"}
|
||||
]
|
||||
});
|
||||
$(d.fields_dict.subscribe.input).click(function() {
|
||||
var args = d.get_values();
|
||||
if(!args) return;
|
||||
wn.call({
|
||||
method: 'website.blog.add_subscriber',
|
||||
args: args,
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
msgprint('Opps there seems to be some error, Please check back after some time.');
|
||||
} else {
|
||||
msgprint('Thanks for subscribing!');
|
||||
}
|
||||
d.hide();
|
||||
},
|
||||
btn: this
|
||||
})
|
||||
})
|
||||
d.show()
|
||||
})
|
||||
})()
|
@ -2,6 +2,7 @@
|
||||
|
||||
{% block javascript %}
|
||||
{% include "js/blog.js" %}
|
||||
{% include "js/blog_subscribe.js" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
@ -23,17 +24,9 @@
|
||||
</div>
|
||||
|
||||
<div class="layout-side-section">
|
||||
<!-- for later
|
||||
<h4>Get Updates</h4>
|
||||
<p>
|
||||
<input name="blog-subscribe">
|
||||
<button class="btn" id="blog-subscribe">Subscribe</button>
|
||||
</p>-->
|
||||
<h4>Subscribe</h4>
|
||||
<p>
|
||||
<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
|
||||
<a href="rss.xml" target="_blank">RSS Feed</a>
|
||||
</p>
|
||||
{% block blog_subscribe %}
|
||||
{% include "html/blog_subscribe.html" %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
|
11
erpnext/website/templates/pages/unsubscribed.html
Normal file
11
erpnext/website/templates/pages/unsubscribed.html
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends "html/outer.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content">
|
||||
<div class="layout-wrapper layout-main">
|
||||
<h3>Unsubscribed</h3>
|
||||
<br>
|
||||
<p><b>{{ webnotes.unsubscribed_email }}</b> has been unsubscribed.</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -42,3 +42,37 @@ def page_name(title):
|
||||
name = title.lower()
|
||||
name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
|
||||
return '-'.join(name.split()[:4])
|
||||
|
||||
def render(page_name):
|
||||
"""render html page"""
|
||||
import webnotes
|
||||
try:
|
||||
if page_name:
|
||||
html = get_html(page_name)
|
||||
else:
|
||||
html = get_html('index')
|
||||
except Exception, e:
|
||||
html = get_html('404')
|
||||
|
||||
from webnotes.handler import eprint, print_zip
|
||||
eprint("Content-Type: text/html")
|
||||
print_zip(html)
|
||||
|
||||
def get_html(page_name):
|
||||
"""get page html"""
|
||||
page_name = scrub_page_name(page_name)
|
||||
comments = get_comments(page_name)
|
||||
|
||||
import website.web_cache
|
||||
html = website.web_cache.get_html(page_name, comments)
|
||||
return html
|
||||
|
||||
def get_comments(page_name):
|
||||
import webnotes
|
||||
|
||||
if page_name == '404':
|
||||
comments = """error: %s""" % webnotes.getTraceback()
|
||||
else:
|
||||
comments = """page: %s""" % page_name
|
||||
|
||||
return comments
|
||||
|
@ -92,6 +92,7 @@ def get_predefined_pages():
|
||||
return page_list
|
||||
|
||||
def prepare_args(page_name):
|
||||
import webnotes
|
||||
if page_name == 'index':
|
||||
page_name = get_home_page()
|
||||
|
||||
@ -99,6 +100,7 @@ def prepare_args(page_name):
|
||||
args = {
|
||||
'template': 'pages/%s.html' % page_name,
|
||||
'name': page_name,
|
||||
'webnotes': webnotes
|
||||
}
|
||||
else:
|
||||
args = get_doc_fields(page_name)
|
||||
|
@ -869,7 +869,8 @@ opts.parent.appframe=new wn.ui.AppFrame($(opts.parent).find('.layout-appframe'))
|
||||
* lib/js/wn/ui/dialog.js
|
||||
*/
|
||||
wn.widgets.FieldGroup=function(){this.first_button=false;this.make_fields=function(body,fl){if(!window.make_field){wn.require('css/fields.css');wn.require('js/fields.js');}
|
||||
$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];if(!df.fieldname&&df.label){df.fieldname=df.label.replace(/ /g,'_').toLowerCase();}
|
||||
var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
f=make_field(df,null,div,null);f.not_in_form=1;this.fields_dict[df.fieldname]=f
|
||||
f.refresh();if(df.fieldtype=='Button'&&!this.first_button){$(f.input).addClass('btn-info');this.first_button=true;}}}
|
||||
this.catch_enter_as_submit=function(){var me=this;$(this.body).find(':input[type="text"], :input[type="password"]').keypress(function(e){if(e.which==13){$(me.body).find('.btn-info:first').click();}})}
|
||||
@ -2141,10 +2142,12 @@ errprint('[set_field_tip] Unable to set field tip: '+n);}}
|
||||
refresh_field=function(n,docname,table_field){if(typeof n==typeof[])refresh_many(n,docname,table_field);if(table_field){if(_f.frm_dialog&&_f.frm_dialog.display){_f.frm_dialog.cur_frm.refresh_field(n);}else{var g=_f.cur_grid_cell;if(g)var hc=g.grid.head_row.cells[g.cellIndex];if(g&&hc&&hc.fieldname==n&&g.row.docname==docname){hc.template.refresh();}else{cur_frm.fields_dict[table_field].grid.refresh_cell(docname,n);}}}else if(cur_frm){cur_frm.refresh_field(n)}}
|
||||
set_field_options=function(n,txt){cur_frm.set_df_property(n,'options',txt)}
|
||||
set_field_permlevel=function(n,level){cur_frm.set_df_property(n,'permlevel',level)}
|
||||
hide_field=function(n){function _hide_field(n,hidden){cur_frm.set_df_property(n,'hidden',hidden)}
|
||||
if(cur_frm){if(typeof n=='string')_hide_field(n,1);else{for(var i in n)_hide_field(n[i],1)}}}
|
||||
unhide_field=function(n){function _hide_field(n,hidden){cur_frm.set_df_property(n,'hidden',hidden)}
|
||||
if(cur_frm){if(typeof n=='string')_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
|
||||
*/
|
||||
|
@ -530,7 +530,8 @@ opts.parent.appframe=new wn.ui.AppFrame($(opts.parent).find('.layout-appframe'))
|
||||
* lib/js/wn/ui/dialog.js
|
||||
*/
|
||||
wn.widgets.FieldGroup=function(){this.first_button=false;this.make_fields=function(body,fl){if(!window.make_field){wn.require('css/fields.css');wn.require('js/fields.js');}
|
||||
$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];if(!df.fieldname&&df.label){df.fieldname=df.label.replace(/ /g,'_').toLowerCase();}
|
||||
var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
f=make_field(df,null,div,null);f.not_in_form=1;this.fields_dict[df.fieldname]=f
|
||||
f.refresh();if(df.fieldtype=='Button'&&!this.first_button){$(f.input).addClass('btn-info');this.first_button=true;}}}
|
||||
this.catch_enter_as_submit=function(){var me=this;$(this.body).find(':input[type="text"], :input[type="password"]').keypress(function(e){if(e.which==13){$(me.body).find('.btn-info:first').click();}})}
|
||||
|
@ -38,49 +38,8 @@ def init():
|
||||
|
||||
def respond():
|
||||
import webnotes
|
||||
from webnotes.utils import get_encoded_string
|
||||
try:
|
||||
if 'page' in webnotes.form_dict:
|
||||
html = get_html(webnotes.form_dict['page'])
|
||||
else:
|
||||
# show home page
|
||||
html = get_html('index')
|
||||
except Exception, e:
|
||||
html = get_html('404')
|
||||
|
||||
content = []
|
||||
import webnotes.handler
|
||||
html = get_encoded_string(html)
|
||||
html, content = webnotes.handler.gzip_response(html, content)
|
||||
|
||||
content += [
|
||||
"Content-Type: text/html",
|
||||
"",
|
||||
]
|
||||
|
||||
webnotes.handler.print_content(content)
|
||||
print html
|
||||
|
||||
def get_html(page_name):
|
||||
import website.utils
|
||||
page_name = website.utils.scrub_page_name(page_name)
|
||||
|
||||
comments = get_comments(page_name)
|
||||
|
||||
import website.web_cache
|
||||
html = website.web_cache.get_html(page_name, comments)
|
||||
|
||||
return html
|
||||
|
||||
def get_comments(page_name):
|
||||
import webnotes
|
||||
|
||||
if page_name == '404':
|
||||
comments = """error: %s""" % webnotes.getTraceback()
|
||||
else:
|
||||
comments = """page: %s""" % page_name
|
||||
|
||||
return comments
|
||||
return website.utils.render(webnotes.form_dict.get('page'))
|
||||
|
||||
if __name__=="__main__":
|
||||
init()
|
||||
|
Loading…
x
Reference in New Issue
Block a user