mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +00:00
Merge branch 'akhileshdarjee-master' into website-wip
This commit is contained in:
@@ -79,6 +79,10 @@ cur_frm.cscript.refresh = function(doc) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.company = function(doc, cdt, cdn) {
|
||||
cur_frm.refresh_fields();
|
||||
}
|
||||
|
||||
cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
|
||||
hide_field('aging_date');
|
||||
if (doc.is_opening == 'Yes') unhide_field('aging_date');
|
||||
|
||||
@@ -178,7 +178,7 @@ class DocType(AccountsController):
|
||||
if account_type == 'Bank or Cash':
|
||||
company_currency = get_company_currency(self.doc.company)
|
||||
amt = flt(d.debit) and d.debit or d.credit
|
||||
self.doc.total_amount = company_currency +' '+ cstr(amt)
|
||||
self.doc.total_amount = company_currency + ' ' + cstr(amt)
|
||||
from webnotes.utils import money_in_words
|
||||
self.doc.total_amount_in_words = money_in_words(amt, company_currency)
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ erpnext.POS = Class.extend({
|
||||
</div>',
|
||||
{
|
||||
item_code: obj.name,
|
||||
item_price: format_currency(obj.ref_rate, obj.ref_currency),
|
||||
item_price: format_currency(obj.ref_rate, obj.currency),
|
||||
item_name: obj.name===obj.item_name ? "" : obj.item_name,
|
||||
item_image: image
|
||||
})).appendTo($wrap);
|
||||
|
||||
@@ -15,11 +15,14 @@ def get_items(price_list, item=None, item_group=None):
|
||||
if item:
|
||||
condition = "and i.name='%s'" % item
|
||||
|
||||
return webnotes.conn.sql("""select
|
||||
i.name, i.item_name, i.image, ip.ref_rate, ip.ref_currency
|
||||
from `tabItem` i LEFT JOIN `tabItem Price` ip
|
||||
ON ip.parent=i.name
|
||||
and ip.price_list=%s
|
||||
return webnotes.conn.sql("""select i.name, i.item_name, i.image,
|
||||
pl_items.ref_rate, pl_items.currency
|
||||
from `tabItem` i LEFT JOIN
|
||||
(select ip.item_code, ip.ref_rate, pl.currency from
|
||||
`tabItem Price` ip, `tabPrice List` pl
|
||||
where ip.parent=%s and ip.parent = pl.name) pl_items
|
||||
ON
|
||||
pl_items.item_code=i.name
|
||||
where
|
||||
i.is_sales_item='Yes'%s""" % ('%s', condition), (price_list), as_dict=1)
|
||||
|
||||
|
||||
@@ -73,45 +73,14 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
if(!from_delivery_note)
|
||||
cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
|
||||
}
|
||||
|
||||
|
||||
if(doc.outstanding_amount!=0)
|
||||
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
|
||||
}
|
||||
|
||||
if (doc.docstatus===0) {
|
||||
cur_frm.add_custom_button(wn._('From Sales Order'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "selling.doctype.sales_order.sales_order.make_sales_invoice",
|
||||
source_doctype: "Sales Order",
|
||||
get_query_filters: {
|
||||
docstatus: 1,
|
||||
status: ["!=", "Stopped"],
|
||||
per_billed: ["<", 99.99],
|
||||
customer: cur_frm.doc.customer || undefined,
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
cur_frm.add_custom_button(wn._('From Delivery Note'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
||||
source_doctype: "Delivery Note",
|
||||
get_query: function() {
|
||||
var filters = {
|
||||
company: cur_frm.doc.company
|
||||
};
|
||||
if(cur_frm.doc.customer) filters["customer"] = cur_frm.doc.customer;
|
||||
return {
|
||||
query: "controllers.queries.get_delivery_notes_to_be_billed",
|
||||
filters: filters
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
cur_frm.cscript.sales_order_btn();
|
||||
cur_frm.cscript.delivery_note_btn();
|
||||
}
|
||||
|
||||
// Show POS button only if it enabled from features setup
|
||||
@@ -119,6 +88,43 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
cur_frm.cscript.pos_btn();
|
||||
},
|
||||
|
||||
sales_order_btn: function() {
|
||||
this.$sales_order_btn = cur_frm.add_custom_button(wn._('From Sales Order'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "selling.doctype.sales_order.sales_order.make_sales_invoice",
|
||||
source_doctype: "Sales Order",
|
||||
get_query_filters: {
|
||||
docstatus: 1,
|
||||
status: ["!=", "Stopped"],
|
||||
per_billed: ["<", 99.99],
|
||||
customer: cur_frm.doc.customer || undefined,
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
delivery_note_btn: function() {
|
||||
this.$delivery_note_btn = cur_frm.add_custom_button(wn._('From Delivery Note'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
||||
source_doctype: "Delivery Note",
|
||||
get_query: function() {
|
||||
var filters = {
|
||||
company: cur_frm.doc.company
|
||||
};
|
||||
if(cur_frm.doc.customer) filters["customer"] = cur_frm.doc.customer;
|
||||
return {
|
||||
query: "controllers.queries.get_delivery_notes_to_be_billed",
|
||||
filters: filters
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
pos_btn: function() {
|
||||
if(cur_frm.$pos_btn)
|
||||
cur_frm.$pos_btn.remove();
|
||||
@@ -126,9 +132,17 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
if(!cur_frm.pos_active) {
|
||||
var btn_label = wn._("POS View"),
|
||||
icon = "icon-desktop";
|
||||
|
||||
cur_frm.cscript.sales_order_btn();
|
||||
cur_frm.cscript.delivery_note_btn();
|
||||
} else {
|
||||
var btn_label = wn._("Invoice View"),
|
||||
icon = "icon-file-text";
|
||||
|
||||
if (cur_frm.doc.docstatus===0) {
|
||||
this.$delivery_note_btn.remove();
|
||||
this.$sales_order_btn.remove();
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.$pos_btn = cur_frm.add_custom_button(btn_label, function() {
|
||||
|
||||
Reference in New Issue
Block a user