Merge branch 'master' of github.com:webnotes/erpnext into wsgi

Conflicts:
	accounts/doctype/purchase_invoice/purchase_invoice.py
	accounts/doctype/sales_invoice/sales_invoice.txt
	selling/doctype/lead/lead.txt
	selling/doctype/opportunity/opportunity.txt
	stock/doctype/warehouse/warehouse.py
This commit is contained in:
Anand Doshi
2013-10-02 16:52:52 +05:30
68 changed files with 1296 additions and 384 deletions

View File

@@ -45,7 +45,7 @@ cur_frm.cscript.setup_dashboard = function(doc) {
cur_frm.dashboard.reset(doc);
if(doc.__islocal)
return;
cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
cur_frm.dashboard.set_headline('<span class="text-muted">'+ wn._('Loading...')+ '</span>')
cur_frm.dashboard.add_doctype_badge("Opportunity", "customer");
cur_frm.dashboard.add_doctype_badge("Quotation", "customer");
@@ -99,7 +99,7 @@ cur_frm.cscript.make_contact = function() {
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
},
as_dict: 1,
no_results_message: 'No contacts created',
no_results_message: wn._('No contacts created'),
render_row: cur_frm.cscript.render_contact_row,
});
// note: render_contact_row is defined in contact_control.js
@@ -119,4 +119,4 @@ cur_frm.fields_dict.lead_name.get_query = function(doc,cdt,cdn) {
return{
query:"controllers.queries.lead_query"
}
}
}

View File

@@ -33,16 +33,7 @@ erpnext.LeadController = wn.ui.form.Controller.extend({
var doc = this.frm.doc;
erpnext.hide_naming_series();
this.frm.clear_custom_buttons();
this.frm.dashboard.reset(doc);
if(!doc.__islocal) {
if(doc.status=="Converted") {
this.frm.dashboard.set_headline_alert(wn._("Converted"), "alert-success", "icon-ok-sign");
} else {
this.frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
}
}
this.frm.__is_customer = this.frm.__is_customer || this.frm.doc.__is_customer;
if(!this.frm.doc.__islocal && !this.frm.__is_customer) {
this.frm.add_custom_button("Create Customer", this.create_customer);

View File

@@ -125,6 +125,10 @@ def make_opportunity(source_name, target_doclist=None):
"campaign_name": "campaign",
"doctype": "enquiry_from",
"name": "lead",
"lead_name": "contact_display",
"company_name": "customer_name",
"email_id": "contact_email",
"mobile_no": "contact_mobile"
}
}}, target_doclist)

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-10 11:45:37",
"docstatus": 0,
"modified": "2013-10-02 14:24:34",
"modified": "2013-10-02 14:24:30",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -112,7 +112,7 @@
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "\nOpen\nReplied\nAttempted to Contact\nContact in Future\nContacted\nInterested\nNot interested\nLead Lost\nConverted\nPassive",
"options": "\nOpen\nReplied\nAttempted to Contact\nContact in Future\nContacted\nOpportunity Made\nInterested\nNot interested\nLead Lost\nConverted\nPassive",
"reqd": 1,
"search_index": 1
},

View File

