mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-04 22:18:27 +00:00
[fixes] buying/selling price lists, communication and website settings
This commit is contained in:
@@ -21,6 +21,7 @@ cur_frm.cscript.onload = function() {
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.set_intro("");
|
||||
if(doc.__islocal) {
|
||||
cur_frm.toggle_display("item_prices_section", false);
|
||||
cur_frm.set_intro("Save this list to begin.");
|
||||
return;
|
||||
} else {
|
||||
@@ -41,16 +42,12 @@ cur_frm.cscript.show_item_prices = function() {
|
||||
<thead><tr>\
|
||||
<th>' + wn._("Item Code") + '</th>\
|
||||
<th>' + wn._("Price") + '</th>\
|
||||
<th>' + wn._("Valid For Selling") + '</th>\
|
||||
<th>' + wn._("Valid For Buying") + '</th>\
|
||||
</tr></thead>\
|
||||
<tbody>'
|
||||
+ $.map(item_price.sort(function(a, b) { return a.parent.localeCompare(b.parent); }), function(d) {
|
||||
return '<tr>'
|
||||
+ '<td>' + d.parent + '</td>'
|
||||
+ '<td><a href="#Form/Item/' + encodeURIComponent(d.parent) +'">' + d.parent + '</a></td>'
|
||||
+ '<td style="text-align: right;">' + format_currency(d.ref_rate, d.ref_currency) + '</td>'
|
||||
+ '<td>' + (cint(d.selling) ? '<i class="icon-check"></i>' : "") + '</td>'
|
||||
+ '<td>' + (cint(d.buying) ? '<i class="icon-check"></i>' : "") + '</td>'
|
||||
+ '</tr>'
|
||||
}).join("\n")
|
||||
+ '</tbody>\
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.utils import cint
|
||||
from webnotes.utils import cint, comma_or
|
||||
|
||||
|
||||
class DocType:
|
||||
@@ -32,6 +32,10 @@ class DocType:
|
||||
if not (cint(self.doc.valid_for_all_countries) or len(self.doclist.get({"parentfield": "valid_for_countries"}))):
|
||||
msgprint(_("""Please check "Valid For All Countries" or \
|
||||
enter atlease one row in the "Countries" table."""), raise_exception=True)
|
||||
|
||||
if self.doc.buying_or_selling not in ["Buying", "Selling"]:
|
||||
msgprint(_(self.meta.get_label("buying_or_selling")) + " " + _("must be one of") + " " +
|
||||
comma_or(["Buying", "Selling"]), raise_exception=True)
|
||||
|
||||
def on_trash(self):
|
||||
webnotes.conn.sql("""delete from `tabItem Price` where price_list_name = %s""",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-25 11:35:09",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-02 14:45:00",
|
||||
"modified": "2013-06-11 20:00:07",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -60,6 +60,26 @@
|
||||
"options": "Currency",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "Selling",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "buying_or_selling",
|
||||
"fieldtype": "Select",
|
||||
"label": "Valid for Buying or Selling?",
|
||||
"options": "Buying\nSelling",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "use_for_website",
|
||||
"fieldtype": "Check",
|
||||
"label": "Use for Website"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"doctype": "DocField",
|
||||
@@ -68,7 +88,7 @@
|
||||
"label": "Valid for all countries"
|
||||
},
|
||||
{
|
||||
"description": "A list of Countries, for which, this Price List is valid",
|
||||
"description": "Or specify a list of Countries, for which, this Price List is valid",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "valid_for_countries",
|
||||
"fieldtype": "Table",
|
||||
@@ -79,6 +99,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_prices_section",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"label": "Item Prices"
|
||||
},
|
||||
{
|
||||
@@ -87,6 +108,11 @@
|
||||
"fieldtype": "HTML",
|
||||
"label": "Item Prices"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_10",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.__islocal",
|
||||
"doctype": "DocField",
|
||||
|
||||
@@ -34,16 +34,16 @@ def get_price_list_currency(args):
|
||||
"""
|
||||
args = {
|
||||
"price_list_name": "Something",
|
||||
"use_for": "buying" or "selling"
|
||||
"buying_or_selling": "Buying" or "Selling"
|
||||
}
|
||||
"""
|
||||
if isinstance(args, basestring):
|
||||
args = json.loads(args)
|
||||
|
||||
result = webnotes.conn.sql("""select distinct ref_currency from `tabItem Price`
|
||||
where price_list_name=%s and `%s`=1""" % ("%s", args.get("use_for")),
|
||||
where price_list_name=%s and buying_or_selling=%s""" % ("%s", args.get("buying_or_selling")),
|
||||
(args.get("price_list_name"),))
|
||||
if result and len(result)==1:
|
||||
return {"price_list_currency": result[0][0]}
|
||||
else:
|
||||
return {}
|
||||
return {}
|
||||
Reference in New Issue
Block a user