[mapper] sales order-sales invoice added condition
This commit is contained in:
parent
8fe97fcbe1
commit
be2016ba41
@ -471,7 +471,8 @@ def make_sales_invoice(source_name, target_doclist=None):
|
||||
"parent": "sales_order",
|
||||
"reserved_warehouse": "warehouse"
|
||||
},
|
||||
"postprocess": update_item
|
||||
"postprocess": update_item,
|
||||
"condition": lambda doc: doc.amount==0 or doc.billed_amt < doc.amount
|
||||
},
|
||||
"Sales Taxes and Charges": {
|
||||
"doctype": "Sales Taxes and Charges",
|
||||
|
@ -43,10 +43,19 @@ class TestSalesOrder(unittest.TestCase):
|
||||
|
||||
sales_order = webnotes.bean("Sales Order", so.doc.name)
|
||||
sales_order.submit()
|
||||
dn = make_sales_invoice(so.doc.name)
|
||||
si = make_sales_invoice(so.doc.name)
|
||||
|
||||
self.assertEquals(si[0]["doctype"], "Sales Invoice")
|
||||
self.assertEquals(len(si), len(sales_order.doclist))
|
||||
self.assertEquals(len([d for d in si if d["doctype"]=="Sales Invoice Item"]), 1)
|
||||
|
||||
si = webnotes.bean(si)
|
||||
si.insert()
|
||||
si.submit()
|
||||
|
||||
si1 = make_sales_invoice(so.doc.name)
|
||||
self.assertEquals(len([d for d in si1 if d["doctype"]=="Sales Invoice Item"]), 0)
|
||||
|
||||
self.assertEquals(dn[0]["doctype"], "Sales Invoice")
|
||||
self.assertEquals(len(dn), len(sales_order.doclist))
|
||||
|
||||
def create_so(self, so_doclist = None):
|
||||
if not so_doclist:
|
||||
|
@ -62,7 +62,8 @@ test_records = [
|
||||
"is_pro_applicable": "No",
|
||||
"is_sub_contracted_item": "No",
|
||||
"stock_uom": "_Test UOM",
|
||||
"default_warehouse": "_Test Warehouse"
|
||||
"default_income_account": "Sales - _TC",
|
||||
"default_warehouse": "_Test Warehouse",
|
||||
}, {
|
||||
"doctype": "Item Reorder",
|
||||
"parentfield": "item_reorder",
|
||||
@ -85,6 +86,7 @@ test_records = [
|
||||
"description": "_Test Item Home Desktop 100",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"default_warehouse": "_Test Warehouse",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"is_stock_item": "Yes",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
@ -110,6 +112,7 @@ test_records = [
|
||||
"description": "_Test Item Home Desktop 200",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"default_warehouse": "_Test Warehouse",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"is_stock_item": "Yes",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
@ -129,6 +132,7 @@ test_records = [
|
||||
"item_name": "_Test Sales BOM Item",
|
||||
"description": "_Test Sales BOM Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"is_stock_item": "No",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
@ -150,6 +154,7 @@ test_records = [
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"is_stock_item": "Yes",
|
||||
"default_warehouse": "_Test Warehouse",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
|
Loading…
x
Reference in New Issue
Block a user