Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
ffe64db8f7
@ -250,10 +250,15 @@ class DocType(SellingController):
|
|||||||
|
|
||||||
def get_cust_and_due_date(self):
|
def get_cust_and_due_date(self):
|
||||||
"""Set Due Date = Posting Date + Credit Days"""
|
"""Set Due Date = Posting Date + Credit Days"""
|
||||||
|
if self.doc.debit_to:
|
||||||
|
self.doc.customer = webnotes.conn.get_value('Account', self.doc.debit_to, 'master_name')
|
||||||
|
|
||||||
if self.doc.posting_date:
|
if self.doc.posting_date:
|
||||||
credit_days = 0
|
credit_days = 0
|
||||||
if self.doc.debit_to:
|
if self.doc.debit_to:
|
||||||
credit_days = webnotes.conn.get_value("Account", self.doc.debit_to, "credit_days")
|
credit_days = webnotes.conn.get_value("Account", self.doc.debit_to, "credit_days")
|
||||||
|
if self.doc.customer and not credit_days:
|
||||||
|
credit_days = webnotes.conn.get_value("Customer", self.doc.customer, "credit_days")
|
||||||
if self.doc.company and not credit_days:
|
if self.doc.company and not credit_days:
|
||||||
credit_days = webnotes.conn.get_value("Company", self.doc.company, "credit_days")
|
credit_days = webnotes.conn.get_value("Company", self.doc.company, "credit_days")
|
||||||
|
|
||||||
@ -262,9 +267,6 @@ class DocType(SellingController):
|
|||||||
else:
|
else:
|
||||||
self.doc.due_date = self.doc.posting_date
|
self.doc.due_date = self.doc.posting_date
|
||||||
|
|
||||||
if self.doc.debit_to:
|
|
||||||
self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name')
|
|
||||||
|
|
||||||
def get_barcode_details(self, barcode):
|
def get_barcode_details(self, barcode):
|
||||||
return get_obj('Sales Common').get_barcode_details(barcode)
|
return get_obj('Sales Common').get_barcode_details(barcode)
|
||||||
|
|
||||||
|
@ -916,7 +916,6 @@ test_records = [
|
|||||||
"item_name": "_Test Item Home Desktop 100",
|
"item_name": "_Test Item Home Desktop 100",
|
||||||
"qty": 10,
|
"qty": 10,
|
||||||
"ref_rate": 62.5,
|
"ref_rate": 62.5,
|
||||||
"export_rate": 62.5,
|
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"item_tax_rate": json.dumps({"_Test Account Excise Duty - _TC": 10}),
|
"item_tax_rate": json.dumps({"_Test Account Excise Duty - _TC": 10}),
|
||||||
"income_account": "Sales - _TC",
|
"income_account": "Sales - _TC",
|
||||||
@ -930,7 +929,6 @@ test_records = [
|
|||||||
"item_name": "_Test Item Home Desktop 200",
|
"item_name": "_Test Item Home Desktop 200",
|
||||||
"qty": 5,
|
"qty": 5,
|
||||||
"ref_rate": 190.66,
|
"ref_rate": 190.66,
|
||||||
"export_rate": 190.66,
|
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"income_account": "Sales - _TC",
|
"income_account": "Sales - _TC",
|
||||||
"cost_center": "_Test Cost Center - _TC",
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
@ -98,7 +98,7 @@ class BuyingController(StockController):
|
|||||||
|
|
||||||
if item.discount_rate == 100.0:
|
if item.discount_rate == 100.0:
|
||||||
item.import_rate = 0.0
|
item.import_rate = 0.0
|
||||||
elif item.import_ref_rate:
|
elif not item.import_rate:
|
||||||
item.import_rate = flt(item.import_ref_rate * (1.0 - (item.discount_rate / 100.0)),
|
item.import_rate = flt(item.import_ref_rate * (1.0 - (item.discount_rate / 100.0)),
|
||||||
self.precision("import_rate", item))
|
self.precision("import_rate", item))
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ class SellingController(StockController):
|
|||||||
|
|
||||||
if item.adj_rate == 100:
|
if item.adj_rate == 100:
|
||||||
item.export_rate = 0
|
item.export_rate = 0
|
||||||
elif item.ref_rate:
|
elif not item.export_rate:
|
||||||
item.export_rate = flt(item.ref_rate * (1.0 - (item.adj_rate / 100.0)),
|
item.export_rate = flt(item.ref_rate * (1.0 - (item.adj_rate / 100.0)),
|
||||||
self.precision("export_rate", item))
|
self.precision("export_rate", item))
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ class DocType(TransactionBase):
|
|||||||
msgprint("Please Select Company under which you want to create account head")
|
msgprint("Please Select Company under which you want to create account head")
|
||||||
|
|
||||||
def update_credit_days_limit(self):
|
def update_credit_days_limit(self):
|
||||||
sql("""update tabAccount set credit_days = %s, credit_limit = %s
|
webnotes.conn.sql("""update tabAccount set credit_days = %s, credit_limit = %s
|
||||||
where name = %s""", (self.doc.credit_days or 0, self.doc.credit_limit or 0,
|
where master_type='Customer' and master_name = %s""",
|
||||||
self.doc.name + " - " + self.get_company_abbr()))
|
(self.doc.credit_days or 0, self.doc.credit_limit or 0, self.doc.name))
|
||||||
|
|
||||||
def create_lead_address_contact(self):
|
def create_lead_address_contact(self):
|
||||||
if self.doc.lead_name:
|
if self.doc.lead_name:
|
||||||
|
@ -33,7 +33,7 @@ class TestDeliveryNote(unittest.TestCase):
|
|||||||
self.assertEquals(len(si), len(dn.doclist))
|
self.assertEquals(len(si), len(dn.doclist))
|
||||||
|
|
||||||
# modify export_amount
|
# modify export_amount
|
||||||
si[1].ref_rate = 200
|
si[1].export_rate = 200
|
||||||
self.assertRaises(webnotes.ValidationError, webnotes.bean(si).insert)
|
self.assertRaises(webnotes.ValidationError, webnotes.bean(si).insert)
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ class TransactionBase(StatusUpdater):
|
|||||||
"""
|
"""
|
||||||
customer_defaults = self.get_customer_defaults()
|
customer_defaults = self.get_customer_defaults()
|
||||||
|
|
||||||
customer_defaults["price_list_name"] = customer_defaults.get("price_list") or \
|
customer_defaults["selling_price_list"] = customer_defaults.get("price_list") or \
|
||||||
webnotes.conn.get_value("Customer Group", self.doc.customer_group, "default_price_list") or \
|
webnotes.conn.get_value("Customer Group", self.doc.customer_group, "default_price_list") or \
|
||||||
self.doc.price_list
|
self.doc.selling_price_list
|
||||||
|
|
||||||
for fieldname, val in customer_defaults.items():
|
for fieldname, val in customer_defaults.items():
|
||||||
if self.meta.get_field(fieldname):
|
if self.meta.get_field(fieldname):
|
||||||
|
@ -43,7 +43,7 @@ class DocType(DocListController):
|
|||||||
|
|
||||||
def validate_price_lists(self):
|
def validate_price_lists(self):
|
||||||
territory_name_map = self.validate_overlapping_territories("price_lists",
|
territory_name_map = self.validate_overlapping_territories("price_lists",
|
||||||
"price_list")
|
"selling_price_list")
|
||||||
|
|
||||||
# validate that a Shopping Cart Price List exists for the root territory
|
# validate that a Shopping Cart Price List exists for the root territory
|
||||||
# as a catch all!
|
# as a catch all!
|
||||||
@ -92,7 +92,7 @@ class DocType(DocListController):
|
|||||||
raise_exception=ShoppingCartSetupError)
|
raise_exception=ShoppingCartSetupError)
|
||||||
|
|
||||||
price_list_currency_map = webnotes.conn.get_values("Price List",
|
price_list_currency_map = webnotes.conn.get_values("Price List",
|
||||||
[d.price_list for d in self.doclist.get({"parentfield": "price_lists"})],
|
[d.selling_price_list for d in self.doclist.get({"parentfield": "price_lists"})],
|
||||||
"currency")
|
"currency")
|
||||||
|
|
||||||
expected_to_exist = [currency + "-" + company_currency
|
expected_to_exist = [currency + "-" + company_currency
|
||||||
@ -126,7 +126,7 @@ class DocType(DocListController):
|
|||||||
return name
|
return name
|
||||||
|
|
||||||
def get_price_list(self, billing_territory):
|
def get_price_list(self, billing_territory):
|
||||||
price_list = self.get_name_from_territory(billing_territory, "price_lists", "price_list")
|
price_list = self.get_name_from_territory(billing_territory, "price_lists", "selling_price_list")
|
||||||
return price_list and price_list[0] or None
|
return price_list and price_list[0] or None
|
||||||
|
|
||||||
def get_tax_master(self, billing_territory):
|
def get_tax_master(self, billing_territory):
|
||||||
|
@ -26,7 +26,7 @@ class TestShoppingCartSettings(unittest.TestCase):
|
|||||||
cart_settings.doclist.append({
|
cart_settings.doclist.append({
|
||||||
"doctype": "Shopping Cart Price List",
|
"doctype": "Shopping Cart Price List",
|
||||||
"parentfield": "price_lists",
|
"parentfield": "price_lists",
|
||||||
"price_list": price_list
|
"selling_price_list": price_list
|
||||||
})
|
})
|
||||||
|
|
||||||
for price_list in ("_Test Price List Rest of the World", "_Test Price List India",
|
for price_list in ("_Test Price List Rest of the World", "_Test Price List India",
|
||||||
@ -34,13 +34,13 @@ class TestShoppingCartSettings(unittest.TestCase):
|
|||||||
_add_price_list(price_list)
|
_add_price_list(price_list)
|
||||||
|
|
||||||
controller = cart_settings.make_controller()
|
controller = cart_settings.make_controller()
|
||||||
controller.validate_overlapping_territories("price_lists", "price_list")
|
controller.validate_overlapping_territories("price_lists", "selling_price_list")
|
||||||
|
|
||||||
_add_price_list("_Test Price List 2")
|
_add_price_list("_Test Price List 2")
|
||||||
|
|
||||||
controller = cart_settings.make_controller()
|
controller = cart_settings.make_controller()
|
||||||
self.assertRaises(ShoppingCartSetupError, controller.validate_overlapping_territories,
|
self.assertRaises(ShoppingCartSetupError, controller.validate_overlapping_territories,
|
||||||
"price_lists", "price_list")
|
"price_lists", "selling_price_list")
|
||||||
|
|
||||||
return cart_settings
|
return cart_settings
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user