[minor] fixes in test cases and added the test case for multiple uom in selling
This commit is contained in:
parent
287fe81329
commit
9e9d242a24
@ -147,9 +147,9 @@
|
||||
"price_list_rate": 50,
|
||||
"qty": 10,
|
||||
"rate": 50,
|
||||
"uom": "_Test UOM",
|
||||
"uom": "_Test UOM 1",
|
||||
"conversion_factor": 1,
|
||||
"stock_uom": "_Test UOM"
|
||||
"stock_uom": "_Test UOM 1"
|
||||
},
|
||||
{
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
@ -273,9 +273,9 @@
|
||||
"parentfield": "items",
|
||||
"price_list_rate": 62.5,
|
||||
"qty": 10,
|
||||
"uom": "_Test UOM",
|
||||
"conversion_factor": 1,
|
||||
"stock_uom": "_Test UOM"
|
||||
"uom": "_Test UOM 1",
|
||||
"conversion_factor": 1,
|
||||
"stock_uom": "_Test UOM 1"
|
||||
|
||||
},
|
||||
{
|
||||
|
@ -1043,6 +1043,25 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
#check outstanding after advance cancellation
|
||||
self.assertEqual(flt(si.outstanding_amount), flt(si.grand_total + si.total_advance, si.precision("outstanding_amount")))
|
||||
|
||||
def test_multiple_uom_in_selling(self):
|
||||
si = frappe.copy_doc(test_records[1])
|
||||
|
||||
si.items[0].uom = "_Test UOM 1"
|
||||
si.items[0].conversion_factor = None
|
||||
si.items[0].price_list_rate = None
|
||||
si.save()
|
||||
|
||||
expected_values = {
|
||||
"keys": ["price_list_rate", "stock_uom", "uom", "conversion_factor", "rate", "amount",
|
||||
"base_price_list_rate", "base_rate", "base_amount"],
|
||||
"_Test Item": [1000, "_Test UOM", "_Test UOM 1", 10.0, 1000, 1000, 1000, 1000, 1000]
|
||||
}
|
||||
|
||||
# check if the conversion_factor and price_list_rate is calculated according to uom
|
||||
for d in si.get("items"):
|
||||
for i, k in enumerate(expected_values["keys"]):
|
||||
self.assertEquals(d.get(k), expected_values[d.item_code][i])
|
||||
|
||||
def create_sales_invoice(**args):
|
||||
si = frappe.new_doc("Sales Invoice")
|
||||
args = frappe._dict(args)
|
||||
|
@ -41,7 +41,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(for_validate)
|
||||
self.set_price_list_and_item_details(for_validate=for_validate)
|
||||
|
||||
def set_missing_lead_customer_details(self):
|
||||
if getattr(self, "customer", None):
|
||||
@ -60,7 +60,7 @@ class SellingController(StockController):
|
||||
posting_date=self.get('transaction_date') or self.get('posting_date'),
|
||||
company=self.company))
|
||||
|
||||
def set_price_list_and_item_details(self, for_validate):
|
||||
def set_price_list_and_item_details(self, for_validate=False):
|
||||
self.set_price_list_currency("Selling")
|
||||
self.set_missing_item_details(for_validate=for_validate)
|
||||
|
||||
|
@ -23,9 +23,9 @@
|
||||
"parentfield": "items",
|
||||
"qty": 10.0,
|
||||
"rate": 100.0,
|
||||
"uom": "_Test UOM",
|
||||
"stock_uom": "_Test UOM",
|
||||
"conversion_factor": 1.0
|
||||
"uom": "_Test UOM 1",
|
||||
"stock_uom": "_Test UOM 1",
|
||||
"conversion_factor": 1.0
|
||||
}
|
||||
],
|
||||
"quotation_to": "Customer",
|
||||
|
@ -24,6 +24,16 @@
|
||||
"warehouse_reorder_qty": 20
|
||||
}
|
||||
],
|
||||
"uoms": [
|
||||
{
|
||||
"uom": "_Test UOM",
|
||||
"conversion_factor": 1.0
|
||||
},
|
||||
{
|
||||
"uom": "_Test UOM 1",
|
||||
"conversion_factor": 10.0
|
||||
}
|
||||
],
|
||||
"stock_uom": "_Test UOM",
|
||||
"show_in_website": 1,
|
||||
"website_warehouse": "_Test Warehouse - _TC"
|
||||
|
Loading…
x
Reference in New Issue
Block a user