Merge branch 'responsive' of git://github.com/webnotes/erpnext into responsive

This commit is contained in:
Nabin Hait 2013-07-01 18:28:26 +05:30
commit 71c3f95098
33 changed files with 210 additions and 123 deletions

View File

@ -82,7 +82,7 @@ cur_frm.cscript.account_type = function(doc, cdt, cdn) {
// ----------------------------------------- // -----------------------------------------
cur_frm.cscript.add_toolbar_buttons = function(doc) { cur_frm.cscript.add_toolbar_buttons = function(doc) {
cur_frm.add_custom_button('Chart of Accounts', cur_frm.add_custom_button('Chart of Accounts',
function() { wn.set_route("Accounts Browser", "Account"); }, 'icon-list') function() { wn.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
if (cstr(doc.group_or_ledger) == 'Group') { if (cstr(doc.group_or_ledger) == 'Group') {
cur_frm.add_custom_button('Convert to Ledger', cur_frm.add_custom_button('Convert to Ledger',
@ -92,7 +92,12 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet') function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
cur_frm.add_custom_button('View Ledger', function() { cur_frm.add_custom_button('View Ledger', function() {
wn.set_route("general-ledger", "account=" + doc.name); wn.route_options = {
"account": doc.name,
"from_date": sys_defaults.year_start_date,
"to_date": sys_defaults.year_end_date
};
wn.set_route("general-ledger");
}); });
} }
} }

View File

@ -28,6 +28,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger') cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger')
cur_frm.set_intro(intro_txt); cur_frm.set_intro(intro_txt);
cur_frm.add_custom_button('Chart of Cost Centers',
function() { wn.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap')
} }
//Account filtering for cost center //Account filtering for cost center

View File

@ -23,7 +23,14 @@ cur_frm.cscript.refresh = function(doc) {
erpnext.hide_naming_series(); erpnext.hide_naming_series();
cur_frm.cscript.voucher_type(doc); cur_frm.cscript.voucher_type(doc);
if(doc.docstatus==1) { if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry); cur_frm.add_custom_button('View Ledger', function() {
wn.route_options = {
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
};
wn.set_route("general-ledger");
});
} }
} }
@ -49,8 +56,6 @@ cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
if (doc.is_opening == 'Yes') unhide_field('aging_date'); if (doc.is_opening == 'Yes') unhide_field('aging_date');
} }
//Set debit and credit to zero on adding new row
//----------------------------------------------
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){ cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if(d.idx == 1){ if(d.idx == 1){
@ -59,9 +64,6 @@ cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
} }
} }
// Get Outstanding of Payable & Sales Invoice
// -----------------------------------------------
cur_frm.cscript.against_voucher = function(doc,cdt,cdn) { cur_frm.cscript.against_voucher = function(doc,cdt,cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if (d.against_voucher && !flt(d.debit)) { if (d.against_voucher && !flt(d.debit)) {
@ -131,18 +133,24 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
cur_frm.pformat.print_heading = "Journal Voucher"; cur_frm.pformat.print_heading = "Journal Voucher";
} }
cur_frm.cscript.view_ledger_entry = function(doc,cdt,cdn){
wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
}
cur_frm.cscript.voucher_type = function(doc, cdt, cdn) { cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Voucher"); cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Voucher");
cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Voucher"); cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Voucher");
if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type) if(wn.model.get("Journal Voucher Detail", {"parent":doc.name}).length!==0 // too late
&& doc.company || !doc.company) // too early
&& wn.model.get("Journal Voucher Detail", {"parent":doc.name}).length==0) { return;
var update_jv_details = function(doc, r) {
$.each(r.message, function(i, d) {
var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries");
jvdetail.account = d.account;
jvdetail.balance = d.balance;
});
refresh_field("entries");
}
if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type)) {
wn.call({ wn.call({
type: "GET", type: "GET",
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account", method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
@ -152,14 +160,26 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
}, },
callback: function(r) { callback: function(r) {
if(r.message) { if(r.message) {
var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries"); update_jv_details(doc, r);
jvdetail.account = r.message.account;
// this is a data field????
jvdetail.balance = format_currency(r.message.balance);
refresh_field("entries");
} }
} }
}) })
} else if(doc.voucher_type=="Opening Entry") {
wn.call({
type:"GET",
method: "accounts.doctype.journal_voucher.journal_voucher.get_opening_accounts",
args: {
"company": doc.company
},
callback: function(r) {
wn.model.clear_table("Journal Voucher Detail", "Journal Voucher",
doc.name, "entries");
if(r.message) {
update_jv_details(doc, r);
}
cur_frm.set_value("is_opening", "Yes")
}
})
} }
} }

