Merge pull request #629 from fogueri/master
Document updates
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9d3851d..f7608d4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,5 +1,12 @@
# Contributing to ERPNext
+### Reporting issues
+
+We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems. Please read the following guidelines before opening any issue.
+
+1. **Search for existing issues.** We want to avoid duplication, and you'd help us out a lot by first checking if someone else has reported the same issue. Moreover, the issue may have already been resolved with a fix available.
+1. **Share as much information as possible.** Include operating system and version, browser and version, when did you last update ERPNext, how is it customized, etc. where appropriate. Also include steps to reproduce the bug.
+
### New Features
#### Don't Repeat Yourself (DRY)
diff --git a/accounts/Print Format/SalesInvoice/SalesInvoice.html b/accounts/Print Format/SalesInvoice/SalesInvoice.html
index 2b08197..bdb7a01 100644
--- a/accounts/Print Format/SalesInvoice/SalesInvoice.html
+++ b/accounts/Print Format/SalesInvoice/SalesInvoice.html
@@ -103,7 +103,7 @@
<tr>
<td>Net Total</td>
<td width=40% style="text-align: right;">{{
- utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency)
+ utils.fmt_money(doc.net_total_export, currency=doc.currency)
}}</td>
</tr>
{%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%}
diff --git a/accounts/doctype/budget_distribution/budget_distribution.txt b/accounts/doctype/budget_distribution/budget_distribution.txt
index 70ef717..ae668ab 100644
--- a/accounts/doctype/budget_distribution/budget_distribution.txt
+++ b/accounts/doctype/budget_distribution/budget_distribution.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:05",
"docstatus": 0,
- "modified": "2013-07-05 14:29:23",
+ "modified": "2013-07-22 15:30:37",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -31,6 +31,7 @@
"parenttype": "DocType",
"read": 1,
"report": 1,
+ "role": "Accounts Manager",
"submit": 0
},
{
@@ -77,30 +78,15 @@
"read_only": 1
},
{
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "permlevel": 0,
- "role": "System Manager",
- "write": 1
- },
- {
- "doctype": "DocPerm",
- "permlevel": 2,
- "role": "System Manager"
- },
- {
"amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
- "role": "Accounts Manager",
"write": 1
},
{
"doctype": "DocPerm",
- "permlevel": 2,
- "role": "Accounts Manager"
+ "permlevel": 2
}
]
\ No newline at end of file
diff --git a/accounts/doctype/cost_center/cost_center.txt b/accounts/doctype/cost_center/cost_center.txt
index 95c4f5a..a9c7add 100644
--- a/accounts/doctype/cost_center/cost_center.txt
+++ b/accounts/doctype/cost_center/cost_center.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-23 19:57:17",
"docstatus": 0,
- "modified": "2013-07-09 14:43:41",
+ "modified": "2013-07-22 15:23:10",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -28,6 +28,7 @@
"permlevel": 0
},
{
+ "amend": 0,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Cost Center",
@@ -179,7 +180,6 @@
"report_hide": 1
},
{
- "amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
@@ -187,18 +187,10 @@
"write": 1
},
{
- "amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"role": "Accounts User",
"write": 0
- },
- {
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "role": "System Manager",
- "write": 1
}
]
\ No newline at end of file
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index 6503064..ab4b2b0 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -14,9 +14,57 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
- cur_frm.cscript.load_defaults(doc, cdt, cdn);
-}
+wn.provide("erpnext.accounts");
+
+erpnext.accounts.JournalVoucher = wn.ui.form.Controller.extend({
+ onload: function() {
+ this.load_defaults(this.frm.doc);
+ this.setup_queries();
+ },
+
+ setup_queries: function() {
+ var me = this;
+
+ $.each(["account", "cost_center"], function(i, fieldname) {
+ me.frm.set_query(fieldname, "entries", function() {
+ wn.model.validate_missing(me.frm.doc, "company");
+ return {
+ filters: {
+ company: me.frm.doc.company,
+ group_or_ledger: "Ledger"
+ }
+ };
+ });
+ });
+
+ $.each([["against_voucher", "Purchase Invoice", "credit_to"],
+ ["against_invoice", "Sales Invoice", "debit_to"]], function(i, opts) {
+ me.frm.set_query(opts[0], "entries", function(doc, cdt, cdn) {
+ var jvd = wn.model.get_doc(cdt, cdn);
+ wn.model.validate_missing(jvd, "account");
+ return {
+ filters: [
+ [opts[1], opts[2], "=", jvd.account],
+ [opts[1], "docstatus", "=", 1],
+ [opts[1], "outstanding_amount", ">", 0]
+ ]
+ };
+ });
+ });
+
+ this.frm.set_query("against_jv", "entries", function(doc, cdt, cdn) {
+ var jvd = wn.model.get_doc(cdt, cdn);
+ wn.model.validate_missing(jvd, "account");
+
+ return {
+ query: "accounts.doctype.journal_voucher.journal_voucher.get_against_jv",
+ filters: { account: jvd.account }
+ };
+ });
+ },
+});
+
+cur_frm.script_manager.make(erpnext.accounts.JournalVoucher);
cur_frm.cscript.refresh = function(doc) {
cur_frm.cscript.is_opening(doc)
@@ -34,7 +82,7 @@
}
}
-cur_frm.cscript.load_defaults = function(doc, cdt, cdn) {
+cur_frm.cscript.load_defaults = function(doc) {
if(!cur_frm.doc.__islocal || !cur_frm.doc.company) { return; }
doc = locals[doc.doctype][doc.name];
@@ -56,14 +104,6 @@
if (doc.is_opening == 'Yes') unhide_field('aging_date');
}
-cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
- var d = locals[cdt][cdn];
- if(d.idx == 1){
- d.debit = 0;
- d.credit = 0;
- }
-}
-
cur_frm.cscript.against_voucher = function(doc,cdt,cdn) {
var d = locals[cdt][cdn];
if (d.against_voucher && !flt(d.debit)) {
@@ -110,14 +150,16 @@
cur_frm.cscript.account = function(doc,dt,dn) {
var d = locals[dt][dn];
- wn.call({
- method: "accounts.utils.get_balance_on",
- args: {account: d.account, date: doc.posting_date},
- callback: function(r) {
- d.balance = format_currency(r.message, erpnext.get_currency(doc.company));
- refresh_field('balance', d.name, 'entries');
- }
- });
+ if(d.account) {
+ wn.call({
+ method: "accounts.utils.get_balance_on",
+ args: {account: d.account, date: doc.posting_date},
+ callback: function(r) {
+ d.balance = r.message;
+ refresh_field('balance', d.name, 'entries');
+ }
+ });
+ }
}
cur_frm.cscript.validate = function(doc,cdt,cdn) {
@@ -181,60 +223,4 @@
}
})
}
-}
-
-// get_query
-
-cur_frm.fields_dict['entries'].grid.get_field('account').get_query = function(doc) {
- return {
- filters: {
- group_or_ledger: "Ledger",
- company: doc.company
- }
- }
-}
-
-cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
- return {
- filters: {
- 'company': doc.company,
- 'group_or_ledger': 'Ledger'
- }
- }
-}
-
-cur_frm.fields_dict['entries'].grid.get_field('against_voucher').get_query = function(doc) {
- var d = locals[this.doctype][this.docname];
- return {
- filters: [
- ['Purchase Invoice', 'credit_to', '=', d.account],
- ['Purchase Invoice', 'docstatus', '=', 1],
- ['Purchase Invoice', 'outstanding_amount', '>', 0]
- ]
- }
-}
-
-cur_frm.fields_dict['entries'].grid.get_field('against_invoice').get_query = function(doc) {
- var d = locals[this.doctype][this.docname];
- return {
- filters: [
- ['Sales Invoice', 'debit_to', '=', d.account],
- ['Sales Invoice', 'docstatus', '=', 1],
- ['Sales Invoice', 'outstanding_amount', '>', 0]
- ]
- }
-}
-
-cur_frm.fields_dict['entries'].grid.get_field('against_jv').get_query = function(doc) {
- var d = locals[this.doctype][this.docname];
-
- if(!d.account) {
- msgprint("Please select Account first!")
- throw "account not selected"
- }
-
- return {
- query: "accounts.doctype.journal_voucher.journal_voucher.get_against_jv",
- filters: { account: d.account }
- }
}
\ No newline at end of file
diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt
index 235188e..accf515 100644
--- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt
+++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-30 12:49:46",
"docstatus": 0,
- "modified": "2013-07-05 14:48:10",
+ "modified": "2013-07-22 15:31:00",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -187,10 +187,6 @@
},
{
"doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
"role": "Accounts Manager"
},
{
diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.txt b/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
index 77d55dc..1f2d35e 100644
--- a/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
+++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:07",
"docstatus": 0,
- "modified": "2013-07-05 14:50:27",
+ "modified": "2013-07-22 15:31:33",
"modified_by": "Administrator",
"owner": "jai@webnotestech.com"
},
@@ -35,6 +35,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "Accounts Manager",
"submit": 1,
"write": 1
},
@@ -130,11 +131,6 @@
"reqd": 1
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "Accounts Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js
index 4afb838..e73386f 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -22,7 +22,7 @@
wn.require('app/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
wn.require('app/buying/doctype/purchase_common/purchase_common.js');
-erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.extend({
+erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
onload: function() {
this._super();
@@ -103,34 +103,14 @@
tc_name: function() {
this.get_terms();
},
-
+
+ entries_add: function(doc, cdt, cdn) {
+ var row = wn.model.get_doc(cdt, cdn);
+ this.frm.script_manager.copy_from_first_row("entries", row, ["expense_head", "cost_center"]);
+ }
});
-// for backward compatibility: combine new and previous states
-$.extend(cur_frm.cscript, new erpnext.accounts.PurchaseInvoiceController({frm: cur_frm}));
-
-
-cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = 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.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
-
- cl = getchildren('Purchase Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
- acc = '';
- cc = '';
-
- for(var i = 0; i<cl.length; i++) {
- if (cl[i].idx == 1){
- acc = cl[i].expense_head;
- cc = cl[i].cost_center;
- }
- else{
- if (! cl[i].expense_head) { cl[i].expense_head = acc; refresh_field('expense_head', cl[i].name, 'entries');}
- if (! cl[i].cost_center) {cl[i].cost_center = cc; refresh_field('cost_center', cl[i].name, 'entries');}
- }
- }
-}
+cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
cur_frm.cscript.is_opening = function(doc, dt, dn) {
hide_field('aging_date');
diff --git a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt
index cd366f6..f902ade 100644
--- a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt
+++ b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:08",
"docstatus": 0,
- "modified": "2013-07-05 14:52:17",
+ "modified": "2013-07-22 15:22:25",
"modified_by": "Administrator",
"owner": "wasim@webnotestech.com"
},
@@ -85,13 +85,6 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "role": "System Manager",
- "write": 1
- },
- {
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
"role": "Purchase Master Manager",
"write": 1
}
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 90239fa..773956a 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -150,6 +150,11 @@
paid_amount: function() {
this.write_off_outstanding_amount_automatically();
},
+
+ entries_add: function(doc, cdt, cdn) {
+ var row = wn.model.get_doc(cdt, cdn);
+ this.frm.script_manager.copy_from_first_row("entries", row, ["income_account", "cost_center"]);
+ }
});
// for backward compatibility: combine new and previous states
@@ -197,25 +202,6 @@
cur_frm.cscript.hide_fields(doc, dt, dn);
}
-cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
-
- cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
- acc = '';
- cc = '';
-
- for(var i = 0; i<cl.length; i++) {
-
- if (cl[i].idx == 1){
- acc = cl[i].income_account;
- cc = cl[i].cost_center;
- }
- else{
- if (! cl[i].income_account) { cl[i].income_account = acc; refresh_field('income_account', cl[i].name, 'entries');}
- if (! cl[i].cost_center) {cl[i].cost_center = cc;refresh_field('cost_center', cl[i].name, 'entries');}
- }
- }
-}
-
cur_frm.cscript.is_opening = function(doc, dt, dn) {
hide_field('aging_date');
if (doc.is_opening == 'Yes') unhide_field('aging_date');
diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index 93fb47f..76e87b6 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -374,22 +374,27 @@
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
["currency", "="]],
},
- "Sales Order Item": {
- "ref_dn_field": "so_detail",
- "compare_fields": [["export_rate", "="]],
- "is_child_table": True
- },
"Delivery Note": {
"ref_dn_field": "delivery_note",
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
["currency", "="]],
},
- "Delivery Note Item": {
- "ref_dn_field": "dn_detail",
- "compare_fields": [["export_rate", "="]],
- "is_child_table": True
- }
})
+
+ if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
+ super(DocType, self).validate_with_previous_doc(self.tname, {
+ "Sales Order Item": {
+ "ref_dn_field": "so_detail",
+ "compare_fields": [["export_rate", "="]],
+ "is_child_table": True
+ },
+ "Delivery Note Item": {
+ "ref_dn_field": "dn_detail",
+ "compare_fields": [["export_rate", "="]],
+ "is_child_table": True
+ }
+ })
+
def set_aging_date(self):
if self.doc.is_opening != 'Yes':
@@ -975,4 +980,4 @@
and tabAccount.company = '%(company)s'
and tabAccount.%(key)s LIKE '%(txt)s'
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
- 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
\ No newline at end of file
+ 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
index 4430960..eca6eae 100644
--- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
+++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
@@ -25,7 +25,7 @@
}
// For customizing print
-cur_frm.pformat.net_total = function(doc) {
+cur_frm.pformat.net_total_export = function(doc) {
return '';
}
@@ -70,8 +70,8 @@
// main table
out +='<table class="noborder" style="width:100%">';
- if(!print_hide('net_total')) {
- out +=make_row('Net Total',convert_rate(doc.net_total),1);
+ if(!print_hide('net_total_export')) {
+ out += make_row('Net Total', doc.net_total_export, 1);
}
// add rows
diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt
index 0ffc27d..20e4076 100644
--- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt
+++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:09",
"docstatus": 0,
- "modified": "2013-07-05 14:54:37",
+ "modified": "2013-07-22 15:22:14",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -24,6 +24,7 @@
"permlevel": 0
},
{
+ "amend": 0,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Sales Taxes and Charges Master",
@@ -97,7 +98,6 @@
"reqd": 1
},
{
- "amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
@@ -105,7 +105,6 @@
"write": 0
},
{
- "amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
@@ -116,14 +115,6 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "role": "System Manager",
- "write": 1
- },
- {
- "amend": 0,
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
"role": "Sales Master Manager",
"write": 1
}
diff --git a/accounts/report/purchase_register/purchase_register.py b/accounts/report/purchase_register/purchase_register.py
index 0970541..aa55a3b 100644
--- a/accounts/report/purchase_register/purchase_register.py
+++ b/accounts/report/purchase_register/purchase_register.py
@@ -54,7 +54,7 @@
row.append(expense_amount)
# net total
- row.append(net_total)
+ row.append(net_total or inv.net_total)
# tax account
total_tax = 0
@@ -121,7 +121,7 @@
def get_invoices(filters):
conditions = get_conditions(filters)
return webnotes.conn.sql("""select name, posting_date, credit_to, supplier, supplier_name,
- bill_no, bill_date, remarks, grand_total, outstanding_amount
+ bill_no, bill_date, remarks, net_total, grand_total, outstanding_amount
from `tabPurchase Invoice` where docstatus = 1 %s
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
diff --git a/accounts/report/sales_register/sales_register.py b/accounts/report/sales_register/sales_register.py
index 91ad1c2..653b5e6 100644
--- a/accounts/report/sales_register/sales_register.py
+++ b/accounts/report/sales_register/sales_register.py
@@ -54,7 +54,7 @@
row.append(income_amount)
# net total
- row.append(net_total)
+ row.append(net_total or inv.net_total)
# tax account
total_tax = 0
@@ -120,7 +120,7 @@
def get_invoices(filters):
conditions = get_conditions(filters)
return webnotes.conn.sql("""select name, posting_date, debit_to, project_name, customer,
- customer_name, remarks, grand_total, rounded_total, outstanding_amount
+ customer_name, remarks, net_total, grand_total, rounded_total, outstanding_amount
from `tabSales Invoice`
where docstatus = 1 %s order by posting_date desc, name desc""" %
conditions, filters, as_dict=1)
diff --git a/accounts/utils.py b/accounts/utils.py
index 3de445c..77665ea 100644
--- a/accounts/utils.py
+++ b/accounts/utils.py
@@ -119,7 +119,7 @@
bal = -bal
# if bal is None, return 0
- return bal or 0
+ return flt(bal)
@webnotes.whitelist()
def add_ac(args=None):
diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js
index e93d34e..c05eba8 100644
--- a/buying/doctype/purchase_common/purchase_common.js
+++ b/buying/doctype/purchase_common/purchase_common.js
@@ -99,6 +99,31 @@
}
},
+ supplier_address: function() {
+ var me = this;
+ if (this.frm.doc.supplier) {
+ wn.call({
+ doc: this.frm.doc,
+ method: "get_supplier_address",
+ freeze: true,
+ args: {
+ supplier: this.frm.doc.supplier,
+ address: this.frm.doc.supplier_address,
+ contact: this.frm.doc.contact_person
+ },
+ callback: function(r) {
+ if(!r.exc) {
+ me.frm.refresh_fields();
+ }
+ }
+ });
+ }
+ },
+
+ contact_person: function() {
+ this.supplier_address();
+ },
+
item_code: function(doc, cdt, cdn) {
var me = this;
var item = wn.model.get_doc(cdt, cdn);
@@ -129,7 +154,7 @@
},
callback: function(r) {
if(!r.exc) {
- me.import_ref_rate(me.frm.doc, cdt, cdn);
+ me.frm.script_manager.trigger("import_ref_rate", cdt, cdn);
}
}
});
diff --git a/buying/doctype/purchase_order/purchase_order.js b/buying/doctype/purchase_order/purchase_order.js
index bccd4a9..0d3d0ee 100644
--- a/buying/doctype/purchase_order/purchase_order.js
+++ b/buying/doctype/purchase_order/purchase_order.js
@@ -105,10 +105,6 @@
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.buying.PurchaseOrderController({frm: cur_frm}));
-cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = 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.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
return {
filters: {'supplier': doc.supplier}
diff --git a/buying/doctype/purchase_order/purchase_order.py b/buying/doctype/purchase_order/purchase_order.py
index 406f3a9..e2d7a45 100644
--- a/buying/doctype/purchase_order/purchase_order.py
+++ b/buying/doctype/purchase_order/purchase_order.py
@@ -249,7 +249,7 @@
def update_item(obj, target, source_parent):
target.conversion_factor = 1
target.import_amount = flt(obj.import_amount) - flt(obj.billed_amt)
- target.amount = target.import_amount / flt(source_parent.conversion_rate)
+ target.amount = target.import_amount * flt(source_parent.conversion_rate)
if flt(obj.purchase_rate):
target.qty = target.amount / flt(obj.purchase_rate)
diff --git a/buying/doctype/purchase_order/purchase_order.txt b/buying/doctype/purchase_order/purchase_order.txt
index 1699c56..bb310aa 100644
--- a/buying/doctype/purchase_order/purchase_order.txt
+++ b/buying/doctype/purchase_order/purchase_order.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
- "modified": "2013-07-09 12:50:00",
+ "modified": "2013-07-19 22:04:17",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -198,7 +198,7 @@
"fieldtype": "Float",
"hidden": 0,
"label": "Exchange Rate",
- "no_copy": 1,
+ "no_copy": 0,
"oldfieldname": "conversion_rate",
"oldfieldtype": "Currency",
"print_hide": 1,
diff --git a/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js
index 722ac00..96d8ec11 100644
--- a/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -72,14 +72,6 @@
}
}
-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 {
filters:{'supplier': doc.supplier}
diff --git a/buying/page/buying_home/buying_home.js b/buying/page/buying_home/buying_home.js
index 1972ad9..d24f230 100644
--- a/buying/page/buying_home/buying_home.js
+++ b/buying/page/buying_home/buying_home.js
@@ -66,6 +66,11 @@
"description": wn._("Tax Template for Purchase")
},
{
+ label: wn._("Price List"),
+ description: wn._("Mupltiple Item prices."),
+ doctype:"Price List"
+ },
+ {
"doctype":"Supplier Type",
"label": wn._("Supplier Type"),
"description": wn._("Supplier classification.")
diff --git a/buying/utils.py b/buying/utils.py
index 886b460..d7db1d5 100644
--- a/buying/utils.py
+++ b/buying/utils.py
@@ -207,7 +207,7 @@
@webnotes.whitelist()
def get_conversion_factor(item_code, uom):
return {"conversion_factor": webnotes.conn.get_value("UOM Conversion Detail",
- {"parent": item_code, "uom": uom})}
+ {"parent": item_code, "uom": uom}, "conversion_factor")}
@webnotes.whitelist()
def get_projected_qty(item_code, warehouse):
diff --git a/controllers/js/contact_address_common.js b/controllers/js/contact_address_common.js
index de1ab34..0b8ef08 100644
--- a/controllers/js/contact_address_common.js
+++ b/controllers/js/contact_address_common.js
@@ -2,11 +2,11 @@
cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
- cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
- cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query;
+ cur_frm.fields_dict.customer.get_query = erpnext.queries.customer;
+ cur_frm.fields_dict.supplier.get_query = erpnext.queries.supplier;
if(cur_frm.fields_dict.lead) {
- cur_frm.fields_dict.lead.get_query = erpnext.utils.lead_query;
+ cur_frm.fields_dict.lead.get_query = erpnext.queries.lead;
cur_frm.add_fetch('lead', 'lead_name', 'lead_name');
}
diff --git a/controllers/queries.py b/controllers/queries.py
index 321e15c..8a99077 100644
--- a/controllers/queries.py
+++ b/controllers/queries.py
@@ -145,20 +145,6 @@
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), 'start': start,
'page_len': page_len})
-def item_std(doctype, txt, searchfield, start, page_len, filters):
- return webnotes.conn.sql("""select tabItem.name,
- if(length(tabItem.item_name) > 40,
- concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name,
- if(length(tabItem.description) > 40,
- concat(substr(tabItem.description, 1, 40), "..."), description) as decription
- FROM tabItem
- WHERE tabItem.docstatus!=2
- and tabItem.%(key)s LIKE "%(txt)s"
- %(mcond)s
- limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt,
- 'mcond':get_match_cond(doctype, searchfield), 'start': start,
- 'page_len': page_len})
-
def account_query(doctype, txt, searchfield, start, page_len, filters):
conditions = []
if not filters:
diff --git a/hr/doctype/branch/branch.txt b/hr/doctype/branch/branch.txt
index 971c24b..3df2cd6 100644
--- a/hr/doctype/branch/branch.txt
+++ b/hr/doctype/branch/branch.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:13",
"docstatus": 0,
- "modified": "2013-07-05 14:28:09",
+ "modified": "2013-07-22 15:30:08",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -61,10 +61,6 @@
},
{
"doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
"role": "HR User"
},
{
diff --git a/hr/doctype/deduction_type/deduction_type.txt b/hr/doctype/deduction_type/deduction_type.txt
index 7bd0fea..1e38f0b 100644
--- a/hr/doctype/deduction_type/deduction_type.txt
+++ b/hr/doctype/deduction_type/deduction_type.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-22 16:50:30",
"docstatus": 0,
- "modified": "2013-07-05 14:34:46",
+ "modified": "2013-07-22 15:25:14",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -34,6 +34,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "HR User",
"submit": 0,
"write": 1
},
@@ -69,15 +70,6 @@
"width": "300px"
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "HR User"
- },
- {
- "doctype": "DocPerm",
- "role": "HR Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/hr/doctype/department/department.txt b/hr/doctype/department/department.txt
index 188e52a..1f4e420 100644
--- a/hr/doctype/department/department.txt
+++ b/hr/doctype/department/department.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-05 11:48:26",
"docstatus": 0,
- "modified": "2013-07-05 14:35:06",
+ "modified": "2013-07-22 15:25:03",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -33,6 +33,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "HR User",
"submit": 0,
"write": 1
},
@@ -67,15 +68,6 @@
"options": "Leave Block List"
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "HR User"
- },
- {
- "doctype": "DocPerm",
- "role": "HR Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/hr/doctype/earning_type/earning_type.txt b/hr/doctype/earning_type/earning_type.txt
index 0fa8c42..0c84cf1 100644
--- a/hr/doctype/earning_type/earning_type.txt
+++ b/hr/doctype/earning_type/earning_type.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-24 11:03:32",
"docstatus": 0,
- "modified": "2013-07-05 14:36:03",
+ "modified": "2013-07-22 15:25:26",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -34,6 +34,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "HR User",
"submit": 0,
"write": 1
},
@@ -90,15 +91,6 @@
"oldfieldtype": "Currency"
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "HR User"
- },
- {
- "doctype": "DocPerm",
- "role": "HR Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/hr/doctype/employment_type/employment_type.txt b/hr/doctype/employment_type/employment_type.txt
index e4a2f24..cabfbd7 100644
--- a/hr/doctype/employment_type/employment_type.txt
+++ b/hr/doctype/employment_type/employment_type.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:14",
"docstatus": 0,
- "modified": "2013-07-05 14:36:27",
+ "modified": "2013-07-22 15:31:58",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -60,10 +60,6 @@
},
{
"doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
"role": "HR User"
},
{
diff --git a/hr/doctype/grade/grade.txt b/hr/doctype/grade/grade.txt
index b674c31..0050ed9 100644
--- a/hr/doctype/grade/grade.txt
+++ b/hr/doctype/grade/grade.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:14",
"docstatus": 0,
- "modified": "2013-07-05 14:39:58",
+ "modified": "2013-07-22 15:27:26",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -33,6 +33,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "HR User",
"submit": 0,
"write": 1
},
@@ -59,15 +60,6 @@
"reqd": 1
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "HR User"
- },
- {
- "doctype": "DocPerm",
- "role": "HR Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/hr/doctype/leave_type/leave_type.txt b/hr/doctype/leave_type/leave_type.txt
index 29960b2..dd339dc 100644
--- a/hr/doctype/leave_type/leave_type.txt
+++ b/hr/doctype/leave_type/leave_type.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-21 09:55:58",
"docstatus": 0,
- "modified": "2013-07-05 14:44:54",
+ "modified": "2013-07-22 15:32:07",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -100,10 +100,6 @@
},
{
"doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
"role": "HR User"
},
{
diff --git a/hr/doctype/salary_manager/salary_manager.txt b/hr/doctype/salary_manager/salary_manager.txt
index f25de4f..423e789 100644
--- a/hr/doctype/salary_manager/salary_manager.txt
+++ b/hr/doctype/salary_manager/salary_manager.txt
@@ -2,7 +2,7 @@
{
"creation": "2012-03-27 14:35:59",
"docstatus": 0,
- "modified": "2013-07-05 14:53:30",
+ "modified": "2013-07-22 15:22:58",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -34,6 +34,7 @@
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
+ "role": "HR Manager",
"write": 1
},
{
@@ -179,15 +180,6 @@
"label": "Activity Log"
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "HR User"
- },
- {
- "doctype": "DocPerm",
- "role": "HR Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt b/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt
index 7fa4051..d0a4f47 100644
--- a/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt
+++ b/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:27:48",
"docstatus": 0,
- "modified": "2013-07-10 14:54:18",
+ "modified": "2013-07-22 15:27:44",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -22,20 +22,6 @@
"permlevel": 0
},
{
- "create": 1,
- "doctype": "DocPerm",
- "name": "__common__",
- "parent": "Salary Slip Deduction",
- "parentfield": "permissions",
- "parenttype": "DocType",
- "permlevel": 0,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "submit": 0,
- "write": 1
- },
- {
"doctype": "DocType",
"name": "Salary Slip Deduction"
},
@@ -72,8 +58,5 @@
"fieldname": "d_depends_on_lwp",
"fieldtype": "Check",
"label": "Depends on LWP"
- },
- {
- "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/hr/doctype/salary_slip_earning/salary_slip_earning.txt b/hr/doctype/salary_slip_earning/salary_slip_earning.txt
index 4ac3f39..3fc25fa 100644
--- a/hr/doctype/salary_slip_earning/salary_slip_earning.txt
+++ b/hr/doctype/salary_slip_earning/salary_slip_earning.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:27:48",
"docstatus": 0,
- "modified": "2013-07-10 14:54:18",
+ "modified": "2013-07-22 15:27:56",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -22,20 +22,6 @@
"permlevel": 0
},
{
- "create": 1,
- "doctype": "DocPerm",
- "name": "__common__",
- "parent": "Salary Slip Earning",
- "parentfield": "permissions",
- "parenttype": "DocType",
- "permlevel": 0,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "submit": 0,
- "write": 1
- },
- {
"doctype": "DocType",
"name": "Salary Slip Earning"
},
@@ -72,8 +58,5 @@
"fieldname": "e_depends_on_lwp",
"fieldtype": "Check",
"label": "Depends on LWP"
- },
- {
- "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/manufacturing/doctype/bom/bom.py b/manufacturing/doctype/bom/bom.py
index 00523c5..94f3d20 100644
--- a/manufacturing/doctype/bom/bom.py
+++ b/manufacturing/doctype/bom/bom.py
@@ -95,12 +95,12 @@
def get_bom_material_detail(self, args=None):
""" Get raw material details like uom, desc and rate"""
-
if not args:
args = webnotes.form_dict.get('args')
- import json
- args = json.loads(args)
-
+
+ import json
+ args = json.loads(args)
+
item = self.get_item_det(args['item_code'])
self.validate_rm_item(item)
diff --git a/manufacturing/doctype/bom/bom.txt b/manufacturing/doctype/bom/bom.txt
index 693f17d..92362ae 100644
--- a/manufacturing/doctype/bom/bom.txt
+++ b/manufacturing/doctype/bom/bom.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-22 15:11:38",
"docstatus": 0,
- "modified": "2013-07-08 16:18:33",
+ "modified": "2013-07-22 15:28:38",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -261,10 +261,6 @@
},
{
"doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
"role": "Manufacturing Manager"
},
{
diff --git a/manufacturing/doctype/bom_item/bom_item.txt b/manufacturing/doctype/bom_item/bom_item.txt
index 85fbcf6..a41ab65 100644
--- a/manufacturing/doctype/bom_item/bom_item.txt
+++ b/manufacturing/doctype/bom_item/bom_item.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:27:49",
"docstatus": 0,
- "modified": "2013-07-10 14:54:05",
+ "modified": "2013-07-22 15:28:20",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -21,19 +21,6 @@
"permlevel": 0
},
{
- "doctype": "DocPerm",
- "name": "__common__",
- "parent": "BOM Item",
- "parentfield": "permissions",
- "parenttype": "DocType",
- "permlevel": 0,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "submit": 0,
- "write": 1
- },
- {
"doctype": "DocType",
"name": "BOM Item"
},
@@ -146,8 +133,5 @@
"oldfieldtype": "Float",
"print_hide": 1,
"read_only": 1
- },
- {
- "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/manufacturing/doctype/bom_operation/bom_operation.txt b/manufacturing/doctype/bom_operation/bom_operation.txt
index 86dffe9..01d7d00 100644
--- a/manufacturing/doctype/bom_operation/bom_operation.txt
+++ b/manufacturing/doctype/bom_operation/bom_operation.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:27:49",
"docstatus": 0,
- "modified": "2013-07-10 14:54:05",
+ "modified": "2013-07-22 15:28:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -22,19 +22,6 @@
"permlevel": 0
},
{
- "doctype": "DocPerm",
- "name": "__common__",
- "parent": "BOM Operation",
- "parentfield": "permissions",
- "parenttype": "DocType",
- "permlevel": 0,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "submit": 0,
- "write": 1
- },
- {
"doctype": "DocType",
"name": "BOM Operation"
},
@@ -93,8 +80,5 @@
"oldfieldname": "operating_cost",
"oldfieldtype": "Currency",
"reqd": 0
- },
- {
- "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt b/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt
index e74f3bb..fab7dd0 100644
--- a/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt
+++ b/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:27:49",
"docstatus": 0,
- "modified": "2013-07-10 14:54:12",
+ "modified": "2013-07-22 15:26:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -23,19 +23,6 @@
"permlevel": 0
},
{
- "doctype": "DocPerm",
- "name": "__common__",
- "parent": "Production Plan Sales Order",
- "parentfield": "permissions",
- "parenttype": "DocType",
- "permlevel": 0,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "submit": 0,
- "write": 1
- },
- {
"doctype": "DocType",
"name": "Production Plan Sales Order"
},
@@ -80,8 +67,5 @@
"print_width": "120px",
"read_only": 1,
"width": "120px"
- },
- {
- "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.txt b/manufacturing/doctype/production_planning_tool/production_planning_tool.txt
index 401b172..85d8dab 100644
--- a/manufacturing/doctype/production_planning_tool/production_planning_tool.txt
+++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-21 12:03:47",
"docstatus": 0,
- "modified": "2013-07-05 14:51:19",
+ "modified": "2013-07-22 15:26:45",
"modified_by": "Administrator",
"owner": "jai@webnotestech.com"
},
@@ -34,6 +34,7 @@
"permlevel": 0,
"read": 1,
"report": 0,
+ "role": "Manufacturing User",
"submit": 0,
"write": 1
},
@@ -215,15 +216,6 @@
"options": "raise_purchase_request"
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "Manufacturing User"
- },
- {
- "doctype": "DocPerm",
- "role": "Manufacturing Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/patches/july_2013/p01_same_sales_rate_patch.py b/patches/july_2013/p01_same_sales_rate_patch.py
new file mode 100644
index 0000000..82ec1db
--- /dev/null
+++ b/patches/july_2013/p01_same_sales_rate_patch.py
@@ -0,0 +1,7 @@
+def execute():
+ import webnotes
+ webnotes.reload_doc("setup", "doctype", "global_defaults")
+
+ gd = webnotes.bean('Global Defaults')
+ gd.doc.maintain_same_sales_rate = 1
+ gd.save()
\ No newline at end of file
diff --git a/patches/july_2013/p05_custom_doctypes_in_list_view.py b/patches/july_2013/p05_custom_doctypes_in_list_view.py
new file mode 100644
index 0000000..867bead
--- /dev/null
+++ b/patches/july_2013/p05_custom_doctypes_in_list_view.py
@@ -0,0 +1,21 @@
+import webnotes
+from webnotes.model import no_value_fields
+
+def execute():
+ for dt in webnotes.conn.sql_list("""select name from `tabDocType` where custom=1"""):
+ dtbean = webnotes.bean("DocType", dt)
+
+ if any((df.in_list_view for df in dtbean.doclist.get({"doctype": "DocField", "parent": dt}))):
+ continue
+
+ i = 0
+ for df in dtbean.doclist.get({"doctype": "DocField", "parent": dt}):
+ if i > 5:
+ break
+
+ if df.fieldtype not in no_value_fields:
+ df.in_list_view = 1
+ i += 1
+
+ if i > 0:
+ dtbean.save()
\ No newline at end of file
diff --git a/patches/july_2013/p06_same_sales_rate.py b/patches/july_2013/p06_same_sales_rate.py
new file mode 100644
index 0000000..8222d3b
--- /dev/null
+++ b/patches/july_2013/p06_same_sales_rate.py
@@ -0,0 +1,13 @@
+def execute():
+ import webnotes
+ webnotes.reload_doc("selling", "doctype", "selling_settings")
+ ss = webnotes.bean("Selling Settings")
+
+ same_rate = webnotes.conn.get_value("Global Defaults", "maintain_same_sales_rate")
+
+ if same_rate or same_rate == 0:
+ ss.doc.maintain_same_sales_rate = same_rate
+ else:
+ ss.doc.maintain_same_sales_rate = 1
+
+ ss.save()
\ No newline at end of file
diff --git a/patches/july_2013/p07_repost_billed_amt_in_sales_cycle.py b/patches/july_2013/p07_repost_billed_amt_in_sales_cycle.py
new file mode 100644
index 0000000..e18bed0
--- /dev/null
+++ b/patches/july_2013/p07_repost_billed_amt_in_sales_cycle.py
@@ -0,0 +1,24 @@
+# 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
+
+def execute():
+ import webnotes
+ for si in webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1"""):
+ webnotes.get_obj("Sales Invoice", si[0],
+ with_children=1).update_qty(change_modified=False)
+ webnotes.conn.commit()
\ No newline at end of file
diff --git a/patches/july_2013/p08_custom_print_format_net_total_export.py b/patches/july_2013/p08_custom_print_format_net_total_export.py
new file mode 100644
index 0000000..a6a8335
--- /dev/null
+++ b/patches/july_2013/p08_custom_print_format_net_total_export.py
@@ -0,0 +1,15 @@
+from __future__ import unicode_literals
+import webnotes
+import re
+
+def execute():
+ for name, html in webnotes.conn.sql("""select name, html from `tabPrint Format` where standard='No'"""):
+ changed = False
+ for match in re.findall("(doc.net_total.*doc.conversion_rate)", html):
+ if match.replace(" ", "") == "doc.net_total/doc.conversion_rate":
+ html = html.replace(match, "doc.net_total_export")
+ changed = True
+
+ if changed:
+ webnotes.conn.set_value("Print Format", name, "html", html)
+
\ No newline at end of file
diff --git a/patches/march_2013/p08_create_aii_accounts.py b/patches/march_2013/p08_create_aii_accounts.py
index 0156a17..e4260d3 100644
--- a/patches/march_2013/p08_create_aii_accounts.py
+++ b/patches/march_2013/p08_create_aii_accounts.py
@@ -1,6 +1,7 @@
import webnotes
def execute():
webnotes.reload_doc("setup", "doctype", "company")
+ webnotes.reload_doc("accounts", "doctype", "cost_center")
create_chart_of_accounts_if_not_exists()
add_group_accounts()
add_ledger_accounts()
diff --git a/patches/patch_list.py b/patches/patch_list.py
index d6f4424..e8a03ff 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -16,11 +16,13 @@
from __future__ import unicode_literals
patch_list = [
- "execute:webnotes.reload_doc('core', 'doctype', 'docfield')",
- "execute:webnotes.reload_doc('core', 'doctype', 'docperm') # 2013-04-07",
- "execute:webnotes.reload_doc('core', 'doctype', 'report')",
- "execute:webnotes.reload_doc('core', 'doctype', 'doctype') # 2013-07-08",
- "execute:webnotes.reload_doc('core', 'doctype', 'page') # 2013-07-11",
+ "execute:webnotes.reload_doc('core', 'doctype', 'doctype', force=True) #2013-07-15",
+ "execute:webnotes.reload_doc('core', 'doctype', 'docfield', force=True) #2013-07-15",
+ "execute:webnotes.reload_doc('core', 'doctype', 'doctype', force=True) #2013-07-16",
+ "execute:webnotes.reload_doc('core', 'doctype', 'docfield', force=True) #2013-07-16",
+ "execute:webnotes.reload_doc('core', 'doctype', 'docperm') #2013-07-16",
+ "execute:webnotes.reload_doc('core', 'doctype', 'page') #2013-07-16",
+ "execute:webnotes.reload_doc('core', 'doctype', 'report') #2013-07-16",
"patches.mar_2012.clean_property_setter",
"patches.april_2012.naming_series_patch",
"patches.mar_2012.cleanup_control_panel",
@@ -161,9 +163,6 @@
"patches.february_2013.p05_leave_application",
"patches.february_2013.gle_floating_point_issue_revisited",
"patches.february_2013.fix_outstanding",
- 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Classic") # 2013-02-19',
- 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Modern") # 2013-02-19',
- 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Spartan") # 2013-02-19',
"execute:webnotes.delete_doc('DocType', 'Service Order')",
"execute:webnotes.delete_doc('DocType', 'Service Quotation')",
"execute:webnotes.delete_doc('DocType', 'Service Order Detail')",
@@ -174,9 +173,6 @@
"execute:webnotes.conn.sql(\"update `tabReport` set report_type=if(ifnull(query, '')='', 'Report Builder', 'Query Report') where is_standard='No'\")",
"execute:webnotes.conn.sql(\"update `tabReport` set report_name=name where ifnull(report_name,'')='' and is_standard='No'\")",
"patches.february_2013.p08_todo_query_report",
- 'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Classic") # 2013-02-26',
- 'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Modern") # 2013-02-26',
- 'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Spartan") # 2013-02-26',
"execute:(not webnotes.conn.exists('Role', 'Projects Manager')) and webnotes.doc({'doctype':'Role', 'role_name':'Projects Manager'}).insert()",
"patches.february_2013.p09_remove_cancelled_warehouses",
"patches.march_2013.update_po_prevdoc_doctype",
@@ -208,9 +204,6 @@
"patches.april_2013.p01_update_serial_no_valuation_rate",
"patches.april_2013.p02_add_country_and_currency",
"patches.april_2013.p03_fixes_for_lead_in_quotation",
- 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Classic") # 2013-04-02',
- 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Modern") # 2013-04-02',
- 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Spartan") # 2013-04-02',
"patches.april_2013.p04_reverse_modules_list",
"patches.april_2013.p04_update_role_in_pages",
"patches.april_2013.p05_update_file_data",
@@ -252,4 +245,20 @@
"patches.july_2013.p03_cost_center_company",
"execute:webnotes.bean('Style Settings').save() #2013-07-16",
"patches.july_2013.p04_merge_duplicate_leads",
+ "patches.july_2013.p05_custom_doctypes_in_list_view",
+ "patches.july_2013.p06_same_sales_rate",
+ "patches.july_2013.p07_repost_billed_amt_in_sales_cycle",
+ "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2013-07-22",
+ "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2013-07-22",
+ "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2013-07-22",
+ "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2013-07-22",
+ "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2013-07-22",
+ "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2013-07-22",
+ "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2013-07-22",
+ "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2013-07-22",
+ "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2013-07-22",
+ "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2013-07-22",
+ "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2013-07-22",
+ "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2013-07-22",
+ "patches.july_2013.p08_custom_print_format_net_total_export",
]
\ No newline at end of file
diff --git a/projects/doctype/time_log/time_log.js b/projects/doctype/time_log/time_log.js
index 69ec304..26d2398 100644
--- a/projects/doctype/time_log/time_log.js
+++ b/projects/doctype/time_log/time_log.js
@@ -1,9 +1,9 @@
wn.provide("erpnext.projects");
erpnext.projects.TimeLog = wn.ui.form.Controller.extend({
- setup: function() {
- this.frm.set_query("task", function() {
- return { query: "projects.utils.query_task" }
- });
+ onload: function() {
+ this.frm.set_query("task", erpnext.queries.task);
+ }
+});
cur_frm.cscript = new erpnext.projects.TimeLog({frm: cur_frm});
\ No newline at end of file
diff --git a/public/images/splash.svg b/public/images/splash.svg
index 3f9fa88..60ed317 100644
--- a/public/images/splash.svg
+++ b/public/images/splash.svg
@@ -13,7 +13,6 @@
version="1.1"
inkscape:version="0.48.2 r9819"
sodipodi:docname="splash-mono.svg"
- inkscape:export-filename="/Users/anandpdoshi/Dropbox/erpnext/logo 2013/erpnext-logo-2013 other colors 3.png"
inkscape:export-xdpi="167.56363"
inkscape:export-ydpi="167.56363"
viewBox="0 0 680 820"
diff --git a/public/js/conf.js b/public/js/conf.js
index 71f1fa6..330a2be 100644
--- a/public/js/conf.js
+++ b/public/js/conf.js
@@ -15,12 +15,16 @@
// add toolbar icon
$(document).bind('toolbar_setup', function() {
- $('.navbar-brand').html('<object data="app/images/splash.svg" \
- class="toolbar-splash" type="image/svg+xml"></object>erpnext')
- .css('max-width', '200px').css('overflow', 'hidden')
- .hover(function() {
- $(this).find('.icon-home').addClass('navbar-icon-home-hover');
- }, function() {
- $(this).find('.icon-home').removeClass('navbar-icon-home-hover');
+ var brand = ($("<div></div>").append(wn.boot.website_settings.brand_html).text() || 'erpnext');
+ $('.navbar-brand').html('<div style="display: inline-block;">\
+ <object type="image/svg+xml" data="app/images/splash.svg" class="toolbar-splash"></object>\
+ </div>' + brand)
+ .attr("title", brand)
+ .addClass("navbar-icon-home")
+ .css({
+ "max-width": "200px",
+ "overflow": "hidden",
+ "text-overflow": "ellipsis",
+ "white-space": "nowrap"
});
});
diff --git a/public/js/feature_setup.js b/public/js/feature_setup.js
index 85c848d..abd3370 100644
--- a/public/js/feature_setup.js
+++ b/public/js/feature_setup.js
@@ -127,13 +127,12 @@
'Sales Order': {'sales_order_details':['page_break']}
},
'fs_exports': {
- 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','amount','basic_rate']},
+ 'Delivery Note': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','amount','basic_rate']},
'POS Setting': {'fields':['conversion_rate','currency']},
- 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','amount','basic_rate']},
+ 'Quotation': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','amount','basic_rate']},
'Sales Invoice': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','amount','basic_rate']},
- 'Item': {'ref_rate_details':['ref_currency']},
'Sales BOM': {'fields':['currency']},
- 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','amount','basic_rate']}
+ 'Sales Order': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','amount','basic_rate']}
},
'fs_imports': {
@@ -144,7 +143,7 @@
'entries': ['purchase_ref_rate', 'amount','rate']
},
'Purchase Order': {
- 'fields': ['Note HTML', 'conversion_rate','currency', 'grand_total',
+ 'fields': ['conversion_rate','currency', 'grand_total',
'in_words', 'net_total', 'other_charges_added',
'other_charges_deducted'],
'po_details': ['purchase_ref_rate', 'amount','purchase_rate']
@@ -186,27 +185,27 @@
'Delivery Note': {'fields':['more_info']},
},
'fs_quality': {
- 'Item': {'fields':['Item Inspection Criteria','inspection_required']},
+ 'Item': {'fields':['inspection_criteria','inspection_required']},
'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
},
'fs_manufacturing': {
- 'Item': {'fields':['Manufacturing']}
+ 'Item': {'fields':['manufacturing']}
},
'fs_pos': {
'Sales Invoice': {'fields':['is_pos']}
},
'fs_recurring_invoice': {
- 'Sales Invoice': {'fields': ['Recurring Invoice']}
+ 'Sales Invoice': {'fields': ['recurring_invoice']}
}
}
$(document).bind('form_refresh', function() {
- for(sys_feat in sys_defaults) {
+ for(var sys_feat in sys_defaults) {
if(sys_defaults[sys_feat]=='0'
&& (sys_feat in pscript.feature_dict)) { //"Features to hide" exists
- if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat]) {
- for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype]) {
+ if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat]) {
+ for(var fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype]) {
if(fort=='fields') {
hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
} else if(cur_frm.fields_dict[fort]) {
diff --git a/public/js/queries.js b/public/js/queries.js
index a7e137e..8c3dd01 100644
--- a/public/js/queries.js
+++ b/public/js/queries.js
@@ -15,154 +15,51 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// searches for enabled profiles
-wn.provide("erpnext.utils");
-erpnext.utils.profile_query = function() {
- return "select name, concat_ws(' ', first_name, middle_name, last_name) \
- from `tabProfile` where ifnull(enabled, 0)=1 and docstatus < 2 and \
- name not in ('Administrator', 'Guest') and (%(key)s like \"%s\" or \
- concat_ws(' ', first_name, middle_name, last_name) like \"%%%s\") \
- order by \
- case when name like \"%s%%\" then 0 else 1 end, \
- case when concat_ws(' ', first_name, middle_name, last_name) like \"%s%%\" \
- then 0 else 1 end, \
- name asc limit 50";
-};
-
-// searches for active employees
-erpnext.utils.employee_query = function() {
- return "select name, employee_name from `tabEmployee` \
- where status = 'Active' and docstatus < 2 and \
- (%(key)s like \"%s\" or employee_name like \"%%%s\") \
- order by \
- case when name like \"%s%%\" then 0 else 1 end, \
- case when employee_name like \"%s%%\" then 0 else 1 end, \
- name limit 50";
-};
-
-// searches for leads which are not converted
-erpnext.utils.lead_query = function() {
- return "select name, lead_name, company_name from `tabLead` \
- where docstatus < 2 and ifnull(status, '') != 'Converted' and \
- (%(key)s like \"%s\" or lead_name like \"%%%s\" or company_name like \"%%%s\") \
- order by \
- case when name like \"%s%%\" then 0 else 1 end, \
- case when lead_name like \"%s%%\" then 0 else 1 end, \
- case when company_name like \"%s%%\" then 0 else 1 end, \
- lead_name asc limit 50";
-};
-
-// searches for customer
-erpnext.utils.customer_query = function() {
- if(sys_defaults.cust_master_name == "Customer Name") {
- var fields = ["name", "customer_group", "territory"];
- } else {
- var fields = ["name", "customer_name", "customer_group", "territory"];
- }
-
- return "select " + fields.join(", ") + " from `tabCustomer` where docstatus < 2 and \
- (%(key)s like \"%s\" or customer_name like \"%%%s\") \
- order by \
- case when name like \"%s%%\" then 0 else 1 end, \
- case when customer_name like \"%s%%\" then 0 else 1 end, \
- name, customer_name limit 50";
-};
-
-// searches for supplier
-erpnext.utils.supplier_query = function() {
- if(sys_defaults.supp_master_name == "Supplier Name") {
- var fields = ["name", "supplier_type"];
- } else {
- var fields = ["name", "supplier_name", "supplier_type"];
- }
-
- return "select " + fields.join(", ") + " from `tabSupplier` where docstatus < 2 and \
- (%(key)s like \"%s\" or supplier_name like \"%%%s\") \
- order by \
- case when name like \"%s%%\" then 0 else 1 end, \
- case when supplier_name like \"%s%%\" then 0 else 1 end, \
- name, supplier_name limit 50";
-};
-
wn.provide("erpnext.queries");
-
-erpnext.queries.get_conditions = function(doctype, opts) {
- conditions = [];
- if (opts) {
- $.each(opts, function(key, val) {
- var lhs = "`tab" + doctype + "`.`" + key + "`";
-
- if(key.indexOf(doctype)!=-1) {
- // with function
- lhs = key;
- }
-
- if (esc_quotes(val).charAt(0) != "!")
- conditions.push(lhs + "='"+esc_quotes(val)+"'");
- else
- conditions.push(lhs + "!='"+esc_quotes(val).substr(1)+"'");
- });
- }
- return conditions;
-}
-
-erpnext.queries.account = function(opts) {
- if(!opts)
- opts = {};
- if(!opts.group_or_ledger)
- opts.group_or_ledger = "Ledger";
+$.extend(erpnext.queries, {
+ profile: function() {
+ return { query: "controllers.queries.profile_query" };
+ },
+
+ lead: function() {
+ return { query: "controllers.queries.lead_query" };
+ },
+
+ customer: function() {
+ return { query: "controllers.queries.customer_query" };
+ },
+
+ supplier: function() {
+ return { query: "controllers.queries.supplier_query" };
+ },
+
+ account: function() {
+ return { query: "controllers.queries.account_query" };
+ },
+
+ item: function() {
+ return { query: "controllers.queries.item_query" };
+ },
+
+ bom: function() {
+ return { query: "controllers.queries.bom" };
+ },
+
+ task: function() {
+ return { query: "projects.utils.query_task" };
+ },
+
+ customer_filter: function(doc) {
+ if(!doc.customer) {
+ wn.throw(wn._("Please specify a") + " " +
+ wn._(wn.meta.get_label(doc.doctype, "customer", doc.name)));
+ }
- var conditions = erpnext.queries.get_conditions("Account", opts);
+ return { filters: { customer: doc.customer } };
+ },
- return 'SELECT tabAccount.name, tabAccount.parent_account, tabAccount.debit_or_credit \
- FROM tabAccount \
- WHERE tabAccount.docstatus!=2 \
- AND tabAccount.%(key)s LIKE "%s" ' + (conditions
- ? (" AND " + conditions.join(" AND "))
- : "")
- + " LIMIT 50"
-}
-
-erpnext.queries.item = function(opts) {
- var conditions = erpnext.queries.get_conditions("Item", opts);
+ not_a_group_filter: function() {
+ return { filters: { is_group: "No" } };
+ },
- return 'SELECT tabItem.name, \
- if(length(tabItem.item_name) > 40, \
- concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name, \
- if(length(tabItem.description) > 40, \
- concat(substr(tabItem.description, 1, 40), "..."), description) as decription \
- FROM tabItem \
- WHERE tabItem.docstatus!=2 \
- AND (ifnull(`tabItem`.`end_of_life`,"") in ("", "0000-00-00") \
- OR `tabItem`.`end_of_life` > NOW()) \
- AND (tabItem.%(key)s LIKE \"%s\" OR tabItem.item_name LIKE \"%%%s\")' +
- (conditions ? (" AND " + conditions.join(" AND ")) : "") + " LIMIT 50"
-}
-
-erpnext.queries.item_std = function() {
- return 'SELECT tabItem.name, \
- if(length(tabItem.item_name) > 40, \
- concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name, \
- if(length(tabItem.description) > 40, \
- concat(substr(tabItem.description, 1, 40), "..."), description) as decription \
- FROM tabItem \
- WHERE tabItem.docstatus!=2 \
- AND tabItem.%(key)s LIKE "%s" LIMIT 50';
-}
-
-erpnext.queries.bom = function(opts) {
- var conditions = erpnext.queries.get_conditions("BOM", opts);
-
- return 'SELECT tabBOM.name, tabBOM.item \
- FROM tabBOM \
- WHERE tabBOM.docstatus=1 \
- AND tabBOM.is_active=1 \
- AND tabBOM.%(key)s LIKE "%s" ' + (conditions.length
- ? (" AND " + conditions.join(" AND "))
- : "")
- + " LIMIT 50"
-
-}
-
-erpnext.queries.task = function() {
- return { query: "projects.utils.query_task" };
-};
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/public/js/startup.css b/public/js/startup.css
index 2506868..835e2bd 100644
--- a/public/js/startup.css
+++ b/public/js/startup.css
@@ -37,5 +37,5 @@
.toolbar-splash {
width: 32px;
height: 32px;
- margin: -11px auto;
+ margin: -10px auto;
}
\ No newline at end of file
diff --git a/public/js/transaction.js b/public/js/transaction.js
index 50de3d5..421a7a5 100644
--- a/public/js/transaction.js
+++ b/public/js/transaction.js
@@ -39,6 +39,8 @@
if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname])
me.frm.set_value(fieldname, value);
});
+
+ me.frm.script_manager.trigger("company");
}
},
@@ -75,9 +77,9 @@
var me = this;
var company_currency = this.get_company_currency();
$.each(["currency", "price_list_currency"], function(i, fieldname) {
- if(!me.doc[fieldname]) {
+ if(!me.frm.doc[fieldname]) {
me.frm.set_value(fieldname, company_currency);
- me[fieldname]();
+ me.script_manager.trigger(fieldname);
}
});
}
@@ -106,9 +108,8 @@
},
conversion_rate: function() {
- if(this.frm.doc.currency === this.get_company_currency() &&
- this.frm.doc.conversion_rate !== 1.0) {
- this.frm.set_value("conversion_rate", 1.0);
+ if(this.frm.doc.currency === this.get_company_currency()) {
+ this.frm.set_value("conversion_rate", 1.0);
} else if(this.frm.doc.currency === this.frm.doc.price_list_currency &&
this.frm.doc.plc_conversion_rate !== this.frm.doc.conversion_rate) {
this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate);
@@ -333,7 +334,9 @@
return repl("<tr><td>%(item_name)s</td>%(taxes)s</tr>", {
item_name: item.item_name,
taxes: $.map(tax_accounts, function(head) {
- return "<td>(" + item_tax_record[head][0] + ") " + item_tax_record[head][1] + "</td>"
+ return item_tax_record[head] ?
+ "<td>(" + item_tax_record[head][0] + ") " + item_tax_record[head][1] + "</td>" :
+ "<td></td>";
}).join("\n")
});
}).join("\n");
diff --git a/selling/doctype/customer/customer.txt b/selling/doctype/customer/customer.txt
index 5b8e323..f4e068b 100644
--- a/selling/doctype/customer/customer.txt
+++ b/selling/doctype/customer/customer.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-06-11 14:26:44",
"docstatus": 0,
- "modified": "2013-07-11 16:53:18",
+ "modified": "2013-07-22 12:47:19",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -334,6 +334,21 @@
"permlevel": 0
},
{
+ "doctype": "DocField",
+ "fieldname": "customer_discount_section",
+ "fieldtype": "Section Break",
+ "label": "Customer Discount",
+ "permlevel": 0
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "customer_discounts",
+ "fieldtype": "Table",
+ "label": "Customer Discounts",
+ "options": "Customer Discount",
+ "permlevel": 0
+ },
+ {
"amend": 0,
"cancel": 0,
"create": 1,
diff --git a/selling/doctype/customer_discount/__init__.py b/selling/doctype/customer_discount/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/selling/doctype/customer_discount/__init__.py
diff --git a/selling/doctype/customer_discount/customer_discount.py b/selling/doctype/customer_discount/customer_discount.py
new file mode 100644
index 0000000..928aa9f
--- /dev/null
+++ b/selling/doctype/customer_discount/customer_discount.py
@@ -0,0 +1,8 @@
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/selling/doctype/customer_discount/customer_discount.txt b/selling/doctype/customer_discount/customer_discount.txt
new file mode 100644
index 0000000..e7b7822
--- /dev/null
+++ b/selling/doctype/customer_discount/customer_discount.txt
@@ -0,0 +1,42 @@
+[
+ {
+ "creation": "2013-07-22 12:43:40",
+ "docstatus": 0,
+ "modified": "2013-07-22 12:49:32",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "DocType",
+ "istable": 1,
+ "module": "Selling",
+ "name": "__common__"
+ },
+ {
+ "doctype": "DocField",
+ "in_list_view": 1,
+ "name": "__common__",
+ "parent": "Customer Discount",
+ "parentfield": "fields",
+ "parenttype": "DocType",
+ "permlevel": 0,
+ "reqd": 1
+ },
+ {
+ "doctype": "DocType",
+ "name": "Customer Discount"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "item_group",
+ "fieldtype": "Link",
+ "label": "Item Group",
+ "options": "Item Group"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "discount",
+ "fieldtype": "Currency",
+ "label": "Discount (%)"
+ }
+]
\ No newline at end of file
diff --git a/selling/doctype/installation_note/installation_note.txt b/selling/doctype/installation_note/installation_note.txt
index 7486586..27a2ad5 100644
--- a/selling/doctype/installation_note/installation_note.txt
+++ b/selling/doctype/installation_note/installation_note.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-04-30 13:13:06",
"docstatus": 0,
- "modified": "2013-07-15 17:09:08",
+ "modified": "2013-07-22 15:23:59",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -29,7 +29,8 @@
"parentfield": "permissions",
"parenttype": "DocType",
"read": 1,
- "report": 1
+ "report": 1,
+ "role": "Sales User"
},
{
"doctype": "DocType",
@@ -255,7 +256,6 @@
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
- "role": "System Manager",
"submit": 1,
"write": 1
},
@@ -265,45 +265,6 @@
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
- "role": "System Manager",
- "submit": 0
- },
- {
- "amend": 1,
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "permlevel": 0,
- "role": "Sales User",
- "submit": 1,
- "write": 1
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 1,
- "role": "Sales User",
- "submit": 0
- },
- {
- "amend": 1,
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "permlevel": 0,
- "role": "Sales Manager",
- "submit": 1,
- "write": 1
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 1,
- "role": "Sales Manager",
"submit": 0
}
]
\ No newline at end of file
diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js
index b87fee1..7c647c3 100644
--- a/selling/doctype/opportunity/opportunity.js
+++ b/selling/doctype/opportunity/opportunity.js
@@ -19,6 +19,70 @@
wn.provide("erpnext.selling");
// TODO commonify this code
erpnext.selling.Opportunity = wn.ui.form.Controller.extend({
+ onload: function() {
+ if(!this.frm.doc.enquiry_from && this.frm.doc.customer)
+ this.frm.doc.enquiry_from = "Customer";
+ if(!this.frm.doc.enquiry_from && this.frm.doc.lead)
+ this.frm.doc.enquiry_from = "Lead";
+
+ if(!this.frm.doc.enquiry_from)
+ hide_field(['customer', 'customer_address', 'contact_person', 'customer_name','lead', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
+ if(!this.frm.doc.status)
+ set_multiple(cdt,cdn,{status:'Draft'});
+ if(!this.frm.doc.date)
+ this.frm.doc.transaction_date = date.obj_to_str(new Date());
+ if(!this.frm.doc.company && sys_defaults.company)
+ set_multiple(cdt,cdn,{company:sys_defaults.company});
+ if(!this.frm.doc.fiscal_year && sys_defaults.fiscal_year)
+ set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
+
+ if(this.frm.doc.enquiry_from) {
+ if(this.frm.doc.enquiry_from == 'Customer') {
+ hide_field('lead');
+ }
+ else if (this.frm.doc.enquiry_from == 'Lead') {
+ hide_field(['customer', 'customer_address', 'contact_person', 'customer_group']);
+ }
+ }
+
+ if(!this.frm.doc.__islocal) {
+ cur_frm.communication_view = new wn.views.CommunicationList({
+ list: wn.model.get("Communication", {"opportunity": this.frm.doc.name}),
+ parent: cur_frm.fields_dict.communication_html.wrapper,
+ doc: this.frm.doc,
+ recipients: this.frm.doc.contact_email
+ });
+ }
+
+ if(this.frm.doc.customer && !this.frm.doc.customer_name) cur_frm.cscript.customer(this.frm.doc);
+
+ this.setup_queries();
+ },
+
+ setup_queries: function() {
+ var me = this;
+
+ if(this.frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
+ this.frm.set_query("contact_by", erpnext.queries.profile);
+ }
+
+ this.frm.set_query("item_code", "enquiry_details", function() {
+ return {
+ query: "controllers.queries.item_query",
+ filters: me.frm.doc.enquiry_type === "Maintenance" ?
+ {"is_service_item": "Yes"} : {"is_sales_item": "Yes"}
+ };
+ });
+
+ $.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]]);
+ });
+ },
+
customer: function() {
var me = this;
if(this.frm.doc.customer) {
@@ -70,52 +134,6 @@
}
-// ONLOAD
-// ===============================================================
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-
- if(!doc.enquiry_from && doc.customer)
- doc.enquiry_from = "Customer";
- if(!doc.enquiry_from && doc.lead)
- doc.enquiry_from = "Lead";
-
- if(!doc.enquiry_from)
- hide_field(['customer', 'customer_address', 'contact_person', 'customer_name','lead', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
- if(!doc.status)
- set_multiple(cdt,cdn,{status:'Draft'});
- if(!doc.date)
- doc.transaction_date = date.obj_to_str(new Date());
- if(!doc.company && sys_defaults.company)
- set_multiple(cdt,cdn,{company:sys_defaults.company});
- if(!doc.fiscal_year && sys_defaults.fiscal_year)
- set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
-
- if(doc.enquiry_from) {
- if(doc.enquiry_from == 'Customer') {
- hide_field('lead');
- }
- else if (doc.enquiry_from == 'Lead') {
- hide_field(['customer', 'customer_address', 'contact_person', 'customer_group']);
- }
- }
-
- if(!doc.__islocal) {
- cur_frm.communication_view = new wn.views.CommunicationList({
- list: wn.model.get("Communication", {"opportunity": doc.name}),
- parent: cur_frm.fields_dict.communication_html.wrapper,
- doc: doc,
- recipients: doc.contact_email
- });
- }
-
- if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
- cur_frm.fields_dict.contact_by.get_query = function(doc,cdt,cdn) {
- return { query:"controllers.queries.profile_query" } }
- }
-
- if(doc.customer && !doc.customer_name) cur_frm.cscript.customer(doc);
-}
-
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
if(doc.enquiry_from == 'Lead' && doc.lead) {
cur_frm.cscript.lead(doc,cdt,cdn);
@@ -153,26 +171,6 @@
if(doc.customer) 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.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
- return {
- filters:{'customer':doc.customer}
- }
-}
-
-cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
- if (!doc.customer) msgprint("Please select customer first");
- else {
- filters:{'customer':doc.customer}
- }
-}
-
-// lead
-cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
- return {
- query: "selling.doctype.opportunity.opportunity.get_lead"
- }
-}
-
cur_frm.cscript.lead = function(doc, cdt, cdn) {
cur_frm.toggle_display("contact_info", doc.customer || doc.lead);
@@ -185,19 +183,7 @@
'contact_email', 'territory']);
}
-cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
- if (doc.enquiry_type == 'Maintenance') {
- return {
- query:"controllers.queries.item_query",
- filters:{ 'is_service_item': 'Yes' }
- }
- } else {
- return {
- query:"controllers.queries.item_query",
- filters:{ 'is_sales_item': 'Yes' }
- }
- }
-}
+
cur_frm.cscript['Declare Opportunity Lost'] = function(){
var dialog = new wn.ui.Dialog({
@@ -229,16 +215,4 @@
});
dialog.show();
-}
-
-//get query select Territory
-cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
- return{
- filters:{'is_group': 'No'}
- }
-
-cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) {
- return { query:"controllers.queries.lead_query" } }
-
-cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
- return { query:"controllers.queries.customer_query" } }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py
index d4a97b6..f31d533 100644
--- a/selling/doctype/opportunity/opportunity.py
+++ b/selling/doctype/opportunity/opportunity.py
@@ -197,14 +197,4 @@
}
}, target_doclist)
- return [d.fields for d in doclist]
-
-def get_lead(doctype, txt, searchfield, start, page_len, filters):
- from controllers.queries import get_match_cond
- return webnotes.conn.sql ("""select `tabLead`.name, `tabLead`.lead_name FROM `tabLead`
- where `tabLead`.%(key)s like "%(txt)s"
- %(mcond)s
- order by `tabLead`.`name` asc
- limit %(start)s, %(page_len)s """ % {'key': searchfield,
- 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
- 'start': start, 'page_len': page_len})
\ No newline at end of file
+ return [d.fields for d in doclist]
\ No newline at end of file
diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js
index 9c11eea..45a9b5b 100644
--- a/selling/doctype/sales_common/sales_common.js
+++ b/selling/doctype/sales_common/sales_common.js
@@ -202,7 +202,7 @@
},
callback: function(r) {
if(!r.exc) {
- me.ref_rate(me.frm.doc, cdt, cdn);
+ me.frm.script_manager.trigger("ref_rate", cdt, cdn);
}
}
});
@@ -286,7 +286,7 @@
},
warehouse: function(doc, cdt, cdn) {
- var item = webnotes.get_doc(cdt, cdn);
+ var item = wn.model.get_doc(cdt, cdn);
if(item.item_code && (item.warehouse || item.reserved_warehouse)) {
this.frm.call({
method: "selling.utils.get_available_qty",
diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py
index 13f0e9f..b67510d 100644
--- a/selling/doctype/sales_order/sales_order.py
+++ b/selling/doctype/sales_order/sales_order.py
@@ -412,9 +412,9 @@
@webnotes.whitelist()
def make_sales_invoice(source_name, target_doclist=None):
def update_item(obj, target, source_parent):
- target.export_amount = flt(obj.amount) - flt(obj.billed_amt)
- target.amount = target.export_amount / flt(source_parent.conversion_rate)
- target.qty = obj.basic_rate and target.amount / flt(obj.basic_rate) or obj.qty
+ target.export_amount = flt(obj.export_amount) - flt(obj.billed_amt)
+ target.amount = target.export_amount * flt(source_parent.conversion_rate)
+ target.qty = obj.export_rate and target.export_amount / flt(obj.export_rate) or obj.qty
doclist = get_mapped_doclist("Sales Order", source_name, {
"Sales Order": {
diff --git a/selling/doctype/selling_settings/selling_settings.py b/selling/doctype/selling_settings/selling_settings.py
index 5a5dc4c..4716228 100644
--- a/selling/doctype/selling_settings/selling_settings.py
+++ b/selling/doctype/selling_settings/selling_settings.py
@@ -8,5 +8,5 @@
self.doc, self.doclist = d, dl
def validate(self):
- for key in ["cust_master_name", "customer_group", "territory"]:
+ for key in ["cust_master_name", "customer_group", "territory", "allow_same_sales_rate"]:
webnotes.conn.set_default(key, self.doc.fields.get(key, ""))
diff --git a/selling/doctype/selling_settings/selling_settings.txt b/selling/doctype/selling_settings/selling_settings.txt
index 35d256e..934cd41 100644
--- a/selling/doctype/selling_settings/selling_settings.txt
+++ b/selling/doctype/selling_settings/selling_settings.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-06-25 10:25:16",
"docstatus": 0,
- "modified": "2013-07-05 14:54:47",
+ "modified": "2013-07-18 12:03:39",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -89,6 +89,12 @@
"options": "No\nYes"
},
{
+ "doctype": "DocField",
+ "fieldname": "maintain_same_sales_rate",
+ "fieldtype": "Check",
+ "label": "Maintain Same Rate Throughout Sales Cycle"
+ },
+ {
"doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/selling/page/sales_browser/sales_browser.js b/selling/page/sales_browser/sales_browser.js
index ed13f9d..8506bc6 100644
--- a/selling/page/sales_browser/sales_browser.js
+++ b/selling/page/sales_browser/sales_browser.js
@@ -122,16 +122,24 @@
},
new_node: function() {
var me = this;
-
+
+ var fields = [
+ {fieldtype:'Data', fieldname: 'name_field',
+ label:'New ' + me.ctype + ' Name', reqd:true},
+ {fieldtype:'Select', fieldname:'is_group', label:'Group Node', options:'No\nYes',
+ description: "Further nodes can be only created under 'Group' type nodes"},
+ {fieldtype:'Button', fieldname:'create_new', label:'Create New' }
+ ]
+
+ if(me.ctype == "Sales Person") {
+ fields.splice(-1, 0, {fieldtype:'Link', fieldname:'employee', label:'Employee',
+ options:'Employee', description: "Please enter Employee Id of this sales parson"});
+ }
+
// the dialog
var d = new wn.ui.Dialog({
title:'New ' + me.ctype,
- fields: [
- {fieldtype:'Data', fieldname: 'name_field', label:'New ' + me.ctype + ' Name', reqd:true},
- {fieldtype:'Select', fieldname:'is_group', label:'Group Node',
- options:'No\nYes', description: "Further nodes can be only created under 'Group' type nodes"},
- {fieldtype:'Button', fieldname:'create_new', label:'Create New' }
- ]
+ fields: fields
})
d.set_value("is_group", "No");
diff --git a/selling/page/sales_browser/sales_browser.py b/selling/page/sales_browser/sales_browser.py
index b12c0f4..6693fe5 100644
--- a/selling/page/sales_browser/sales_browser.py
+++ b/selling/page/sales_browser/sales_browser.py
@@ -30,4 +30,7 @@
parent_field: webnotes.form_dict['parent'],
"is_group": webnotes.form_dict['is_group']
}]
+ if ctype == "Sales Person":
+ doclist[0]["employee"] = webnotes.form_dict.get('employee')
+
webnotes.bean(doclist).save()
\ No newline at end of file
diff --git a/selling/utils.py b/selling/utils.py
index 5f2cfbd..cbfaee7 100644
--- a/selling/utils.py
+++ b/selling/utils.py
@@ -66,6 +66,8 @@
if args.price_list_name and args.price_list_currency:
out.update(_get_price_list_rate(args, item_bean, meta))
+
+ out.update(_get_item_discount(out.item_group, args.customer))
if out.warehouse or out.reserved_warehouse:
out.update(get_available_qty(args.item_code, out.warehouse or out.reserved_warehouse))
@@ -119,7 +121,6 @@
or webnotes.conn.get_value("Company", args.company, "default_expense_account"),
"cost_center": item.default_sales_cost_center or args.cost_center,
"qty": 1.0,
- "adj_rate": 0.0,
"export_amount": 0.0,
"amount": 0.0,
"batch_no": None,
@@ -147,6 +148,23 @@
validate_currency(args, item_bean.doc, meta)
return {"ref_rate": flt(base_ref_rate[0].ref_rate * args.plc_conversion_rate / args.conversion_rate)}
+
+def _get_item_discount(item_group, customer):
+ parent_item_groups = [x[0] for x in webnotes.conn.sql("""SELECT parent.name
+ FROM `tabItem Group` AS node, `tabItem Group` AS parent
+ WHERE parent.lft <= node.lft and parent.rgt >= node.rgt and node.name = %s
+ GROUP BY parent.name
+ ORDER BY parent.lft desc""", item_group)]
+
+ discount = 0
+ for d in parent_item_groups:
+ res = webnotes.conn.sql("""select discount, name from `tabCustomer Discount`
+ where parent = %s and item_group = %s""", (customer, d))
+ if res:
+ discount = flt(res[0][0])
+ break
+
+ return {"adj_rate": discount}
@webnotes.whitelist()
def get_available_qty(item_code, warehouse):
@@ -162,7 +180,7 @@
def get_pos_settings(company):
pos_settings = webnotes.conn.sql("""select * from `tabPOS Setting` where user = %s
and company = %s""", (webnotes.session['user'], company), as_dict=1)
-
+
if not pos_settings:
pos_settings = webnotes.conn.sql("""select * from `tabPOS Setting`
where ifnull(user,'') = '' and company = %s""", company, as_dict=1)
diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py
index ae2d8ee..8a10587 100644
--- a/setup/doctype/company/company.py
+++ b/setup/doctype/company/company.py
@@ -77,12 +77,6 @@
website_settings.doclist.append({
"doctype": "Top Bar Item",
"parentfield": "top_bar_items",
- "label":"Home",
- "url": webpage.doc.name
- })
- website_settings.doclist.append({
- "doctype": "Top Bar Item",
- "parentfield": "top_bar_items",
"label":"Contact",
"url": "contact"
})
diff --git a/setup/doctype/currency_exchange/currency_exchange.js b/setup/doctype/currency_exchange/currency_exchange.js
index 02cba11..f10bdf0 100644
--- a/setup/doctype/currency_exchange/currency_exchange.js
+++ b/setup/doctype/currency_exchange/currency_exchange.js
@@ -15,6 +15,12 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
$.extend(cur_frm.cscript, {
+ onload: function() {
+ if(cur_frm.doc.__islocal) {
+ cur_frm.set_value("to_currency", wn.defaults.get_global_default("currency"));
+ }
+ },
+
refresh: function() {
cur_frm.cscript.set_exchange_rate_label();
},
diff --git a/setup/doctype/global_defaults/global_defaults.py b/setup/doctype/global_defaults/global_defaults.py
index 52a291f..7b0c277 100644
--- a/setup/doctype/global_defaults/global_defaults.py
+++ b/setup/doctype/global_defaults/global_defaults.py
@@ -32,7 +32,7 @@
'float_precision': 'float_precision',
'account_url':'account_url',
'session_expiry': 'session_expiry',
- 'disable_rounded_total': 'disable_rounded_total'
+ 'disable_rounded_total': 'disable_rounded_total',
}
class DocType:
diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js
index b642735..f672e7a 100644
--- a/setup/doctype/item_group/item_group.js
+++ b/setup/doctype/item_group/item_group.js
@@ -37,7 +37,7 @@
return{
filters:[
['Item Group', 'is_group', '=', 'Yes'],
- ['Item Group', 'naem', '!=', doc.item_group_name]
+ ['Item Group', 'name', '!=', doc.item_group_name]
]
}
}
\ No newline at end of file
diff --git a/setup/doctype/item_group/item_group.txt b/setup/doctype/item_group/item_group.txt
index a2b04e7..44faa49 100644
--- a/setup/doctype/item_group/item_group.txt
+++ b/setup/doctype/item_group/item_group.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-03-28 10:35:29",
"docstatus": 0,
- "modified": "2013-07-05 14:43:08",
+ "modified": "2013-07-22 15:29:54",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -194,13 +194,6 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "role": "System Manager",
- "write": 1
- },
- {
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
"role": "Material Master Manager",
"write": 1
}
diff --git a/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt b/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt
index d580410..d9174e3 100644
--- a/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt
+++ b/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:24",
"docstatus": 0,
- "modified": "2013-07-05 14:52:43",
+ "modified": "2013-07-22 15:29:22",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -23,6 +23,7 @@
"permlevel": 0
},
{
+ "amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
@@ -33,6 +34,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "Sales Master Manager",
"submit": 0,
"write": 1
},
@@ -59,12 +61,6 @@
"reqd": 1
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "amend": 0,
- "doctype": "DocPerm",
- "role": "Sales Master Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py
index 24df878..e2f1333 100644
--- a/stock/doctype/delivery_note/delivery_note.py
+++ b/stock/doctype/delivery_note/delivery_note.py
@@ -118,12 +118,16 @@
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
["currency", "="]],
},
- "Sales Order Item": {
- "ref_dn_field": "prevdoc_detail_docname",
- "compare_fields": [["export_rate", "="]],
- "is_child_table": True
- }
})
+ if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
+ super(DocType, self).validate_with_previous_doc(self.tname, {
+ "Sales Order Item": {
+ "ref_dn_field": "prevdoc_detail_docname",
+ "compare_fields": [["export_rate", "="]],
+ "is_child_table": True
+ }
+ })
+
def validate_proj_cust(self):
"""check for does customer belong to same project as entered.."""
@@ -354,12 +358,7 @@
make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2))
@webnotes.whitelist()
-def make_sales_invoice(source_name, target_doclist=None):
- def update_item(obj, target, source_parent):
- target.export_amount = flt(obj.amount)
- target.amount = target.export_amount / flt(source_parent.conversion_rate)
- target.qty = obj.basic_rate and target.amount / flt(obj.basic_rate) or obj.qty
-
+def make_sales_invoice(source_name, target_doclist=None):
def update_accounts(source, target):
si = webnotes.bean(target)
si.run_method("onload_post_render")
@@ -380,7 +379,6 @@
"prevdoc_docname": "sales_order",
"serial_no": "serial_no"
},
- "postprocess": update_item
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",
diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js
index b2a1ffe..b1bb269 100644
--- a/stock/doctype/item/item.js
+++ b/stock/doctype/item/item.js
@@ -14,8 +14,25 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-cur_frm.add_fetch("price_list_name", "currency", "ref_currency");
-cur_frm.add_fetch("price_list_name", "buying_or_selling", "buying_or_selling");
+wn.provide("erpnext.stock");
+
+erpnext.stock.Item = wn.ui.form.Controller.extend({
+ onload: function() {
+ this.frm.add_fetch("price_list_name", "currency", "ref_currency");
+ this.frm.add_fetch("price_list_name", "buying_or_selling", "buying_or_selling");
+ },
+
+ ref_rate_details_add: function(doc, cdt, cdn) {
+ var row = wn.model.get_doc(cdt, cdn);
+ if(row.price_list_name && !row.ref_currency) {
+ // execute fetch
+ var df = wn.meta.get_docfield(row.doctype, "price_list_name", row.parent);
+ this.frm.script_manager.validate_link_and_fetch(df, row.name, row.price_list_name);
+ }
+ }
+});
+
+cur_frm.script_manager.make(erpnext.stock.Item);
cur_frm.cscript.refresh = function(doc) {
// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
@@ -157,11 +174,6 @@
cur_frm.cscript.weight_to_validate(doc,cdt,cdn);
}
-cur_frm.fields_dict['ref_rate_details'].grid.onrowadd = function(doc, cdt, cdn){
- locals[cdt][cdn].ref_currency = sys_defaults.currency;
- refresh_field('ref_currency',cdn,'ref_rate_details');
-}
-
cur_frm.fields_dict.item_customer_details.grid.get_field("customer_name").get_query =
function(doc,cdt,cdn) {
return{ query:"controllers.queries.customer_query" } }
diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt b/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
index 36a5d72..53f2407 100644
--- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
+++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-22 16:50:39",
"docstatus": 0,
- "modified": "2013-07-05 14:43:57",
+ "modified": "2013-07-22 15:31:20",
"modified_by": "Administrator",
"owner": "wasim@webnotestech.com"
},
@@ -115,10 +115,6 @@
},
{
"doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
"role": "Purchase User"
}
]
\ No newline at end of file
diff --git a/stock/doctype/purchase_receipt/purchase_receipt.js b/stock/doctype/purchase_receipt/purchase_receipt.js
index e21d6a3..a134da1 100644
--- a/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -111,10 +111,6 @@
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.stock.PurchaseReceiptController({frm: cur_frm}));
-cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = 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.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
return{
filters:{ 'supplier': doc.supplier}
diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py
index 14d0c03..89a40e7 100644
--- a/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -352,10 +352,6 @@
def update_item(obj, target, source_parent):
target.conversion_factor = 1
- target.import_amount = flt(obj.import_amount)
- target.amount = target.import_amount / flt(source_parent.conversion_rate)
- if flt(obj.purchase_rate):
- target.qty = target.amount / flt(obj.purchase_rate)
doclist = get_mapped_doclist("Purchase Receipt", source_name, {
"Purchase Receipt": {
diff --git a/stock/doctype/serial_no/serial_no.txt b/stock/doctype/serial_no/serial_no.txt
index 72f78286..efa35f5 100644
--- a/stock/doctype/serial_no/serial_no.txt
+++ b/stock/doctype/serial_no/serial_no.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-05-16 10:59:15",
"docstatus": 0,
- "modified": "2013-07-05 14:54:52",
+ "modified": "2013-07-22 15:29:43",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -524,13 +524,6 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "role": "System Manager",
- "write": 1
- },
- {
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
"role": "Material Master Manager",
"write": 1
},
diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js
index 123c9fb..7032f92 100644
--- a/stock/doctype/stock_entry/stock_entry.js
+++ b/stock/doctype/stock_entry/stock_entry.js
@@ -234,9 +234,15 @@
}
},
+ mtn_details_add: function(doc, cdt, cdn) {
+ var row = wn.model.get_doc(cdt, cdn);
+
+ if(!row.s_warehouse) row.s_warehouse = this.frm.doc.from_warehouse;
+ if(!row.t_warehouse) row.t_warehouse = this.frm.doc.to_warehouse;
+ },
});
-cur_frm.cscript = new erpnext.stock.StockEntry({frm: cur_frm});
+cur_frm.script_manager.make(erpnext.stock.StockEntry);
cur_frm.cscript.toggle_related_fields = function(doc) {
disable_from_warehouse = inList(["Material Receipt", "Sales Return"], doc.purpose);
@@ -296,19 +302,6 @@
cur_frm.cscript.toggle_related_fields(doc, cdt, cdn);
}
-// copy over source and target warehouses
-cur_frm.fields_dict['mtn_details'].grid.onrowadd = function(doc, cdt, cdn){
- var d = locals[cdt][cdn];
- if(!d.s_warehouse && doc.from_warehouse) {
- d.s_warehouse = doc.from_warehouse
- refresh_field('s_warehouse', cdn, 'mtn_details')
- }
- if(!d.t_warehouse && doc.to_warehouse) {
- d.t_warehouse = doc.to_warehouse
- refresh_field('t_warehouse', cdn, 'mtn_details')
- }
-}
-
// Overloaded query for link batch_no
cur_frm.fields_dict['mtn_details'].grid.get_field('batch_no').get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py
index 47c0a75..d389620 100644
--- a/stock/doctype/stock_entry/stock_entry.py
+++ b/stock/doctype/stock_entry/stock_entry.py
@@ -36,7 +36,7 @@
from controllers.stock_controller import StockController
class DocType(StockController):
- def __init__(self, doc, doclist=[]):
+ def __init__(self, doc, doclist=None):
self.doc = doc
self.doclist = doclist
self.fname = 'mtn_details'
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
index fc63b8d..7ddcbf7 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.txt
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-03-28 10:35:31",
"docstatus": 0,
- "modified": "2013-07-05 14:56:37",
+ "modified": "2013-07-22 15:22:44",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -31,6 +31,7 @@
"permlevel": 0
},
{
+ "amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
@@ -41,6 +42,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "Material Manager",
"submit": 1,
"write": 1
},
@@ -156,12 +158,6 @@
"print_hide": 1
},
{
- "amend": 0,
- "doctype": "DocPerm",
- "role": "Material Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "System Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js
index 94b3bf0..d736ff6 100644
--- a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js
+++ b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js
@@ -14,15 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-cur_frm.fields_dict['item_code'].get_query = function(doc) {
- return {
- query: "controllers.queries.item_std"
- }
-}
-
-//==================== Get Items Stock UOM =====================================================
-cur_frm.cscript.item_code = function(doc,cdt,cdn) {
- if (doc.item_code) {
- get_server_fields('get_stock_uom', doc.item_code, '', doc, cdt, cdn, 1);
- }
-}
\ No newline at end of file
+$.extend(cur_frm.cscript, {
+ onload: function() {
+ cur_frm.set_query("item_code", erpnext.queries.item);
+ },
+
+ item_code: function() {
+ if(cur_frm.doc.item_code) {
+ cur_frm.call({
+ method: "get_stock_uom",
+ args: { item_code: cur_frm.doc.item_code }
+ });
+ }
+ }
+});
\ No newline at end of file
diff --git a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
index dbcccc4..f353629 100644
--- a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
+++ b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
@@ -31,9 +31,6 @@
def __init__(self, d, dl=[]):
self.doc, self.doclist = d,dl
- def get_stock_uom(self, item_code):
- return {'current_stock_uom': cstr(webnotes.conn.get_value('Item', item_code, 'stock_uom'))}
-
def validate_mandatory(self):
if not cstr(self.doc.item_code):
msgprint("Please Enter an Item.")
@@ -111,3 +108,8 @@
self.update_bin()
get_obj("Item", self.doc.item_code).on_update()
+
+@webnotes.whitelist()
+def get_stock_uom(item_code):
+ return { 'current_stock_uom': cstr(webnotes.conn.get_value('Item', item_code, 'stock_uom')) }
+
diff --git a/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt b/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt
index 8b35f64..d775513 100644
--- a/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt
+++ b/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:04",
"docstatus": 0,
- "modified": "2013-07-10 14:54:25",
+ "modified": "2013-07-22 17:17:53",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -15,6 +15,7 @@
},
{
"doctype": "DocField",
+ "in_list_view": 1,
"name": "__common__",
"parent": "UOM Conversion Detail",
"parentfield": "fields",
@@ -29,7 +30,6 @@
"doctype": "DocField",
"fieldname": "uom",
"fieldtype": "Link",
- "in_list_view": 0,
"label": "UOM",
"oldfieldname": "uom",
"oldfieldtype": "Link",
@@ -39,7 +39,6 @@
"doctype": "DocField",
"fieldname": "conversion_factor",
"fieldtype": "Float",
- "in_list_view": 1,
"label": "Conversion Factor",
"oldfieldname": "conversion_factor",
"oldfieldtype": "Float"
diff --git a/stock/doctype/warehouse/warehouse.txt b/stock/doctype/warehouse/warehouse.txt
index 95b0b52..f6d3bcc 100644
--- a/stock/doctype/warehouse/warehouse.txt
+++ b/stock/doctype/warehouse/warehouse.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 18:50:32",
"docstatus": 0,
- "modified": "2013-07-10 18:46:40",
+ "modified": "2013-07-22 15:20:35",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -24,11 +24,13 @@
"read_only": 0
},
{
+ "amend": 0,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Warehouse",
"parentfield": "permissions",
"parenttype": "DocType",
+ "permlevel": 0,
"read": 1,
"report": 1,
"submit": 0
@@ -201,47 +203,17 @@
"permlevel": 2
},
{
- "amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "permlevel": 0,
"role": "Material Master Manager",
"write": 1
},
{
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "permlevel": 0,
- "role": "System Manager",
- "write": 1
- },
- {
- "amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
- "permlevel": 0,
- "role": "Material Manager",
- "write": 0
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 0,
"role": "Material User",
"write": 0
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 2,
- "role": "System Manager",
- "write": 1
}
]
\ No newline at end of file
diff --git a/stock/utils.py b/stock/utils.py
index 942c200..da4752e 100644
--- a/stock/utils.py
+++ b/stock/utils.py
@@ -254,7 +254,7 @@
items = material_requests[request_type][company]
if not items:
continue
-
+
mr = [{
"doctype": "Material Request",
"company": company,
@@ -287,7 +287,7 @@
mr_bean.insert()
mr_bean.submit()
mr_list.append(mr_bean)
-
+
except:
if webnotes.message_log:
exceptions_list.append([] + webnotes.message_log)
diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.txt b/support/doctype/maintenance_schedule/maintenance_schedule.txt
index 0491946..c14764c 100644
--- a/support/doctype/maintenance_schedule/maintenance_schedule.txt
+++ b/support/doctype/maintenance_schedule/maintenance_schedule.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:30",
"docstatus": 0,
- "modified": "2013-07-10 12:18:19",
+ "modified": "2013-07-22 15:32:36",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -35,6 +35,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "Maintenance Manager",
"submit": 1,
"write": 1
},
@@ -249,11 +250,6 @@
"read_only": 1
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "Maintenance Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/support/doctype/maintenance_visit/maintenance_visit.txt b/support/doctype/maintenance_visit/maintenance_visit.txt
index 478d9ac..ee84f96 100644
--- a/support/doctype/maintenance_visit/maintenance_visit.txt
+++ b/support/doctype/maintenance_visit/maintenance_visit.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:31",
"docstatus": 0,
- "modified": "2013-07-10 12:26:15",
+ "modified": "2013-07-22 15:24:40",
"modified_by": "Administrator",
"owner": "ashwini@webnotestech.com"
},
@@ -35,6 +35,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "Maintenance User",
"submit": 1,
"write": 1
},
@@ -308,15 +309,6 @@
"print_hide": 1
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "Maintenance Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "Maintenance User"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/website/helpers/contact.py b/website/helpers/contact.py
index bf1521e..0042c03 100644
--- a/website/helpers/contact.py
+++ b/website/helpers/contact.py
@@ -17,7 +17,6 @@
from __future__ import unicode_literals
import webnotes
-from core.doctype.communication.communication import make
from webnotes.utils import now
max_communications_per_hour = 300
diff --git a/website/templates/html/navbar.html b/website/templates/html/navbar.html
index 9166cde..68706ec 100644
--- a/website/templates/html/navbar.html
+++ b/website/templates/html/navbar.html
@@ -1,5 +1,5 @@
<div class="navbar">
- {%- if brand_html %}<a class="navbar-brand" href="index">{{ brand_html }}</a>{% endif -%}
+ <a class="navbar-brand" href="index">{{ brand_html or "<i class='icon-home'></i>"}}</a>
<div class="container">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target=".navbar-responsive-collapse">