Merge branch 'develop'

This commit is contained in:
Pratik Vyas 2014-01-20 19:21:25 +05:30
commit f0307dc75e
17 changed files with 93 additions and 41 deletions

View File

@ -530,6 +530,7 @@ erpnext.POS = Class.extend({
else if (operation == "decrease-qty") else if (operation == "decrease-qty")
d.qty != 1 ? d.qty -= 1 : d.qty = 1; d.qty != 1 ? d.qty -= 1 : d.qty = 1;
me.frm.script_manager.trigger("qty", d.doctype, d.name);
me.refresh(); me.refresh();
} }
}); });

View File

@ -34,7 +34,7 @@ def validate_filters(filters, account_details):
def get_columns(): def get_columns():
return ["Posting Date:Date:100", "Account:Link/Account:200", "Debit:Float:100", return ["Posting Date:Date:100", "Account:Link/Account:200", "Debit:Float:100",
"Credit:Float:100", "Voucher Type::120", "Voucher No::160", "Link::20", "Credit:Float:100", "Voucher Type::120", "Voucher No::160", "Link::20",
"Against Account::120", "Cost Center:Link/Cost Center:100", "Remarks::200"] "Against Account::120", "Cost Center:Link/Cost Center:100", "Remarks::400"]
def get_result(filters, account_details): def get_result(filters, account_details):
gl_entries = get_gl_entries(filters) gl_entries = get_gl_entries(filters)

View File

