Merge pull request #17415 from deepeshgarg007/notification
feat: Track purchase receipt status in material request
This commit is contained in:
commit
35226b1f32
@ -369,7 +369,9 @@ def make_purchase_receipt(source_name, target_doc=None):
|
|||||||
"field_map": {
|
"field_map": {
|
||||||
"name": "purchase_order_item",
|
"name": "purchase_order_item",
|
||||||
"parent": "purchase_order",
|
"parent": "purchase_order",
|
||||||
"bom": "bom"
|
"bom": "bom",
|
||||||
|
"material_request": "material_request",
|
||||||
|
"material_request_item": "material_request_item"
|
||||||
},
|
},
|
||||||
"postprocess": update_item,
|
"postprocess": update_item,
|
||||||
"condition": lambda doc: abs(doc.received_qty) < abs(doc.qty) and doc.delivered_by_supplier!=1
|
"condition": lambda doc: abs(doc.received_qty) < abs(doc.qty) and doc.delivered_by_supplier!=1
|
||||||
|
@ -96,7 +96,9 @@ status_map = {
|
|||||||
["Partially Ordered", "eval:self.status != 'Stopped' and self.per_ordered < 100 and self.per_ordered > 0 and self.docstatus == 1"],
|
["Partially Ordered", "eval:self.status != 'Stopped' and self.per_ordered < 100 and self.per_ordered > 0 and self.docstatus == 1"],
|
||||||
["Ordered", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Purchase'"],
|
["Ordered", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Purchase'"],
|
||||||
["Transferred", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Transfer'"],
|
["Transferred", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Transfer'"],
|
||||||
["Issued", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Issue'"]
|
["Issued", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Issue'"],
|
||||||
|
["Received", "eval:self.status != 'Stopped' and self.per_received == 100 and self.docstatus == 1 and self.material_request_type == 'Purchase'"],
|
||||||
|
["Partially Received", "eval:self.status != 'Stopped' and self.per_received > 0 and self.per_received < 100 and self.docstatus == 1 and self.material_request_type == 'Purchase'"]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
0
erpnext/manufacturing/notification/__init__.py
Normal file
0
erpnext/manufacturing/notification/__init__.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"attach_print": 0,
|
||||||
|
"channel": "Email",
|
||||||
|
"condition": "doc.status == \"Received\" or doc.status == \"Partially Received\"",
|
||||||
|
"creation": "2019-04-29 11:53:23.981418",
|
||||||
|
"days_in_advance": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Notification",
|
||||||
|
"document_type": "Material Request",
|
||||||
|
"enabled": 1,
|
||||||
|
"event": "Value Change",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": 1,
|
||||||
|
"message": "<b>Material Request Type</b>: {{ doc.material_request_type }}<br>\n<b>Company</b>: {{ doc.company }}\n\n<h3>Order Summary</h3>\n\n<table border=2 >\n <tr align=\"center\">\n <th>Item Name</th>\n <th>Received Quantity</th>\n </tr>\n {% for item in doc.items %}\n {% if frappe.utils.flt(item.received_qty, 2) > 0.0 %}\n <tr align=\"center\">\n <td>{{ item.item_code }}</td>\n <td>{{ frappe.utils.flt(item.received_qty, 2) }}</td>\n </tr>\n {% endif %}\n {% endfor %}\n</table>",
|
||||||
|
"method": "",
|
||||||
|
"modified": "2019-05-01 18:02:51.090037",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Manufacturing",
|
||||||
|
"name": "Material Request Receipt Notification",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"recipients": [
|
||||||
|
{
|
||||||
|
"email_by_document_field": "requested_by"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sender_email": "",
|
||||||
|
"subject": "{{ doc.name }} has been received",
|
||||||
|
"value_changed": "status"
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
<b>Material Request Type</b>: {{ doc.material_request_type }}<br>
|
||||||
|
<b>Company</b>: {{ doc.company }}
|
||||||
|
|
||||||
|
<h3>Order Summary</h3>
|
||||||
|
|
||||||
|
<table border=2 >
|
||||||
|
<tr align="center">
|
||||||
|
<th>Item Name</th>
|
||||||
|
<th>Received Quantity</th>
|
||||||
|
</tr>
|
||||||
|
{% for item in doc.items %}
|
||||||
|
{% if frappe.utils.flt(item.received_qty, 2) > 0.0 %}
|
||||||
|
<tr align="center">
|
||||||
|
<td>{{ item.item_code }}</td>
|
||||||
|
<td>{{ frappe.utils.flt(item.received_qty, 2) }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
@ -0,0 +1,7 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def get_context(context):
|
||||||
|
# do your magic here
|
||||||
|
pass
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
frappe.listview_settings['Material Request'] = {
|
frappe.listview_settings['Material Request'] = {
|
||||||
add_fields: ["material_request_type", "status", "per_ordered"],
|
add_fields: ["material_request_type", "status", "per_ordered", "per_received"],
|
||||||
get_indicator: function(doc) {
|
get_indicator: function(doc) {
|
||||||
if(doc.status=="Stopped") {
|
if(doc.status=="Stopped") {
|
||||||
return [__("Stopped"), "red", "status,=,Stopped"];
|
return [__("Stopped"), "red", "status,=,Stopped"];
|
||||||
@ -8,7 +8,11 @@ frappe.listview_settings['Material Request'] = {
|
|||||||
} else if(doc.docstatus==1 && flt(doc.per_ordered, 2) < 100) {
|
} else if(doc.docstatus==1 && flt(doc.per_ordered, 2) < 100) {
|
||||||
return [__("Partially ordered"), "yellow", "per_ordered,<,100"];
|
return [__("Partially ordered"), "yellow", "per_ordered,<,100"];
|
||||||
} else if(doc.docstatus==1 && flt(doc.per_ordered, 2) == 100) {
|
} else if(doc.docstatus==1 && flt(doc.per_ordered, 2) == 100) {
|
||||||
if (doc.material_request_type == "Purchase") {
|
if (doc.material_request_type == "Purchase" && flt(doc.per_received, 2) < 100 && flt(doc.per_received, 2) > 0) {
|
||||||
|
return [__("Partially Received"), "yellow", "per_received,<,100"];
|
||||||
|
} else if (doc.material_request_type == "Purchase" && flt(doc.per_received, 2) == 100) {
|
||||||
|
return [__("Received"), "green", "per_received,=,100"];
|
||||||
|
} else if (doc.material_request_type == "Purchase") {
|
||||||
return [__("Ordered"), "green", "per_ordered,=,100"];
|
return [__("Ordered"), "green", "per_ordered,=,100"];
|
||||||
} else if (doc.material_request_type == "Material Transfer") {
|
} else if (doc.material_request_type == "Material Transfer") {
|
||||||
return [__("Transfered"), "green", "per_ordered,=,100"];
|
return [__("Transfered"), "green", "per_ordered,=,100"];
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
"projected_qty",
|
"projected_qty",
|
||||||
"actual_qty",
|
"actual_qty",
|
||||||
"ordered_qty",
|
"ordered_qty",
|
||||||
|
"received_qty",
|
||||||
"accounting_details",
|
"accounting_details",
|
||||||
"expense_account",
|
"expense_account",
|
||||||
"column_break_35",
|
"column_break_35",
|
||||||
@ -364,11 +365,16 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "section_break_37",
|
"fieldname": "section_break_37",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "received_qty",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Received Quantity"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2019-05-01 17:48:12.361976",
|
"modified": "2019-05-08 10:27:25.008801",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Material Request Item",
|
"name": "Material Request Item",
|
||||||
|
@ -35,6 +35,17 @@ class PurchaseReceipt(BuyingController):
|
|||||||
'percent_join_field': 'purchase_order',
|
'percent_join_field': 'purchase_order',
|
||||||
'overflow_type': 'receipt'
|
'overflow_type': 'receipt'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'source_dt': 'Purchase Receipt Item',
|
||||||
|
'target_dt': 'Material Request Item',
|
||||||
|
'join_field': 'material_request_item',
|
||||||
|
'target_field': 'received_qty',
|
||||||
|
'target_parent_dt': 'Material Request',
|
||||||
|
'target_parent_field': 'per_received',
|
||||||
|
'target_ref_field': 'qty',
|
||||||
|
'source_field': 'qty',
|
||||||
|
'percent_join_field': 'material_request'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'source_dt': 'Purchase Receipt Item',
|
'source_dt': 'Purchase Receipt Item',
|
||||||
'target_dt': 'Purchase Order Item',
|
'target_dt': 'Purchase Order Item',
|
||||||
|
@ -64,7 +64,9 @@
|
|||||||
"rejected_warehouse",
|
"rejected_warehouse",
|
||||||
"quality_inspection",
|
"quality_inspection",
|
||||||
"purchase_order",
|
"purchase_order",
|
||||||
|
"material_request",
|
||||||
"purchase_order_item",
|
"purchase_order_item",
|
||||||
|
"material_request_item",
|
||||||
"column_break_40",
|
"column_break_40",
|
||||||
"is_fixed_asset",
|
"is_fixed_asset",
|
||||||
"asset",
|
"asset",
|
||||||
@ -753,11 +755,22 @@
|
|||||||
"fieldname": "image_section",
|
"fieldname": "image_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Image"
|
"label": "Image"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "material_request",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Material Request",
|
||||||
|
"options": "Material Request"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "material_request_item",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Material Request Item"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2019-05-01 17:45:17.447900",
|
"modified": "2019-05-08 10:25:27.157675",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Purchase Receipt Item",
|
"name": "Purchase Receipt Item",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user