Merge branch 'master' of github.com:webnotes/erpnext into wsgi

Conflicts:
	accounts/doctype/sales_invoice/sales_invoice.txt
	controllers/selling_controller.py
	patches/patch_list.py
	selling/doctype/lead/lead.py
	selling/doctype/opportunity/opportunity.py
	selling/doctype/quotation/quotation.py
	selling/doctype/quotation/quotation.txt
	selling/doctype/sales_order/sales_order.txt
	stock/doctype/purchase_receipt/purchase_receipt.py
	stock/doctype/serial_no/serial_no.py
	stock/doctype/stock_entry/stock_entry.py
	stock/doctype/stock_ledger_entry/stock_ledger_entry.py
This commit is contained in:
Anand Doshi
2013-10-15 12:18:46 +05:30
44 changed files with 902 additions and 332 deletions

View File

@@ -52,7 +52,7 @@ class AccountsController(TransactionBase):
msgprint(_("Account for this ") + fieldname + _(" has been freezed. ") +
self.doc.doctype + _(" can not be made."), raise_exception=1)
def set_price_list_currency(self, buying_or_selling):
def set_price_list_currency(self, buying_or_selling, for_validate=False):
if self.meta.get_field("currency"):
company_currency = get_company_currency(self.doc.company)
@@ -60,14 +60,13 @@ class AccountsController(TransactionBase):
fieldname = "selling_price_list" if buying_or_selling.lower() == "selling" \
else "buying_price_list"
if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
if not self.doc.price_list_currency:
self.doc.price_list_currency = webnotes.conn.get_value("Price List",
self.doc.fields.get(fieldname), "currency")
self.doc.price_list_currency = webnotes.conn.get_value("Price List",
self.doc.fields.get(fieldname), "currency")
if self.doc.price_list_currency == company_currency:
self.doc.plc_conversion_rate = 1.0
elif not self.doc.plc_conversion_rate:
elif not self.doc.plc_conversion_rate or not for_validate:
self.doc.plc_conversion_rate = self.get_exchange_rate(
self.doc.price_list_currency, company_currency)
@@ -77,7 +76,7 @@ class AccountsController(TransactionBase):
self.doc.conversion_rate = self.doc.plc_conversion_rate
elif self.doc.currency == company_currency:
self.doc.conversion_rate = 1.0
elif not self.doc.conversion_rate:
elif not self.doc.conversion_rate or not for_validate:
self.doc.conversion_rate = self.get_exchange_rate(self.doc.currency,
company_currency)

View File

@@ -29,7 +29,7 @@ class BuyingController(StockController):
super(BuyingController, self).set_missing_values(for_validate)
self.set_supplier_from_item_default()
self.set_price_list_currency("Buying")
self.set_price_list_currency("Buying", for_validate)
# set contact and address details for supplier, if they are not mentioned
if self.doc.supplier and not (self.doc.contact_person and self.doc.supplier_address):

View File

@@ -23,7 +23,7 @@ class SellingController(StockController):
# set contact and address details for customer, if they are not mentioned
self.set_missing_lead_customer_details()
self.set_price_list_and_item_details()
self.set_price_list_and_item_details(for_validate)
if self.doc.fields.get("__islocal"):
self.set_taxes("other_charges", "charge")
@@ -41,8 +41,8 @@ class SellingController(StockController):
if not self.doc.fields.get(fieldname) and self.meta.get_field(fieldname):
self.doc.fields[fieldname] = val
def set_price_list_and_item_details(self):
self.set_price_list_currency("Selling")
def set_price_list_and_item_details(self, for_validate=False):
self.set_price_list_currency("Selling", for_validate)
self.set_missing_item_details(get_item_details)
def get_other_charges(self):