@ -3,7 +3,7 @@
wn.require('app/setup/doctype/contact_control/contact_control.js'); wn.require('app/setup/doctype/contact_control/contact_control.js');
cur_frm.cscript.refresh = function(doc,dt,dn) { cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.cscript.make_dashboard(doc); cur_frm.cscript.make_dashboard(doc);
erpnext.hide_naming_series(); erpnext.hide_naming_series();
@ -93,7 +93,7 @@ cur_frm.cscript.make_contact = function() {
cur_frm.contact_list.run(); cur_frm.contact_list.run();
} }
cur_frm.fields_dict['default_price_list'].get_query = function(doc,cdt,cdn) { cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
return{ return{
filters:{'buying': 1} filters:{'buying': 1}
} }

View File

@ -89,8 +89,10 @@ def _get_price_list_rate(args, item_bean, meta):
# try fetching from price list # try fetching from price list
if args.buying_price_list and args.price_list_currency: if args.buying_price_list and args.price_list_currency:
price_list_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price` price_list_rate = webnotes.conn.sql("""select ip.ref_rate from
where price_list=%s and item_code=%s and buying=1""", `tabItem Price` ip, `tabPrice List` pl
where ip.price_list=pl.name and ip.price_list=%s and
ip.item_code=%s and ip.buying=1 and pl.enabled=1""",
(args.buying_price_list, args.item_code), as_dict=1) (args.buying_price_list, args.item_code), as_dict=1)
if price_list_rate: if price_list_rate:

View File

@ -1,6 +1,6 @@
{ {
"app_name": "ERPNext", "app_name": "ERPNext",
"app_version": "3.6.3", "app_version": "3.6.4",
"base_template": "app/portal/templates/base.html", "base_template": "app/portal/templates/base.html",
"modules": { "modules": {
"Accounts": { "Accounts": {
@ -74,5 +74,5 @@
"type": "module" "type": "module"
} }
}, },
"requires_framework_version": "==3.7.3" "requires_framework_version": "==3.7.4"
} }

View File

@ -0,0 +1,9 @@
# Copyright (c) 2014, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("stock", "doctype", "price_list")
webnotes.conn.sql("""update `tabPrice List` set enabled=1""")

View File

@ -266,4 +266,5 @@ patch_list = [
"patches.1401.p01_move_related_property_setters_to_custom_field", "patches.1401.p01_move_related_property_setters_to_custom_field",
"patches.1401.p01_make_buying_selling_as_check_box_in_price_list", "patches.1401.p01_make_buying_selling_as_check_box_in_price_list",
"patches.1401.update_billing_status_for_zero_value_order", "patches.1401.update_billing_status_for_zero_value_order",
"patches.1401.enable_all_price_list",
] ]

View File

@ -18,7 +18,7 @@ cur_frm.cscript.load_defaults = function(doc, dt, dn) {
cur_frm.add_fetch('lead_name', 'company_name', 'customer_name'); cur_frm.add_fetch('lead_name', 'company_name', 'customer_name');
cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate'); cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
cur_frm.cscript.refresh = function(doc,dt,dn) { cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.cscript.setup_dashboard(doc); cur_frm.cscript.setup_dashboard(doc);
erpnext.hide_naming_series(); erpnext.hide_naming_series();
@ -107,20 +107,20 @@ cur_frm.cscript.make_contact = function() {
} }
cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) { cur_frm.fields_dict['customer_group'].get_query = function(doc, dt, dn) {
return{ return{
filters:{'is_group': 'No'} filters:{'is_group': 'No'}
} }
} }
cur_frm.fields_dict.lead_name.get_query = function(doc,cdt,cdn) { cur_frm.fields_dict.lead_name.get_query = function(doc, cdt, cdn) {
return{ return{
query:"controllers.queries.lead_query" query:"controllers.queries.lead_query"
} }
} }
cur_frm.fields_dict['default_price_list'].get_query = function(doc,cdt,cdn) { cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
return{ return{
filters:{'selling': 1} filters:{'selling': 1}
} }

View File

@ -150,8 +150,10 @@ def _get_basic_details(args, item_bean, warehouse_fieldname):
return out return out
def _get_price_list_rate(args, item_bean, meta): def _get_price_list_rate(args, item_bean, meta):
ref_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price` ref_rate = webnotes.conn.sql("""select ip.ref_rate from
where price_list=%s and item_code=%s and selling=1""", `tabItem Price` ip, `tabPrice List` pl
where ip.price_list=pl.name and ip.price_list=%s and
ip.item_code=%s and ip.selling=1 and pl.enabled=1""",
(args.selling_price_list, args.item_code), as_dict=1) (args.selling_price_list, args.item_code), as_dict=1)
if not ref_rate: if not ref_rate:

View File

@ -27,8 +27,9 @@ def get_product_info(item_code):
else: else:
in_stock = -1 in_stock = -1
price = price_list and webnotes.conn.sql("""select ref_rate, currency from price = price_list and webnotes.conn.sql("""select ip.ref_rate, ip.currency from
`tabItem Price` where item_code=%s and price_list=%s""", `tabItem Price` ip, `tabPrice List` pl where ip.price_list=pl.name and
ip.item_code=%s and ip.price_list=%s and pl.enabled=1""",
(item_code, price_list), as_dict=1) or [] (item_code, price_list), as_dict=1) or []
price = price and price[0] or None price = price and price[0] or None

View File

@ -98,6 +98,7 @@ def create_price_lists(args):
{ {
"doctype": "Price List", "doctype": "Price List",
"price_list_name": "Standard " + pl_type, "price_list_name": "Standard " + pl_type,
"enabled": 1,
"buying": 1 if pl_type == "Buying" else 0, "buying": 1 if pl_type == "Buying" else 0,
"selling": 1 if pl_type == "Selling" else 0, "selling": 1 if pl_type == "Selling" else 0,
"currency": args["currency"] "currency": args["currency"]

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes import _, msgprint from webnotes import _, msgprint, throw
import json import json
def get_company_currency(company): def get_company_currency(company):
@ -11,8 +11,8 @@ def get_company_currency(company):
if not currency: if not currency:
currency = webnotes.conn.get_default("currency") currency = webnotes.conn.get_default("currency")
if not currency: if not currency:
msgprint(_('Please specify Default Currency in Company Master \ throw(_('Please specify Default Currency in Company Master \
and Global Defaults'), raise_exception=True) and Global Defaults'))
return currency return currency
@ -32,5 +32,14 @@ def get_ancestors_of(doctype, name):
@webnotes.whitelist() @webnotes.whitelist()
def get_price_list_currency(price_list): def get_price_list_currency(price_list):
return {"price_list_currency": webnotes.conn.get_value("Price List", price_list, price_list_currency = webnotes.conn.get_value("Price List", {"name": price_list,
"currency")} "enabled": 1}, "currency")
if not price_list_currency:
throw("{message}: {price_list} {disabled}".format(**{
"message": _("Price List"),
"price_list": price_list,
"disabled": _("is disabled.")
}))
else:
return {"price_list_currency": price_list_currency}

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes import _ from webnotes import throw, _
class ItemPriceDuplicateItem(webnotes.ValidationError): pass class ItemPriceDuplicateItem(webnotes.ValidationError): pass
@ -12,26 +12,36 @@ class DocType:
self.doc, self.doclist = d, dl self.doc, self.doclist = d, dl
def validate(self): def validate(self):
self.validate_price_list()
self.check_duplicate_item() self.check_duplicate_item()
self.update_price_list_details() self.update_price_list_details()
self.update_item_details() self.update_item_details()
def update_price_list_details(self): def validate_price_list(self):
self.doc.buying, self.doc.selling, self.doc.currency = webnotes.conn.get_value("Price List", enabled = webnotes.conn.get_value("Price List", self.doc.price_list, "enabled")
self.doc.price_list, ["buying", "selling", "currency"]) if not enabled:
throw("{message}: {price_list} {disabled}".format(**{
def update_item_details(self): "message": _("Price List"),
self.doc.item_name, self.doc.item_description = webnotes.conn.get_value("Item", "price_list": self.doc.price_list,
self.doc.item_code, ["item_name", "description"]) "disabled": _("is disabled.")
}))
def check_duplicate_item(self): def check_duplicate_item(self):
if webnotes.conn.sql("""select name from `tabItem Price` if webnotes.conn.sql("""select name from `tabItem Price`
where item_code=%s and price_list=%s and name!=%s""", where item_code=%s and price_list=%s and name!=%s""",
(self.doc.item_code, self.doc.price_list, self.doc.name)): (self.doc.item_code, self.doc.price_list, self.doc.name)):
webnotes.throw("{duplicate_item}: {item_code}, {already}: {price_list}".format(**{ throw("{duplicate_item}: {item_code}, {already}: {price_list}".format(**{
"duplicate_item": _("Duplicate Item"), "duplicate_item": _("Duplicate Item"),
"item_code": self.doc.item_code, "item_code": self.doc.item_code,
"already": _("already available in Price List"), "already": _("already available in Price List"),
"price_list": self.doc.price_list "price_list": self.doc.price_list
}), ItemPriceDuplicateItem) }), ItemPriceDuplicateItem)
def update_price_list_details(self):
self.doc.buying, self.doc.selling, self.doc.currency = webnotes.conn.get_value("Price List",
{"name": self.doc.price_list, "enabled": 1}, ["buying", "selling", "currency"])
def update_item_details(self):
self.doc.item_name, self.doc.item_description = webnotes.conn.get_value("Item",
self.doc.item_code, ["item_name", "description"])

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-25 11:35:09", "creation": "2013-01-25 11:35:09",
"docstatus": 0, "docstatus": 0,
"modified": "2014-01-06 18:28:23", "modified": "2014-01-17 13:29:39",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -42,6 +42,18 @@
"doctype": "DocType", "doctype": "DocType",
"name": "Price List" "name": "Price List"
}, },
{
"default": "1",
"doctype": "DocField",
"fieldname": "enabled",
"fieldtype": "Check",
"label": "Enabled"
},
{
"doctype": "DocField",
"fieldname": "sb_1",
"fieldtype": "Section Break"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "price_list_name", "fieldname": "price_list_name",

View File

@ -11,6 +11,7 @@ test_records = [
{ {
"doctype": "Price List", "doctype": "Price List",
"price_list_name": "_Test Price List", "price_list_name": "_Test Price List",
"enabled": 1,
"currency": "INR", "currency": "INR",
"selling": 1 "selling": 1
}, },
@ -24,6 +25,7 @@ test_records = [
{ {
"doctype": "Price List", "doctype": "Price List",
"price_list_name": "_Test Price List 2", "price_list_name": "_Test Price List 2",
"enabled": 1,
"currency": "INR", "currency": "INR",
"selling": 1 "selling": 1
}, },
@ -37,6 +39,7 @@ test_records = [
{ {
"doctype": "Price List", "doctype": "Price List",
"price_list_name": "_Test Price List India", "price_list_name": "_Test Price List India",
"enabled": 1,
"currency": "INR", "currency": "INR",
"selling": 1 "selling": 1
}, },
@ -50,6 +53,7 @@ test_records = [
{ {
"doctype": "Price List", "doctype": "Price List",
"price_list_name": "_Test Price List Rest of the World", "price_list_name": "_Test Price List Rest of the World",
"enabled": 1,
"currency": "USD", "currency": "USD",
"selling": 1 "selling": 1
}, },

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes.utils import cint, validate_email_add from webnotes.utils import cint, validate_email_add
from webnotes import msgprint, _ from webnotes import throw, msgprint, _
class DocType: class DocType:
def __init__(self, doc, doclist=[]): def __init__(self, doc, doclist=[]):
@ -18,7 +18,7 @@ class DocType:
def validate(self): def validate(self):
if self.doc.email_id and not validate_email_add(self.doc.email_id): if self.doc.email_id and not validate_email_add(self.doc.email_id):
msgprint("Please enter valid Email Id", raise_exception=1) throw(_("Please enter valid Email Id"))
self.update_parent_account() self.update_parent_account()
@ -76,8 +76,8 @@ class DocType:
for d in bins: for d in bins:
if d['actual_qty'] or d['reserved_qty'] or d['ordered_qty'] or \ if d['actual_qty'] or d['reserved_qty'] or d['ordered_qty'] or \
d['indented_qty'] or d['projected_qty'] or d['planned_qty']: d['indented_qty'] or d['projected_qty'] or d['planned_qty']:
msgprint("""Warehouse: %s can not be deleted as qty exists for item: %s""" throw("""Warehouse: %s can not be deleted as qty exists for item: %s"""
% (self.doc.name, d['item_code']), raise_exception=1) % (self.doc.name, d['item_code']))
else: else:
webnotes.conn.sql("delete from `tabBin` where name = %s", d['name']) webnotes.conn.sql("delete from `tabBin` where name = %s", d['name'])
@ -88,8 +88,8 @@ class DocType:
if webnotes.conn.sql("""select name from `tabStock Ledger Entry` if webnotes.conn.sql("""select name from `tabStock Ledger Entry`
where warehouse = %s""", self.doc.name): where warehouse = %s""", self.doc.name):
msgprint("""Warehouse can not be deleted as stock ledger entry throw(_("""Warehouse can not be deleted as stock ledger entry
exists for this warehouse.""", raise_exception=1) exists for this warehouse."""))
def before_rename(self, olddn, newdn, merge=False): def before_rename(self, olddn, newdn, merge=False):
# Add company abbr if not provided # Add company abbr if not provided

View File

@ -15,8 +15,7 @@ def execute(filters=None):
bom_rate = get_item_bom_rate() bom_rate = get_item_bom_rate()
val_rate_map = get_valuation_rate() val_rate_map = get_valuation_rate()
precision = get_currency_precision or 2 precision = get_currency_precision() or 2
data = [] data = []
for item in sorted(item_map): for item in sorted(item_map):
data.append([item, item_map[item]["item_name"], data.append([item, item_map[item]["item_name"],
@ -65,9 +64,10 @@ def get_price_list():
rate = {} rate = {}
price_list = webnotes.conn.sql("""select item_code, buying, selling, price_list = webnotes.conn.sql("""select ip.item_code, ip.buying, ip.selling,
concat(price_list, " - ", currency, " ", ref_rate) as price concat(ip.price_list, " - ", ip.currency, " ", ip.ref_rate) as price
from `tabItem Price`""", as_dict=1) from `tabItem Price` ip, `tabPrice List` pl
where ip.price_list=pl.name and pl.enabled=1""", as_dict=1)
for j in price_list: for j in price_list:
if j.price: if j.price: