mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-01 20:48:27 +00:00
Merge branch 'master' into perpetual
This commit is contained in:
@@ -67,6 +67,7 @@ class AccountsController(TransactionBase):
|
||||
self.doc.doctype + _(" can not be made."), raise_exception=1)
|
||||
|
||||
def set_price_list_currency(self, buying_or_selling):
|
||||
company_currency = get_company_currency(self.doc.company)
|
||||
# TODO - change this, since price list now has only one currency allowed
|
||||
if self.meta.get_field("price_list_name") and self.doc.price_list_name and \
|
||||
not self.doc.price_list_currency:
|
||||
@@ -74,7 +75,6 @@ class AccountsController(TransactionBase):
|
||||
|
||||
if self.doc.price_list_currency:
|
||||
if not self.doc.plc_conversion_rate:
|
||||
company_currency = get_company_currency(self.doc.company)
|
||||
if self.doc.price_list_currency == company_currency:
|
||||
self.doc.plc_conversion_rate = 1.0
|
||||
else:
|
||||
@@ -86,6 +86,12 @@ class AccountsController(TransactionBase):
|
||||
self.doc.currency = self.doc.price_list_currency
|
||||
self.doc.conversion_rate = self.doc.plc_conversion_rate
|
||||
|
||||
if self.meta.get_field("currency") and self.doc.currency != company_currency and \
|
||||
not self.doc.conversion_rate:
|
||||
exchange = self.doc.currency + "-" + company_currency
|
||||
self.doc.conversion_rate = flt(webnotes.conn.get_value("Currency Exchange",
|
||||
exchange, "exchange_rate"))
|
||||
|
||||
def set_missing_item_details(self, get_item_details):
|
||||
"""set missing item values"""
|
||||
for item in self.doclist.get({"parentfield": self.fname}):
|
||||
|
||||
@@ -23,7 +23,7 @@ def get_filters_cond(doctype, filters, conditions):
|
||||
filters = filters.items()
|
||||
flt = []
|
||||
for f in filters:
|
||||
if f[1][0] == '!':
|
||||
if isinstance(f[1], basestring) and f[1][0] == '!':
|
||||
flt.append([doctype, f[0], '!=', f[1][1:]])
|
||||
else:
|
||||
flt.append([doctype, f[0], '=', f[1]])
|
||||
@@ -204,4 +204,20 @@ def get_price_list_currency(doctype, txt, searchfield, start, page_len, filters)
|
||||
and `%s` like %s order by ref_currency asc limit %s, %s""" %
|
||||
("%s", "%s", searchfield, "%s", "%s", "%s"),
|
||||
(filters["price_list_name"], filters['buying_or_selling'], "%%%s%%" % txt,
|
||||
start, page_len))
|
||||
start, page_len))
|
||||
|
||||
def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name
|
||||
from `tabDelivery Note`
|
||||
where `tabDelivery Note`.`%(key)s` like %(txt)s %(fcond)s and
|
||||
(ifnull((select sum(qty) from `tabDelivery Note Item` where
|
||||
`tabDelivery Note Item`.parent=`tabDelivery Note`.name), 0) >
|
||||
ifnull((select sum(qty) from `tabSales Invoice Item` where
|
||||
`tabSales Invoice Item`.delivery_note=`tabDelivery Note`.name), 0))
|
||||
%(mcond)s order by `tabDelivery Note`.`%(key)s` asc
|
||||
limit %(start)s, %(page_len)s""" % {
|
||||
"key": searchfield,
|
||||
"fcond": get_filters_cond(doctype, filters, []),
|
||||
"mcond": get_match_cond(doctype),
|
||||
"start": "%(start)s", "page_len": "%(page_len)s", "txt": "%(txt)s"
|
||||
}, { "start": start, "page_len": page_len, "txt": ("%%%s%%" % txt) }, debug=True)
|
||||
Reference in New Issue
Block a user