Added test cases
This commit is contained in:
parent
fd9dc5e9f5
commit
d5e15eaadf
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 37 KiB |
@ -123,30 +123,16 @@
|
||||
<td>7</td>
|
||||
<td ><code>image</code></td>
|
||||
<td >
|
||||
Attach</td>
|
||||
<td class="text-muted" title="Hidden">
|
||||
Attach Image</td>
|
||||
<td >
|
||||
Image
|
||||
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>8</td>
|
||||
<td ><code>image_view</code></td>
|
||||
<td >
|
||||
Image</td>
|
||||
<td >
|
||||
Image View
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<pre>image</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="info">
|
||||
<td>9</td>
|
||||
<td>8</td>
|
||||
<td ><code>quantity_and_warehouse</code></td>
|
||||
<td >
|
||||
Section Break</td>
|
||||
@ -158,7 +144,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>10</td>
|
||||
<td>9</td>
|
||||
<td class="danger" title="Mandatory"><code>qty</code></td>
|
||||
<td >
|
||||
Float</td>
|
||||
@ -170,7 +156,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>11</td>
|
||||
<td>10</td>
|
||||
<td class="danger" title="Mandatory"><code>uom</code></td>
|
||||
<td >
|
||||
Link</td>
|
||||
@ -191,7 +177,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>12</td>
|
||||
<td>11</td>
|
||||
<td ><code>warehouse</code></td>
|
||||
<td >
|
||||
Link</td>
|
||||
@ -212,7 +198,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>13</td>
|
||||
<td>12</td>
|
||||
<td ><code>col_break2</code></td>
|
||||
<td class="info">
|
||||
Column Break</td>
|
||||
@ -224,7 +210,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>14</td>
|
||||
<td>13</td>
|
||||
<td class="danger" title="Mandatory"><code>schedule_date</code></td>
|
||||
<td >
|
||||
Date</td>
|
||||
@ -236,7 +222,7 @@
|
||||
</tr>
|
||||
|
||||
<tr class="info">
|
||||
<td>15</td>
|
||||
<td>14</td>
|
||||
<td ><code>more_info</code></td>
|
||||
<td >
|
||||
Section Break</td>
|
||||
@ -248,7 +234,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>16</td>
|
||||
<td>15</td>
|
||||
<td ><code>item_group</code></td>
|
||||
<td >
|
||||
Link</td>
|
||||
@ -269,7 +255,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>17</td>
|
||||
<td>16</td>
|
||||
<td ><code>brand</code></td>
|
||||
<td >
|
||||
Link</td>
|
||||
@ -290,7 +276,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>18</td>
|
||||
<td>17</td>
|
||||
<td ><code>lead_time_date</code></td>
|
||||
<td >
|
||||
Date</td>
|
||||
@ -302,7 +288,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>19</td>
|
||||
<td>18</td>
|
||||
<td ><code>sales_order</code></td>
|
||||
<td >
|
||||
Link</td>
|
||||
@ -323,7 +309,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>20</td>
|
||||
<td>19</td>
|
||||
<td ><code>col_break3</code></td>
|
||||
<td class="info">
|
||||
Column Break</td>
|
||||
@ -335,7 +321,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>21</td>
|
||||
<td>20</td>
|
||||
<td ><code>min_order_qty</code></td>
|
||||
<td >
|
||||
Float</td>
|
||||
@ -347,7 +333,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>22</td>
|
||||
<td>21</td>
|
||||
<td ><code>projected_qty</code></td>
|
||||
<td >
|
||||
Float</td>
|
||||
@ -359,7 +345,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>23</td>
|
||||
<td>22</td>
|
||||
<td ><code>ordered_qty</code></td>
|
||||
<td >
|
||||
Float</td>
|
||||
@ -371,7 +357,7 @@
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td>24</td>
|
||||
<td>23</td>
|
||||
<td ><code>page_break</code></td>
|
||||
<td >
|
||||
Check</td>
|
||||
|
@ -355,6 +355,7 @@ def raise_production_orders(source_name):
|
||||
prod_order.material_request = material_request.name
|
||||
prod_order.material_request_item = d.name
|
||||
prod_order.planned_start_date = material_request.transaction_date
|
||||
prod_order.company = material_request.company
|
||||
prod_order.save()
|
||||
production_orders.append(prod_order.name)
|
||||
else:
|
||||
@ -364,4 +365,5 @@ def raise_production_orders(source_name):
|
||||
(p, p) for p in production_orders]
|
||||
msgprint(_("Production Orders {0} created").format(comma_and(message)))
|
||||
if errors:
|
||||
msgprint(_("Could not Raise Production Orders for {0}").format(comma_and(errors)))
|
||||
msgprint(_("Could not Raise Production Orders for {0}").format(comma_and(errors)))
|
||||
return production_orders
|
@ -7,6 +7,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe, unittest
|
||||
from frappe.utils import flt
|
||||
from erpnext.stock.doctype.material_request.material_request import raise_production_orders
|
||||
|
||||
class TestMaterialRequest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@ -436,6 +437,25 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
|
||||
#testing bin requested qty after issuing stock against material request
|
||||
self.assertEquals(_get_requested_qty(), existing_requested_qty)
|
||||
|
||||
def test_completed_qty_for__manufacture(self):
|
||||
mr = frappe.copy_doc(test_records[1]).insert()
|
||||
mr = frappe.get_doc("Material Request", mr.name)
|
||||
mr.submit()
|
||||
completed_qty = mr.items[0].ordered_qty
|
||||
|
||||
prod_order = raise_production_orders(mr.name)
|
||||
po = frappe.get_doc("Production Order", prod_order[0])
|
||||
po.wip_warehouse = "_Test Warehouse 1 - _TC"
|
||||
po.submit()
|
||||
|
||||
mr = frappe.get_doc("Material Request", mr.name)
|
||||
self.assertEquals(completed_qty + po.qty, mr.items[0].ordered_qty)
|
||||
|
||||
po.cancel()
|
||||
|
||||
mr = frappe.get_doc("Material Request", mr.name)
|
||||
self.assertEquals(completed_qty, mr.items[0].ordered_qty)
|
||||
|
||||
test_dependencies = ["Currency Exchange"]
|
||||
test_records = frappe.get_test_records('Material Request')
|
||||
|
@ -30,5 +30,26 @@
|
||||
"material_request_type": "Purchase",
|
||||
"naming_series": "_T-Material Request-",
|
||||
"transaction_date": "2013-02-18"
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Material Request",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"items": [
|
||||
{
|
||||
"description": "_Test FG Item",
|
||||
"doctype": "Material Request Item",
|
||||
"item_code": "_Test FG Item",
|
||||
"item_name": "_Test FG Item",
|
||||
"parentfield": "items",
|
||||
"qty": 5,
|
||||
"schedule_date": "2013-02-18",
|
||||
"uom": "_Test UOM 1",
|
||||
"warehouse": "_Test Warehouse - _TC"
|
||||
}
|
||||
],
|
||||
"material_request_type": "Manufacture",
|
||||
"naming_series": "_T-Material Request-",
|
||||
"transaction_date": "2013-02-18"
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user