View File

@ -352,10 +352,19 @@ def get_default_bank_cash_account(company, voucher_type):
account = webnotes.conn.get_value("Company", company, account = webnotes.conn.get_value("Company", company,
voucher_type=="Bank Voucher" and "default_bank_account" or "default_cash_account") voucher_type=="Bank Voucher" and "default_bank_account" or "default_cash_account")
if account: if account:
return { return [{
"account": account, "account": account,
"balance": get_balance_on(account) "balance": get_balance_on(account)
} }]
@webnotes.whitelist()
def get_opening_accounts(company):
"""get all balance sheet accounts for opening entry"""
from accounts.utils import get_balance_on
accounts = webnotes.conn.sql_list("""select name from tabAccount
where group_or_ledger='Ledger' and is_pl_account='No' and company=%s""", company)
return [{"account": a, "balance": get_balance_on(a)} for a in accounts]
def get_against_purchase_invoice(doctype, txt, searchfield, start, page_len, filters): def get_against_purchase_invoice(doctype, txt, searchfield, start, page_len, filters):
return webnotes.conn.sql("""select name, credit_to, outstanding_amount, bill_no, bill_date return webnotes.conn.sql("""select name, credit_to, outstanding_amount, bill_no, bill_date

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-03-25 10:53:52", "creation": "2013-03-25 10:53:52",
"docstatus": 0, "docstatus": 0,
"modified": "2013-06-11 16:04:20", "modified": "2013-06-28 14:27:11",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -68,7 +68,7 @@
"label": "Voucher Type", "label": "Voucher Type",
"oldfieldname": "voucher_type", "oldfieldname": "voucher_type",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher", "options": "\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher\nOpening Entry",
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"search_index": 1 "search_index": 1

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-02-22 01:27:39", "creation": "2013-02-22 01:27:39",
"docstatus": 0, "docstatus": 0,
"modified": "2013-04-17 14:05:18", "modified": "2013-07-01 13:53:33",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -74,11 +74,12 @@
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "balance", "fieldname": "balance",
"fieldtype": "Data", "fieldtype": "Currency",
"label": "Account Balance", "label": "Account Balance",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "balance", "oldfieldname": "balance",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "Company:company:default_currency",
"read_only": 1 "read_only": 1
}, },
{ {

View File

@ -42,7 +42,14 @@ erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.ext
this.frm.add_custom_button('Make Payment Entry', this.make_bank_voucher); this.frm.add_custom_button('Make Payment Entry', this.make_bank_voucher);
if(doc.docstatus==1) { if(doc.docstatus==1) {
this.frm.add_custom_button('View Ledger', this.view_ledger_entry); cur_frm.add_custom_button('View Ledger', function() {
wn.route_options = {
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
};
wn.set_route("general-ledger");
});
} }
this.is_opening(doc); this.is_opening(doc);
@ -227,7 +234,3 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
else else
cur_frm.pformat.print_heading = "Purchase Invoice"; cur_frm.pformat.print_heading = "Purchase Invoice";
} }
cur_frm.cscript.view_ledger_entry = function(){
wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
}

View File

