Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
8543469fba
@ -2,14 +2,14 @@
|
||||
{
|
||||
"creation": "2011-12-21 11:08:55",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-16 16:15:46",
|
||||
"modified": "2013-08-30 12:46:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doc_type": "Sales Invoice",
|
||||
"doctype": "Print Format",
|
||||
"html": "<html>\n<head>\n<!--Other charges function-->\n<script>\nvar make_row = function(title,val,bold){\nvar bstart = '<b>'; var bend = '</b>';\nreturn '<tr><td style=\"width:50%\">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'\n +'<td style=\"width:20%\">'+doc.currency+'</td>'\n +'<td style=\"width:30%;text-align:right\">'+(val?val:'0.00')+'</td>'\n +'</tr>'\n}\nvar make_row1 = function(title,val,bold){\n var bstart = '<b>'; var bend = '</b>';\n \n return '<tr style=\"font-family:courier new; line-height:150%\"><td style=\"width:50%\">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'\n +'<td style=\"width:50%;text-align:right\">'+(bold?bstart:'')+(val?val:'0.00')+(bold?bend:'')+'</td>'\n +'</tr>'\n}\n\nfunction get_letter_head() {\n // add letter head\n var cp = wn.boot.control_panel;\n if(doc.letter_head)\n var lh= cstr(_p.letter_heads[doc.letter_head]);\n else if(cp.letter_head)\n var lh= cp.letter_head;\n else \n var lh= '';\n \n return lh;\n}\n\nfunction get_tax_details(){\n var cl = getchildren('Sales Taxes and Charges',doc.name,'other_charges');\n var out = '';\n\n out += '<div><table style=\"float: right;\">';\n for(var i=0;i<cl.length;i++){\n if(cl[i].tax_amount) {\n out += make_row1(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);\n }\n }\n out += make_row1('TOTAL',doc.currency + \" \" + fmt_money(convert_rate(doc.grand_total)),1);\n out +='</table></div>';\n return out;\n}\n\nfunction convert_rate(val){ \n var new_val = flt(val)/flt(doc.conversion_rate);\n return new_val;\n}\n</script>\n<style>\n table, td, tr, div, span {\n font-family: courier new;\n line-height: 200%;\n }\n</style>\n</head>\n\n<body>\n<table width=\"100%\" style=\"font-family: courier new; line-height:200%\">\n<tr>\n <td align=\"left\">NO: <script>doc.name</script></td>\n <td align=\"right\">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n</tr>\n<tr>\n <td>M/s <script>doc.contact_display</script></td>\n</tr>\n</table>\n<!--Item Table-->\n<div>\n<script>\nvar t = print_table(\n \t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'description', 'qty', 'export_rate', 'export_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Description', 'Qty', 'Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'5%', '35%', '20%', '20%', '20%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t);\nif(t.appendChild) { // single\n out = t.innerHTML.replace(/style=\"/gi,'style=\"font-family:courier new;line-height:150%;');\n} else { //multiple\n out = '<table class=\"None\" border=\"0px\" width=\"100%\" style=\"border:0px; font-family:courier-new\">';\n\n for(var i=0;i<t.length;i++) {\n if(i==0) {\n out += '<tr>' + t[i].childNodes[0].childNodes[0].childNodes[0].innerHTML\n .replace(/style=\"border: 1px solid rgb\\(0, 0, 0\\);/gi,'style=\"font-family:courier new;')\n + '</tr>';\n }\n out += '<tr>' + t[i].childNodes[0].childNodes[0].childNodes[1].innerHTML\n .replace(/style=\"border: 1px solid rgb\\(0, 0, 0\\);/gi,'style=\"font-family:courier new;')\n + '</tr>';\n }\n out += '</table>';\n}\nout;\n</script>\n</div>\n<!--Tax table-->\n<div><script>get_tax_details();</script></div><br />\n<table style=\"font-family:courier new;\">\n <tr><td><b><script>doc.terms</script></b></td></tr>\n <tr><td nowrap><b>For <script>doc.company</script></b></td></tr>\n <tr><td> </td></tr>\n <tr><td nowrap><b>Signatory</b></td></tr>\n</table>\n</body>\n</html>\n",
|
||||
"html": "<html>\n<head>\n<!--Item Table, Totals and Other Charges-->\n<script>\nfunction get_print_format() {\n\tvar oc = getchildren('Sales Invoice Item', doc.name, 'entries');\n\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">\\\n <tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>\\\n <tr>\\\n <td width=\"60%\" align=\"left\">ITEM CODE/DESC.</td>\\\n <td width=\"10%\" align=\"right\">QTY</td>\\\n <td width=\"30%\" align=\"right\">RATE</td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>';\n\tfor (var x=0; x<oc.length; x++) {\n\t\trows += '<tr>\\\n <td align=\"left\">' + oc[x].item_code + '<br>' + oc[x].item_name + '</td>\\\n <td align=\"right\" style=\"vertical-align:top;\">' + oc[x].qty + '</td>\\\n <td align=\"right\" valign=\"top\">' + format_currency(oc[x].export_amount) + '</td>\\\n </tr>';\n\t}\n rows += '<tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"2\" align=\"right\">Net Total</td>\\\n <td align=\"right\">' + format_currency(doc.net_total_export) + '</td>\\\n </tr>';\n if (doc.other_charges_total_export != 0) {\n var taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t$.each(taxes, function(i, d) {\n\t\t\trows += '<tr>\\\n \t\t\t\t<td colspan=\"2\" align=\"right\">' + d.description + '</td>\\\n \t\t\t\t<td style=\"text-align: right;\">' + format_currency(d.tax_amount) + '</td>\\\n \t\t\t<tr>';\n\t\t});\n }\n rows += '<tr>\\\n <td colspan=\"2\" align=\"right\" style=\"vertical-align:middle;\">Grand Total</td>\\\n <td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export) + '<br>\\\n <hr width=\"90%\" align=\"right\"></td>\\\n </tr>\\\n <tr>\\\n <td align=\"center\" colspan=\"3\">Thank You. Please visit again.</td>\\\n </tr>\\\n </table>';\n\treturn rows;\n}\n</script>\n<style>\n table, tr, td, div, p {\n font-family: Monospace;\n line-height: 200%;\n }\n h1, h2, h3, h4, h5, h6 {\n text-align: center;\n }\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 4in;\n\t\t}\n\t}\n</style>\n</head>\n\n<body>\n<table width=\"100%\" cellpadding=\"4\">\n <tr>\n <td align=\"left\">RECEIPT NO: <script>doc.name</script></td>\n <td align=\"right\">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n </tr>\n <tr>\n <td>M/s <script>doc.customer</script></td>\n </tr>\n</table>\n<!--Item Table & Totals-->\n<div><script>get_print_format();</script></div>\n</body>\n</html>\n",
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"print_format_type": "Client",
|
||||
|
@ -49,15 +49,9 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------ Get Print Heading ------------------------------------
|
||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:[
|
||||
['Print Heading', 'docstatus', '!=', 2]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// Expense Account
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict["expense_account"].get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
@ -69,6 +63,16 @@ cur_frm.fields_dict["expense_account"].get_query = function(doc) {
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------ Get Print Heading ------------------------------------
|
||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:[
|
||||
['Print Heading', 'docstatus', '!=', 2]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
|
||||
return{ query:"core.doctype.profile.profile.profile_query"}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ from webnotes import msgprint, _
|
||||
from webnotes.utils import cint
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
def __init__(self,doc,doclist):
|
||||
self.doc, self.doclist = doc,doclist
|
||||
|
||||
def get_series(self):
|
||||
@ -20,6 +20,7 @@ class DocType:
|
||||
def validate(self):
|
||||
self.check_for_duplicate()
|
||||
self.validate_expense_account()
|
||||
self.validate_all_link_fields()
|
||||
|
||||
def check_for_duplicate(self):
|
||||
res = webnotes.conn.sql("""select name, user from `tabPOS Setting`
|
||||
@ -37,3 +38,25 @@ class DocType:
|
||||
if cint(webnotes.defaults.get_global_default("auto_inventory_accounting")) \
|
||||
and not self.doc.expense_account:
|
||||
msgprint(_("Expense Account is mandatory"), raise_exception=1)
|
||||
|
||||
def validate_all_link_fields(self):
|
||||
accounts = {"Account": [self.doc.cash_bank_account, self.doc.income_account, self.doc.expense_account], \
|
||||
"Cost Center": [self.doc.cost_center], "Warehouse": [self.doc.warehouse]}
|
||||
|
||||
for link_dt, dn_list in accounts.items():
|
||||
for link_dn in dn_list:
|
||||
if not webnotes.conn.exists({"doctype": link_dt, "company": self.doc.company, "name": link_dn}):
|
||||
msgprint(link_dn +_(" does not belong to ") + self.doc.company)
|
||||
|
||||
def on_update(self):
|
||||
webnotes.defaults.clear_default("is_pos")
|
||||
|
||||
pos_view_users = webnotes.conn.sql_list("""select user from `tabPOS Setting`""")
|
||||
for user in pos_view_users:
|
||||
if user:
|
||||
webnotes.defaults.set_user_default("is_pos", 1, user)
|
||||
else:
|
||||
webnotes.defaults.set_global_default("is_pos", 1)
|
||||
|
||||
def on_trash(self):
|
||||
self.on_update()
|
@ -160,8 +160,10 @@ erpnext.POS = Class.extend({
|
||||
parent: this.wrapper.find(".barcode-area")
|
||||
});
|
||||
this.barcode.make_input();
|
||||
this.barcode.$input.on("change", function() {
|
||||
me.add_item_thru_barcode();
|
||||
this.barcode.$input.on("keypress", function() {
|
||||
if(me.barcode_timeout)
|
||||
clearTimeout(me.barcode_timeout);
|
||||
me.barcode_timeout = setTimeout(function() { me.add_item_thru_barcode(); }, 1000);
|
||||
});
|
||||
},
|
||||
make_item_list: function() {
|
||||
@ -178,12 +180,13 @@ erpnext.POS = Class.extend({
|
||||
me.wrapper.find(".item-list").empty();
|
||||
$.each(r.message, function(index, obj) {
|
||||
if (obj.image)
|
||||
image = "<img src='" + obj.image + "' class='img-responsive'>";
|
||||
image = '<img src="' + obj.image + '" class="img-responsive" \
|
||||
style="border:1px solid #eee;height:140px;width:100%;">';
|
||||
else
|
||||
image = '<div class="missing-image"><i class="icon-camera"></i></div>';
|
||||
|
||||
$(repl('<div class="col-xs-3 pos-item" data-item_code="%(item_code)s">\
|
||||
%(item_image)s\
|
||||
<div>%(item_image)s</div>\
|
||||
<div class="small">%(item_code)s</div>\
|
||||
<div class="small">%(item_name)s</div>\
|
||||
<div class="small">%(item_price)s</div>\
|
||||
@ -196,6 +199,8 @@ erpnext.POS = Class.extend({
|
||||
})).appendTo($wrap);
|
||||
});
|
||||
|
||||
// if form is local then allow this function
|
||||
if (cur_frm.doc.docstatus===0) {
|
||||
$("div.pos-item").on("click", function() {
|
||||
if(!cur_frm.doc.customer) {
|
||||
msgprint("Please select customer first.");
|
||||
@ -204,6 +209,7 @@ erpnext.POS = Class.extend({
|
||||
me.add_to_cart($(this).attr("data-item_code"));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
add_to_cart: function(item_code) {
|
||||
@ -230,22 +236,25 @@ erpnext.POS = Class.extend({
|
||||
var child = wn.model.add_child(me.frm.doc, "Sales Invoice Item", "entries");
|
||||
child.item_code = item_code;
|
||||
me.frm.cscript.item_code(me.frm.doc, child.doctype, child.name);
|
||||
//me.refresh();
|
||||
}
|
||||
},
|
||||
update_qty: function(item_code, qty) {
|
||||
update_qty: function(item_code, qty, textbox_qty) {
|
||||
var me = this;
|
||||
$.each(wn.model.get_children("Sales Invoice Item", this.frm.doc.name, "entries",
|
||||
"Sales Invoice"), function(i, d) {
|
||||
if (d.item_code == item_code) {
|
||||
if (qty == 1)
|
||||
d.qty += 1;
|
||||
else
|
||||
if (textbox_qty) {
|
||||
if (qty == 0 && d.item_code == item_code)
|
||||
wn.model.clear_doc(d.doctype, d.name);
|
||||
d.qty = qty;
|
||||
}
|
||||
else
|
||||
d.qty += 1;
|
||||
|
||||
me.frm.cscript.qty(me.frm.doc, d.doctype, d.name);
|
||||
}
|
||||
});
|
||||
me.frm.dirty();
|
||||
me.refresh();
|
||||
},
|
||||
refresh: function() {
|
||||
@ -262,7 +271,7 @@ erpnext.POS = Class.extend({
|
||||
<td>%(item_code)s%(item_name)s</td>\
|
||||
<td><input type="text" value="%(qty)s" \
|
||||
class="form-control qty" style="text-align: right;"></td>\
|
||||
<td style="text-align: right;">%(rate)s<br><b>%(amount)s</b></td>\
|
||||
<td style="text-align: right;"><b>%(amount)s</b><br>%(rate)s</td>\
|
||||
</tr>',
|
||||
{
|
||||
item_code: d.item_code,
|
||||
@ -283,10 +292,11 @@ erpnext.POS = Class.extend({
|
||||
|
||||
$.each(taxes, function(i, d) {
|
||||
$(repl('<tr>\
|
||||
<td>%(description)s</td>\
|
||||
<td>%(description)s (%(rate)s%)</td>\
|
||||
<td style="text-align: right;">%(tax_amount)s</td>\
|
||||
<tr>', {
|
||||
description: d.description,
|
||||
rate: d.rate,
|
||||
tax_amount: format_currency(d.tax_amount, me.frm.doc.price_list_currency)
|
||||
})).appendTo(".tax-table tbody");
|
||||
});
|
||||
@ -297,14 +307,20 @@ erpnext.POS = Class.extend({
|
||||
this.wrapper.find(".grand-total").text(format_currency(this.frm.doc.grand_total_export,
|
||||
cur_frm.doc.price_list_currency));
|
||||
|
||||
// if form is local then only run all these functions
|
||||
if (cur_frm.doc.docstatus===0) {
|
||||
$("input.qty").on("focus", function() {
|
||||
$(this).select();
|
||||
});
|
||||
|
||||
// append quantity to the respective item after change from input box
|
||||
$("input.qty").on("change", function() {
|
||||
var item_code = $(this).closest("tr")[0].id;
|
||||
me.update_qty(item_code, $(this).val());
|
||||
me.update_qty(item_code, $(this).val(), true);
|
||||
});
|
||||
|
||||
// on td click highlight the respective row
|
||||
$("td").on("click", function() {
|
||||
// on td click toggle the highlighting of row
|
||||
$("#cart tbody tr td").on("click", function() {
|
||||
var row = $(this).closest("tr");
|
||||
if (row.attr("data-selected") == "false") {
|
||||
row.attr("class", "warning");
|
||||
@ -319,22 +335,35 @@ erpnext.POS = Class.extend({
|
||||
});
|
||||
|
||||
me.refresh_delete_btn();
|
||||
cur_frm.pos.barcode.$input.focus();
|
||||
}
|
||||
|
||||
// if form is submitted & cancelled then disable all input box & buttons
|
||||
if (cur_frm.doc.docstatus>=1) {
|
||||
me.wrapper.find('input, button').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
$(".delete-items").hide();
|
||||
$(".make-payment").hide();
|
||||
}
|
||||
},
|
||||
refresh_delete_btn: function() {
|
||||
$(".delete-items").toggle($(".item-cart .warning").length ? true : false);
|
||||
},
|
||||
add_item_thru_barcode: function() {
|
||||
var me = this;
|
||||
me.barcode_timeout = null;
|
||||
wn.call({
|
||||
method: 'accounts.doctype.sales_invoice.pos.get_item_from_barcode',
|
||||
args: {barcode: this.barcode.$input.val()},
|
||||
callback: function(r) {
|
||||
if (r.message) {
|
||||
me.add_to_cart(r.message[0].name);
|
||||
me.refresh();
|
||||
}
|
||||
else
|
||||
msgprint(wn._("Invalid Barcode"));
|
||||
|
||||
me.refresh();
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -349,19 +378,19 @@ erpnext.POS = Class.extend({
|
||||
}
|
||||
}
|
||||
|
||||
if (!selected_items[0])
|
||||
msgprint(wn._("Please select any item to remove it"));
|
||||
|
||||
var child = wn.model.get_children("Sales Invoice Item", this.frm.doc.name, "entries",
|
||||
"Sales Invoice");
|
||||
$.each(child, function(i, d) {
|
||||
for (var i in selected_items) {
|
||||
if (d.item_code == selected_items[i]) {
|
||||
// cur_frm.fields_dict["entries"].grid.grid_rows[d.idx].remove();
|
||||
wn.model.clear_doc(d.doctype, d.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
cur_frm.fields_dict["entries"].grid.refresh();
|
||||
cur_frm.script_manager.trigger("calculate_taxes_and_totals");
|
||||
me.frm.dirty();
|
||||
me.refresh();
|
||||
},
|
||||
make_payment: function() {
|
||||
@ -394,12 +423,14 @@ erpnext.POS = Class.extend({
|
||||
"total_amount": $(".grand-total").text()
|
||||
});
|
||||
dialog.show();
|
||||
cur_frm.pos.barcode.$input.focus();
|
||||
|
||||
dialog.get_input("total_amount").prop("disabled", true);
|
||||
|
||||
dialog.fields_dict.pay.input.onclick = function() {
|
||||
cur_frm.set_value("mode_of_payment", dialog.get_values().mode_of_payment);
|
||||
cur_frm.set_value("paid_amount", dialog.get_values().total_amount);
|
||||
cur_frm.cscript.mode_of_payment(cur_frm.doc);
|
||||
cur_frm.save();
|
||||
dialog.hide();
|
||||
me.refresh();
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import msgprint
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_items(price_list, item=None, item_group=None):
|
||||
|
@ -26,7 +26,18 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
}
|
||||
}
|
||||
|
||||
// toggle to pos view if is_pos is 1 in user_defaults
|
||||
if (cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos) {
|
||||
this.frm.set_value("is_pos", 1);
|
||||
this.is_pos();
|
||||
cur_frm.cscript.toggle_pos(true);
|
||||
}
|
||||
|
||||
// if document is POS then change default print format to "POS Invoice"
|
||||
if(cur_frm.doc.is_pos && cur_frm.doc.docstatus===1) {
|
||||
locals.DocType[cur_frm.doctype].default_print_format = "POS Invoice";
|
||||
cur_frm.setup_print();
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function(doc, dt, dn) {
|
||||
@ -90,16 +101,11 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Show POS button only if it enabled from features setup
|
||||
if(cint(sys_defaults.fs_pos_view)===1)
|
||||
cur_frm.cscript.pos_btn();
|
||||
|
||||
// setTimeout(function() { cur_frm.$pos_btn.click(); }, 1000);
|
||||
|
||||
} else {
|
||||
// hide shown pos for submitted records
|
||||
if(cur_frm.pos_active) cur_frm.cscript.toggle_pos(false);
|
||||
}
|
||||
},
|
||||
|
||||
pos_btn: function() {
|
||||
@ -118,13 +124,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
cur_frm.cscript.toggle_pos();
|
||||
cur_frm.cscript.pos_btn();
|
||||
}, icon);
|
||||
|
||||
},
|
||||
|
||||
toggle_pos: function(show) {
|
||||
if(cint(sys_defaults.fs_pos_view)===0) return;
|
||||
if(!(this.frm.doc.is_pos && this.frm.doc.docstatus===0)) return;
|
||||
|
||||
if (!this.frm.doc.selling_price_list)
|
||||
msgprint(wn._("Please select Price List"))
|
||||
else {
|
||||
|
@ -2,13 +2,14 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:05",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-31 10:19:01",
|
||||
"modified": "2013-09-01 05:26:13",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_attach": 1,
|
||||
"autoname": "naming_series:",
|
||||
"default_print_format": "Standard",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Transaction",
|
||||
"icon": "icon-file-text",
|
||||
|
@ -257,6 +257,8 @@ patch_list = [
|
||||
"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-08-16",
|
||||
"patches.august_2013.p06_fix_sle_against_stock_entry",
|
||||
"execute:webnotes.bean('Style Settings').save() #2013-08-20",
|
||||
"patches.september_2013.p01_add_user_defaults_from_pos_setting",
|
||||
"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-09-02",
|
||||
"patches.september_2013.p01_fix_buying_amount_gl_entries",
|
||||
"patches.september_2013.p01_update_communication",
|
||||
"patches.september_2013.p02_fix_serial_no_status",
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
pos_view_users = webnotes.conn.sql_list("""select user from `tabPOS Setting`""")
|
||||
for user in pos_view_users:
|
||||
if user:
|
||||
webnotes.defaults.set_user_default("is_pos", 1, user)
|
||||
else:
|
||||
webnotes.defaults.set_global_default("is_pos", 1)
|
@ -36,8 +36,6 @@ cur_frm.cscript.abbr = function(doc){
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.default_cash_account.get_query = cur_frm.fields_dict.default_bank_account.get_query;
|
||||
|
||||
cur_frm.fields_dict.default_bank_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
@ -48,7 +46,7 @@ cur_frm.fields_dict.default_bank_account.get_query = function(doc) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.payables_group.get_query = cur_frm.fields_dict.receivables_group.get_query;
|
||||
cur_frm.fields_dict.default_cash_account.get_query = cur_frm.fields_dict.default_bank_account.get_query;
|
||||
|
||||
cur_frm.fields_dict.receivables_group.get_query = function(doc) {
|
||||
return{
|
||||
@ -59,6 +57,39 @@ cur_frm.fields_dict.receivables_group.get_query = function(doc) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.payables_group.get_query = cur_frm.fields_dict.receivables_group.get_query;
|
||||
|
||||
cur_frm.fields_dict.default_expense_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.name,
|
||||
'group_or_ledger': "Ledger",
|
||||
'is_pl_account': "Yes",
|
||||
'debit_or_credit': "Debit"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.default_income_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.name,
|
||||
'group_or_ledger': "Ledger",
|
||||
'is_pl_account': "Yes",
|
||||
'debit_or_credit': "Credit"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.cost_center.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.name,
|
||||
'group_or_ledger': "Ledger",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sys_defaults.auto_inventory_accounting) {
|
||||
cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) {
|
||||
return {
|
||||
|
@ -48,7 +48,8 @@ class DocType:
|
||||
self.create_default_warehouses()
|
||||
self.create_default_web_page()
|
||||
|
||||
if not self.doc.cost_center:
|
||||
if not webnotes.conn.get_value("Cost Center", {"group_or_ledger": "Ledger",
|
||||
"company": self.doc.name}):
|
||||
self.create_default_cost_center()
|
||||
|
||||
self.set_default_accounts()
|
||||
|
Loading…
x
Reference in New Issue
Block a user