@@ -53,6 +53,11 @@ erpnext.selling.Opportunity = wn.ui.form.Controller.extend({
this.frm.set_query("contact_by", erpnext.queries.profile);
}
this.frm.set_query("customer_address", function() {
if(me.frm.doc.lead) return {filters: { lead: me.frm.doc.lead } };
else if(me.frm.doc.customer) return {filters: { customer: me.frm.doc.customer } };
});
this.frm.set_query("item_code", "enquiry_details", function() {
return {
query: "controllers.queries.item_query",
@@ -63,7 +68,6 @@ erpnext.selling.Opportunity = wn.ui.form.Controller.extend({
$.each([["lead", "lead"],
["customer", "customer"],
["customer_address", "customer_filter"],
["contact_person", "customer_filter"],
["territory", "not_a_group_filter"]], function(i, opts) {
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
@@ -151,8 +155,14 @@ cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
}
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer) return get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc, dt, dn) {
args = {
address: doc.customer_address,
contact: doc.contact_person
}
if(doc.customer) args.update({customer: doc.customer});
return get_server_fields('get_customer_address', JSON.stringify(args),'', doc, dt, dn, 1);
}
cur_frm.cscript.lead = function(doc, cdt, cdn) {
@@ -163,7 +173,7 @@ cur_frm.cscript.lead = function(doc, cdt, cdn) {
source_name: cur_frm.doc.lead
})
unhide_field(['customer_name', 'address_display','contact_mobile',
unhide_field(['customer_name', 'address_display','contact_mobile', 'customer_address',
'contact_email', 'territory']);
}

View File

@@ -127,12 +127,12 @@ class DocType(TransactionBase):
from accounts.utils import validate_fiscal_year
validate_fiscal_year(self.doc.transaction_date, self.doc.fiscal_year, "Opportunity Date")
if not self.doc.status:
self.doc.status = "Draft"
self.doc.status = "Draft"
def on_submit(self):
webnotes.conn.set(self.doc, 'status', 'Submitted')
if self.doc.lead and webnotes.conn.get_value("Lead", self.doc.lead, "status")!="Converted":
webnotes.conn.set_value("Lead", self.doc.lead, "status", "Opportunity Made")
def on_cancel(self):
chk = webnotes.conn.sql("select t1.name from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
@@ -141,6 +141,14 @@ class DocType(TransactionBase):
raise Exception
else:
webnotes.conn.set(self.doc, 'status', 'Cancelled')
if self.doc.lead and webnotes.conn.get_value("Lead", self.doc.lead,
"status")!="Converted":
if webnotes.conn.get_value("Communication", {"parent": self.doc.lead}):
status = "Contacted"
else:
status = "Open"
webnotes.conn.set_value("Lead", self.doc.lead, "status", status)
def declare_enquiry_lost(self,arg):
chk = webnotes.conn.sql("select t1.name from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 18:50:30",
"docstatus": 0,
"modified": "2013-10-02 14:24:35",
"modified": "2013-10-02 14:24:30",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -189,34 +189,16 @@
"options": "icon-bullhorn",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "contact_person",
"fieldtype": "Link",
"in_filter": 1,
"label": "Contact Person",
"options": "Contact",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "customer_address",
"fieldtype": "Link",
"in_filter": 1,
"label": "Customer Address",
"label": "Customer / Lead Address",
"options": "Address",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "customer_name",
"fieldtype": "Data",
"label": "Customer Name",
"print_hide": 0,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "address_display",
@@ -227,12 +209,60 @@
"oldfieldtype": "Small Text",
"read_only": 1
},
{
"description": "<a href=\"#Sales Browser/Territory\">To manage Territory, click here</a>",
"doctype": "DocField",
"fieldname": "territory",
"fieldtype": "Link",
"in_filter": 1,
"label": "Territory",
"options": "Territory",
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
},
{
"depends_on": "eval:doc.enquiry_from==\"Customer\"",
"description": "<a href=\"#Sales Browser/Customer Group\">To manage Territory, click here</a>",
"doctype": "DocField",
"fieldname": "customer_group",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "Customer Group",
"oldfieldname": "customer_group",
"oldfieldtype": "Link",
"options": "Customer Group",
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "column_break3",
"fieldtype": "Column Break",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "customer_name",
"fieldtype": "Data",
"label": "Customer Name",
"print_hide": 0,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "contact_person",
"fieldtype": "Link",
"in_filter": 1,
"label": "Contact Person",
"options": "Contact",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "contact_display",
@@ -254,36 +284,6 @@
"label": "Contact Mobile No",
"read_only": 1
},
{
"depends_on": "eval:doc.enquiry_from==\"Customer\"",
"description": "<a href=\"#Sales Browser/Customer Group\">To manage Territory, click here</a>",
"doctype": "DocField",
"fieldname": "customer_group",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "Customer Group",
"oldfieldname": "customer_group",
"oldfieldtype": "Link",
"options": "Customer Group",
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
},
{
"description": "<a href=\"#Sales Browser/Territory\">To manage Territory, click here</a>",
"doctype": "DocField",
"fieldname": "territory",
"fieldtype": "Link",
"in_filter": 1,
"label": "Territory",
"options": "Territory",
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
},
{
"description": "Filing in Additional Information about the Opportunity will help you analyze your data better.",
"doctype": "DocField",

View File

@@ -11,6 +11,7 @@ cur_frm.cscript.sales_team_fname = "sales_team";
wn.require('app/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
wn.require('app/utilities/doctype/sms_control/sms_control.js');
wn.require('app/selling/doctype/sales_common/sales_common.js');
wn.require('app/accounts/doctype/sales_invoice/pos.js');
erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
onload: function(doc, dt, dn) {
@@ -82,12 +83,12 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
},
validate_company_and_party: function(party_field) {
if(this.frm.doc.quotation_to == "Lead") {
return true;
} else if(!this.frm.doc.quotation_to) {
if(!this.frm.doc.quotation_to) {
msgprint(wn._("Please select a value for" + " " + wn.meta.get_label(this.frm.doc.doctype,
"quotation_to", this.frm.doc.name)));
return false;
} else if (this.frm.doc.quotation_to == "Lead") {
return true;
} else {
return this._super(party_field);
}

View File

@@ -162,8 +162,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
var item = wn.model.get_doc(cdt, cdn);
if(item.item_code || item.barcode) {
if(!this.validate_company_and_party("customer")) {
item.item_code = null;
refresh_field("item_code", item.name, item.parentfield);
cur_frm.fields_dict[me.frm.cscript.fname].grid.grid_rows[item.idx - 1].remove();
} else {
return this.frm.call({
method: "selling.utils.get_item_details",

View File

@@ -12,6 +12,7 @@ cur_frm.cscript.sales_team_fname = "sales_team";
wn.require('app/selling/doctype/sales_common/sales_common.js');
wn.require('app/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
wn.require('app/utilities/doctype/sms_control/sms_control.js');
wn.require('app/accounts/doctype/sales_invoice/pos.js');
erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend({
refresh: function(doc, dt, dn) {
@@ -26,34 +27,34 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
cur_frm.dashboard.add_progress(cint(doc.per_billed) + wn._("% Billed"),
doc.per_billed);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
cur_frm.add_custom_button(wn._('Send SMS'), cur_frm.cscript.send_sms);
// delivery note
if(flt(doc.per_delivered, 2) < 100 && doc.order_type=='Sales')
cur_frm.add_custom_button('Make Delivery', this.make_delivery_note);
cur_frm.add_custom_button(wn._('Make Delivery'), this.make_delivery_note);
// maintenance
if(flt(doc.per_delivered, 2) < 100 && (doc.order_type !='Sales')) {
cur_frm.add_custom_button('Make Maint. Visit', this.make_maintenance_visit);
cur_frm.add_custom_button('Make Maint. Schedule',
cur_frm.add_custom_button(wn._('Make Maint. Visit'), this.make_maintenance_visit);
cur_frm.add_custom_button(wn._('Make Maint. Schedule'),
this.make_maintenance_schedule);
}
// indent
if(!doc.order_type || (doc.order_type == 'Sales'))
cur_frm.add_custom_button('Make ' + wn._('Material Request'),
cur_frm.add_custom_button(wn._('Make ') + wn._('Material Request'),
this.make_material_request);
// sales invoice
if(flt(doc.per_billed, 2) < 100)
cur_frm.add_custom_button('Make Invoice', this.make_sales_invoice);
cur_frm.add_custom_button(wn._('Make Invoice'), this.make_sales_invoice);
// stop
if(flt(doc.per_delivered, 2) < 100 || doc.per_billed < 100)
cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Sales Order']);
cur_frm.add_custom_button(wn._('Stop!'), cur_frm.cscript['Stop Sales Order']);
} else {
// un-stop
cur_frm.dashboard.set_headline_alert("Stopped", "alert-danger", "icon-stop");
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
cur_frm.dashboard.set_headline_alert(wn._("Stopped"), "alert-danger", "icon-stop");
cur_frm.add_custom_button(wn._('Unstop'), cur_frm.cscript['Unstop Sales Order']);
}
}
@@ -157,7 +158,7 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
cur_frm.cscript['Stop Sales Order'] = function() {
var doc = cur_frm.doc;
var check = confirm("Are you sure you want to STOP " + doc.name);
var check = confirm(wn._("Are you sure you want to STOP ") + doc.name);
if (check) {
return $c('runserverobj', {
@@ -172,7 +173,7 @@ cur_frm.cscript['Stop Sales Order'] = function() {
cur_frm.cscript['Unstop Sales Order'] = function() {
var doc = cur_frm.doc;
var check = confirm("Are you sure you want to UNSTOP " + doc.name);
var check = confirm(wn._("Are you sure you want to UNSTOP ") + doc.name);
if (check) {
return $c('runserverobj', {
@@ -188,4 +189,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
if(cint(wn.boot.notification_settings.sales_order)) {
cur_frm.email_doc(wn.boot.notification_settings.sales_order_message);
}
};
};

View File

@@ -34,6 +34,7 @@ def get_item_details(args):
"plc_conversion_rate": 1.0
}
"""
if isinstance(args, basestring):
args = json.loads(args)
args = webnotes._dict(args)

View File

@@ -286,7 +286,7 @@ def apply_cart_settings(party=None, quotation=None):
cart_settings = webnotes.get_obj("Shopping Cart Settings")
billing_territory = get_address_territory(quotation.doc.customer_address) or \
party.territory
party.territory or "All Territories"
set_price_list_and_rate(quotation, cart_settings, billing_territory)