@ -45,7 +45,15 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
cur_frm.cscript.is_opening(doc, dt, dn); cur_frm.cscript.is_opening(doc, dt, dn);
if(doc.docstatus==1) { if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry); cur_frm.add_custom_button('View Ledger', function() {
wn.route_options = {
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
};
wn.set_route("general-ledger");
});
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
if(doc.is_pos==1 && doc.update_stock!=1) if(doc.is_pos==1 && doc.update_stock!=1)
@ -381,11 +389,6 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
} }
/****************** Get Accounting Entry *****************/
cur_frm.cscript.view_ledger_entry = function(){
wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) { cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
if(cint(wn.boot.notification_settings.sales_invoice)) { if(cint(wn.boot.notification_settings.sales_invoice)) {
cur_frm.email_doc(wn.boot.notification_settings.sales_invoice_message); cur_frm.email_doc(wn.boot.notification_settings.sales_invoice_message);

View File

@ -3,6 +3,7 @@
wn.module_page["Accounts"] = [ wn.module_page["Accounts"] = [
{ {
top: true,
title: wn._("Documents"), title: wn._("Documents"),
icon: "icon-copy", icon: "icon-copy",
items: [ items: [

View File

@ -22,10 +22,7 @@ wn.pages['general-ledger'].onload = function(wrapper) {
}); });
erpnext.general_ledger = new erpnext.GeneralLedger(wrapper); erpnext.general_ledger = new erpnext.GeneralLedger(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_icon("Accounts") wrapper.appframe.add_module_icon("Accounts")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
} }
@ -110,7 +107,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
// filter accounts options by company // filter accounts options by company
this.filter_inputs.company.change(function() { this.filter_inputs.company.change(function() {
me.setup_account_filter(this); me.setup_account_filter(this);
me.set_route() me.refresh()
}); });
this.filter_inputs.account.change(function() { this.filter_inputs.account.change(function() {
@ -220,13 +217,15 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
} }
} }
if(date < from_date || item.is_opening=="Yes") { if(!me.voucher_no && (date < from_date || item.is_opening=="Yes")) {
opening.debit += item.debit; opening.debit += item.debit;
opening.credit += item.credit; opening.credit += item.credit;
grouped_ledgers[item.account].opening.debit += item.debit; grouped_ledgers[item.account].opening.debit += item.debit;
grouped_ledgers[item.account].opening.credit += item.credit; grouped_ledgers[item.account].opening.credit += item.credit;
} else if(date <= to_date) { } else if(date <= to_date) {
totals.debit += item.debit; totals.debit += item.debit;
totals.credit += item.credit; totals.credit += item.credit;
@ -242,7 +241,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
+ item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", "); + item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", ");
} }
if(me.apply_filters(item) && item.is_opening=="No") { if(me.apply_filters(item) && (me.voucher_no || item.is_opening=="No")) {
out.push(item); out.push(item);
grouped_ledgers[item.account].entries.push(item); grouped_ledgers[item.account].entries.push(item);

View File

@ -9,11 +9,11 @@ wn.pages['voucher-import-tool'].onload = function(wrapper) {
<p class="help">Import multiple accounting entries via CSV (spreadsheet) file:</p>\ <p class="help">Import multiple accounting entries via CSV (spreadsheet) file:</p>\
<h3>1. Download Template</h3><br>\ <h3>1. Download Template</h3><br>\
<div style="padding-left: 30px;">\ <div style="padding-left: 30px;">\
<button class="btn btn-download-two-accounts">Download</button>\ <button class="btn btn-default btn-download-two-accounts">Download</button>\
<p class="help">Import multiple vouchers with one debit and one credit entry</p>\ <p class="help">Import multiple vouchers with one debit and one credit entry</p>\
</div>\ </div>\
<div style="padding-left: 30px;">\ <div style="padding-left: 30px;">\
<button class="btn btn-download-multiple-accounts">Download</button>\ <button class="btn btn-default btn-download-multiple-accounts">Download</button>\
<p class="help">Import multiple vouchers with multiple accounts</p>\ <p class="help">Import multiple vouchers with multiple accounts</p>\
</div>\ </div>\
<hr>\ <hr>\

View File

@ -4,6 +4,7 @@
wn.module_page["Buying"] = [ wn.module_page["Buying"] = [
{ {
title: wn._("Documents"), title: wn._("Documents"),
top: true,
icon: "icon-copy", icon: "icon-copy",
items: [ items: [
{ {

View File

@ -51,6 +51,9 @@ def get_item_details(args):
out.supplier_part_no = _get_supplier_part_no(args, item_bean) out.supplier_part_no = _get_supplier_part_no(args, item_bean)
if not out.warehouse:
out.warehouse = item_bean.doc.default_warehouse
if out.warehouse: if out.warehouse:
out.projected_qty = get_projected_qty(item.name, out.warehouse) out.projected_qty = get_projected_qty(item.name, out.warehouse)

View File

@ -3,9 +3,15 @@
wn.module_page["HR"] = [ wn.module_page["HR"] = [
{ {
title: wn._("Documents"), title: wn._("Top"),
top: true,
icon: "icon-copy", icon: "icon-copy",
items: [ items: [
{
label: wn._("Employee"),
description: wn._("Employee records."),
doctype:"Employee"
},
{ {
label: wn._("Leave Application"), label: wn._("Leave Application"),
description: wn._("Applications for leave."), description: wn._("Applications for leave."),
@ -16,6 +22,17 @@ wn.module_page["HR"] = [
description: wn._("Claims for company expense."), description: wn._("Claims for company expense."),
doctype:"Expense Claim" doctype:"Expense Claim"
}, },
{
label: wn._("Job Applicant"),
description: wn._("Applicant for a Job."),
doctype:"Job Applicant"
},
]
},
{
title: wn._("Documents"),
icon: "icon-copy",
items: [
{ {
label: wn._("Attendance"), label: wn._("Attendance"),
description: wn._("Attendance record."), description: wn._("Attendance record."),
@ -31,22 +48,6 @@ wn.module_page["HR"] = [
description: wn._("Performance appraisal."), description: wn._("Performance appraisal."),
doctype:"Appraisal" doctype:"Appraisal"
}, },
{
label: wn._("Job Applicant"),
description: wn._("Applicant for a Job."),
doctype:"Job Applicant"
},
]
},
{
title: wn._("Masters"),
icon: "icon-book",
items: [
{
label: wn._("Employee"),
description: wn._("Employee records."),
doctype:"Employee"
},
] ]
}, },
{ {

View File

@ -4,8 +4,14 @@
wn.module_page["Manufacturing"] = [ wn.module_page["Manufacturing"] = [
{ {
title: wn._("Documents"), title: wn._("Documents"),
top: true,
icon: "icon-copy", icon: "icon-copy",
items: [ items: [
{
label: wn._("Bill of Materials"),
description: wn._("Bill of Materials (BOM)"),
doctype:"BOM"
},
{ {
label: wn._("Production Order"), label: wn._("Production Order"),
description: wn._("Orders released for production."), description: wn._("Orders released for production."),
@ -29,11 +35,6 @@ wn.module_page["Manufacturing"] = [
title: wn._("Masters"), title: wn._("Masters"),
icon: "icon-book", icon: "icon-book",
items: [ items: [
{
label: wn._("Bill of Materials"),
description: wn._("Bill of Materials (BOM)"),
doctype:"BOM"
},
{ {
label: wn._("Item"), label: wn._("Item"),
description: wn._("All Products or Services."), description: wn._("All Products or Services."),

Binary file not shown.

View File

@ -3,8 +3,9 @@
wn.module_page["Projects"] = [ wn.module_page["Projects"] = [
{ {
title: wn._("Documents"), title: wn._("Top"),
icon: "icon-copy", icon: "icon-copy",
top: true,
items: [ items: [
{ {
label: wn._("Task"), label: wn._("Task"),
@ -21,6 +22,12 @@ wn.module_page["Projects"] = [
description: wn._("Time Log for tasks."), description: wn._("Time Log for tasks."),
doctype:"Time Log" doctype:"Time Log"
}, },
]
},
{
title: wn._("Documents"),
icon: "icon-copy",
items: [
{ {
label: wn._("Time Log Batch"), label: wn._("Time Log Batch"),
description: wn._("Batch Time Logs for billing."), description: wn._("Batch Time Logs for billing."),

View File

@ -20,13 +20,12 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({
show_stock_ledger: function() { show_stock_ledger: function() {
var me = this; var me = this;
this.frm.add_custom_button("Show Stock Ledger", function() { this.frm.add_custom_button("Show Stock Ledger", function() {
var args = { wn.route_options = {
voucher_no: cur_frm.doc.name, voucher_no: me.frm.doc.name,
from_date: wn.datetime.str_to_user(cur_frm.doc.posting_date), from_date: cur_frm.doc.posting_date,
to_date: wn.datetime.str_to_user(cur_frm.doc.posting_date) to_date: cur_frm.doc.posting_date
}; };
wn.set_route('stock-ledger', wn.set_route('stock-ledger');
$.map(args, function(val, key) { return key+"="+val; }).join("&&"));
}, "icon-bar-chart"); }, "icon-bar-chart");
} }
}); });

View File

@ -3,6 +3,7 @@
wn.module_page["Selling"] = [ wn.module_page["Selling"] = [
{ {
top: true,
title: wn._("Documents"), title: wn._("Documents"),
icon: "icon-copy", icon: "icon-copy",
items: [ items: [

View File

@ -201,8 +201,8 @@ class DocType:
for a in accounts: for a in accounts:
account_name = accounts[a] + " - " + self.doc.abbr account_name = accounts[a] + " - " + self.doc.abbr
if not self.doc.fields[a] and webnotes.conn.exists("Account", account_name): if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
webnotes.conn.set(self.doc, account_name) webnotes.conn.set(self.doc, a, account_name)
if not self.doc.stock_adjustment_cost_center: if not self.doc.stock_adjustment_cost_center:
webnotes.conn.set(self.doc, "stock_adjustment_cost_center", self.doc.cost_center) webnotes.conn.set(self.doc, "stock_adjustment_cost_center", self.doc.cost_center)

View File

@ -61,14 +61,21 @@ class DocType:
WHERE name=%(name)s AND docstatus<2""", args) WHERE name=%(name)s AND docstatus<2""", args)
def create_fiscal_year_and_company(self, args): def create_fiscal_year_and_company(self, args):
curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start')) curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'), True)
# Fiscal Year
webnotes.bean([{ webnotes.bean([{
"doctype":"Fiscal Year", "doctype":"Fiscal Year",
'year': curr_fiscal_year, 'year': curr_fiscal_year,
'year_start_date': fy_start_date, 'year_start_date': fy_start_date,
}]).insert() }]).insert()
curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'))
webnotes.bean([{
"doctype":"Fiscal Year",
'year': curr_fiscal_year,
'year_start_date': fy_start_date,
}]).insert()
# Company # Company
webnotes.bean([{ webnotes.bean([{
"doctype":"Company", "doctype":"Company",
@ -198,13 +205,15 @@ class DocType:
# Get Fiscal year Details # Get Fiscal year Details
# ------------------------ # ------------------------
def get_fy_details(self, fy_start): def get_fy_details(self, fy_start, last_year=False):
st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'} st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'}
curr_year = getdate(nowdate()).year curr_year = getdate(nowdate()).year
if last_year:
curr_year = curr_year - 1
if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]): if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]):
curr_year = getdate(nowdate()).year - 1 curr_year = getdate(nowdate()).year - 1
stdt = cstr(curr_year)+'-'+cstr(st[fy_start]) stdt = cstr(curr_year)+'-'+cstr(st[fy_start])
#eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0]))
if(fy_start == '1st Jan'): if(fy_start == '1st Jan'):
fy = cstr(getdate(nowdate()).year) fy = cstr(getdate(nowdate()).year)
abbr = cstr(fy)[-2:] abbr = cstr(fy)[-2:]

View File

@ -91,6 +91,19 @@ items = [
}, },
{ "doctype": "Sales Taxes and Charges Master" }, { "doctype": "Sales Taxes and Charges Master" },
{ "doctype": "Purchase Taxes and Charges Master" }, { "doctype": "Purchase Taxes and Charges Master" },
{
"type": "Section",
"title": "Opening Accounts and Stock",
"icon": "icon-eye-open"
},
{ "doctype": "Stock Reconciliation" },
{
"doctype": "Journal Voucher",
"title": "Opening Accounting Entries",
"filter": {
"is_opening": "Yes"
}
},
{ {
"type": "Section", "type": "Section",
"title": "Human Resource", "title": "Human Resource",
@ -148,19 +161,6 @@ items = [
{ {
"doctype": "Email Digest", "doctype": "Email Digest",
}, },
{
"type": "Section",
"title": "Opening Accounts and Stock",
"icon": "icon-eye-open"
},
{ "doctype": "Stock Reconciliation" },
{
"doctype": "Journal Voucher",
"title": "Opening Accounting Entries",
"filter": {
"is_opening": "Yes"
}
},
{ {
"type": "Section", "type": "Section",
"title": "Customization", "title": "Customization",
@ -244,8 +244,8 @@ def set_count(item):
elif "filter" in item: elif "filter" in item:
key = item["filter"].keys()[0] key = item["filter"].keys()[0]
item["count"] = webnotes.conn.sql("""select count(*) from `tab%s` where item["count"] = webnotes.conn.sql("""select count(*) from `tab%s` where
%s = %s""" % (item["doctype"], key, "%s"), %s = %s and docstatus < 2""" % (item["doctype"], key, "%s"),
item["filter"][key])[0][0] item["filter"][key])[0][0]
elif "doctype" in item: elif "doctype" in item:
item["count"] = webnotes.conn.sql("select count(*) from `tab%s`" \ item["count"] = webnotes.conn.sql("select count(*) from `tab%s` where docstatus<2" \
% item["doctype"])[0][0] % item["doctype"])[0][0]

View File

@ -25,6 +25,7 @@ from webnotes import msgprint, _
from webnotes.model.controller import DocListController from webnotes.model.controller import DocListController
class PriceListCurrencyMismatch(Exception): pass class PriceListCurrencyMismatch(Exception): pass
class WarehouseNotSet(Exception): pass
class DocType(DocListController): class DocType(DocListController):
def autoname(self): def autoname(self):
@ -40,6 +41,7 @@ class DocType(DocListController):
if not self.doc.stock_uom: if not self.doc.stock_uom:
msgprint(_("Please enter Default Unit of Measure"), raise_exception=1) msgprint(_("Please enter Default Unit of Measure"), raise_exception=1)
self.check_warehouse_is_set_for_stock_item()
self.check_stock_uom_with_bin() self.check_stock_uom_with_bin()
self.validate_conversion_factor() self.validate_conversion_factor()
self.add_default_uom_in_conversion_factor_table() self.add_default_uom_in_conversion_factor_table()
@ -60,6 +62,11 @@ class DocType(DocListController):
self.validate_name_with_item_group() self.validate_name_with_item_group()
self.update_website() self.update_website()
def check_warehouse_is_set_for_stock_item(self):
if self.doc.is_stock_item=="Yes" and not self.doc.default_warehouse:
webnotes.msgprint(_("Default Warehouse is mandatory for Stock Item."),
raise_exception=WarehouseNotSet)
def add_default_uom_in_conversion_factor_table(self): def add_default_uom_in_conversion_factor_table(self):
uom_conv_list = [d.uom for d in self.doclist.get({"parentfield": "uom_conversion_details"})] uom_conv_list = [d.uom for d in self.doclist.get({"parentfield": "uom_conversion_details"})]
if self.doc.stock_uom not in uom_conv_list: if self.doc.stock_uom not in uom_conv_list:

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-05-03 10:45:46", "creation": "2013-05-03 10:45:46",
"docstatus": 0, "docstatus": 0,
"modified": "2013-06-26 21:39:46", "modified": "2013-07-01 11:45:59",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -205,11 +205,11 @@
}, },
{ {
"depends_on": "eval:doc.is_stock_item==\"Yes\"", "depends_on": "eval:doc.is_stock_item==\"Yes\"",
"description": "Mandatory if Stock Item is \"Yes\"", "description": "Mandatory if Stock Item is \"Yes\". Also the default warehouse where reserved quantity is set from Sales Order.",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "default_warehouse", "fieldname": "default_warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Reserved Warehouse", "label": "Default Warehouse",
"oldfieldname": "default_warehouse", "oldfieldname": "default_warehouse",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Warehouse", "options": "Warehouse",

View File

@ -35,6 +35,13 @@ class TestItem(unittest.TestCase):
item_price = item.doclist.get({"doctype": "Item Price"})[0].ref_currency="USD" item_price = item.doclist.get({"doctype": "Item Price"})[0].ref_currency="USD"
self.assertRaises(PriceListCurrencyMismatch, item.insert) self.assertRaises(PriceListCurrencyMismatch, item.insert)
def test_default_warehouse(self):
from stock.doctype.item.item import WarehouseNotSet
item = webnotes.bean(copy=test_records[0])
item.doc.is_stock_item = "Yes"
item.doc.default_warehouse = None
self.assertRaises(WarehouseNotSet, item.insert)
test_records = [ test_records = [
[{ [{
@ -77,6 +84,7 @@ test_records = [
"item_name": "_Test Item Home Desktop 100", "item_name": "_Test Item Home Desktop 100",
"description": "_Test Item Home Desktop 100", "description": "_Test Item Home Desktop 100",
"item_group": "_Test Item Group Desktops", "item_group": "_Test Item Group Desktops",
"default_warehouse": "_Test Warehouse",
"is_stock_item": "Yes", "is_stock_item": "Yes",
"is_asset_item": "No", "is_asset_item": "No",
"has_batch_no": "No", "has_batch_no": "No",
@ -101,6 +109,7 @@ test_records = [
"item_name": "_Test Item Home Desktop 200", "item_name": "_Test Item Home Desktop 200",
"description": "_Test Item Home Desktop 200", "description": "_Test Item Home Desktop 200",
"item_group": "_Test Item Group Desktops", "item_group": "_Test Item Group Desktops",
"default_warehouse": "_Test Warehouse",
"is_stock_item": "Yes", "is_stock_item": "Yes",
"is_asset_item": "No", "is_asset_item": "No",
"has_batch_no": "No", "has_batch_no": "No",
@ -140,6 +149,7 @@ test_records = [
"description": "_Test FG Item", "description": "_Test FG Item",
"item_group": "_Test Item Group Desktops", "item_group": "_Test Item Group Desktops",
"is_stock_item": "Yes", "is_stock_item": "Yes",
"default_warehouse": "_Test Warehouse",
"is_asset_item": "No", "is_asset_item": "No",
"has_batch_no": "No", "has_batch_no": "No",
"has_serial_no": "No", "has_serial_no": "No",
@ -178,6 +188,7 @@ test_records = [
"description": "_Test Serialized Item", "description": "_Test Serialized Item",
"item_group": "_Test Item Group Desktops", "item_group": "_Test Item Group Desktops",
"is_stock_item": "Yes", "is_stock_item": "Yes",
"default_warehouse": "_Test Warehouse",
"is_asset_item": "No", "is_asset_item": "No",
"has_batch_no": "No", "has_batch_no": "No",
"has_serial_no": "Yes", "has_serial_no": "Yes",

View File

@ -121,8 +121,6 @@ class DocType(DocListController):
self.doc.posting_time = '00:00' self.doc.posting_time = '00:00'
def on_doctype_update(self): def on_doctype_update(self):
webnotes.msgprint(webnotes.conn.sql("""show index from `tabStock Ledger Entry`
where Key_name="posting_sort_index" """))
if not webnotes.conn.sql("""show index from `tabStock Ledger Entry` if not webnotes.conn.sql("""show index from `tabStock Ledger Entry`
where Key_name="posting_sort_index" """): where Key_name="posting_sort_index" """):
webnotes.conn.commit() webnotes.conn.commit()

View File

@ -48,8 +48,6 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
return { return {
"query": "accounts.utils.get_account_list", "query": "accounts.utils.get_account_list",
"filters": { "filters": {
"is_pl_account": "Yes",
"debit_or_credit": "Debit",
"company": me.frm.doc.company "company": me.frm.doc.company
} }
} }

View File

@ -4,6 +4,7 @@
wn.module_page["Stock"] = [ wn.module_page["Stock"] = [
{ {
title: wn._("Documents"), title: wn._("Documents"),
top: true,
icon: "icon-copy", icon: "icon-copy",
items: [ items: [
{ {

View File

@ -22,10 +22,7 @@ wn.pages['stock-ledger'].onload = function(wrapper) {
}); });
new erpnext.StockLedger(wrapper); new erpnext.StockLedger(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_icon("Stock") wrapper.appframe.add_module_icon("Stock")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
} }
wn.require("app/js/stock_grid_report.js"); wn.require("app/js/stock_grid_report.js");

View File

@ -3,7 +3,8 @@
wn.module_page["Support"] = [ wn.module_page["Support"] = [
{ {
title: wn._("Documents"), title: wn._("Top"),
top: true,
icon: "icon-copy", icon: "icon-copy",
items: [ items: [
{ {
@ -16,6 +17,13 @@ wn.module_page["Support"] = [
description: wn._("Customer Issue against Serial No."), description: wn._("Customer Issue against Serial No."),
doctype:"Customer Issue" doctype:"Customer Issue"
}, },
]
},
{
title: wn._("Documents"),
icon: "icon-copy",
items: [
{ {
label: wn._("Maintenance Schedule"), label: wn._("Maintenance Schedule"),
description: wn._("Plan for maintenance visits."), description: wn._("Plan for maintenance visits."),

View File

@ -27,13 +27,13 @@ class DocType:
def autoname(self): def autoname(self):
if not self.doc.address_title: if not self.doc.address_title:
self.doc.address_title = self.doc.customer or self.doc.supplier or self.doc.sales_partner or self.doc.lead self.doc.address_title = self.doc.customer \
or self.doc.supplier or self.doc.sales_partner or self.doc.lead
if self.doc.address_title: if self.doc.address_title:
self.doc.name = cstr(self.doc.address_title).strip() + "-" + cstr(self.doc.address_type).strip() self.doc.name = cstr(self.doc.address_title).strip() + "-" + cstr(self.doc.address_type).strip()
else: else:
webnotes.msgprint("""Address Title is mandatory.""", raise_exception=True) webnotes.msgprint("""Address Title is mandatory.""" + self.doc.customer, raise_exception=True)
def validate(self): def validate(self):
self.validate_primary_address() self.validate_primary_address()

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-10 16:34:32", "creation": "2013-01-10 16:34:32",
"docstatus": 0, "docstatus": 0,
"modified": "2013-06-28 17:06:32", "modified": "2013-07-01 15:56:39",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -59,7 +59,7 @@
"fieldname": "address_title", "fieldname": "address_title",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Address Title", "label": "Address Title",
"reqd": 1 "reqd": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",

View File

@ -5,6 +5,7 @@ wn.module_page["Website"] = [
{ {
title: wn._("Web Content"), title: wn._("Web Content"),
icon: "icon-copy", icon: "icon-copy",
top: true,
items: [ items: [
{ {
label: wn._("Web Page"), label: wn._("Web Page"),
@ -12,20 +13,20 @@ wn.module_page["Website"] = [
doctype:"Web Page" doctype:"Web Page"
}, },
{ {
label: wn._("Website Slideshow"), label: wn._("Blog Post"),
description: wn._("Embed image slideshows in website pages."), description: wn._("Single Post (article)."),
doctype:"Website Slideshow" doctype:"Blog Post"
}, },
] ]
}, },
{ {
title: wn._("Blog"), title: wn._("Documents"),
icon: "icon-edit", icon: "icon-edit",
items: [ items: [
{ {
label: wn._("Blog Post"), label: wn._("Website Slideshow"),
description: wn._("Single Post (article)."), description: wn._("Embed image slideshows in website pages."),
doctype:"Blog Post" doctype:"Website Slideshow"
}, },
{ {
label: wn._("Blogger"), label: wn._("Blogger"),