How to display Items rate from price list that are added in Material request in email alert message

Hi There

This is my 3rd query for this month so pls bear with me.

How to display Items rate from price list that are added in Material request in email alert message?

This my current code


{% set u = frappe.get_doc(“User”, doc.owner) %}
Dear {{u.first_name}} {{ u.last_name }}
Material request {{ doc.name }} has been approved by manager and needs your approval.

    {% for item in doc.items %}
  • Item requested :- {{ item.item_code }}
  • Quantity :- {{item.qty}}
  • {% endfor %}
  • Reason for purchase :- {{ doc.justification }}
Please approve by login to ERP system ( http://erp.bom.******.com/desk#Form/Material%20Request/{{ doc.name }})..

Thanks

{% set pl_rate = frappe.db.get_value("Item Price", {"item_code": "your_item_code", "price_list": "your_price_list_name"}, "price_list_rate") %}

{{ pl_rate }}

@nabinhait
Not working, Also not sure what is your_item_code and your_price_list_name. Do I need hardcore Item code and and price list name while passing argument ?

Dear Parvez Akhtar Your Material request MREQ-00031 has been approved by manager and needs your approval.
Item requested :- Dell 3543 Laptop
Quantity :- 1
Cost of Item None
Reason for purchase :- qxa

You have to add this code inside for loop, and there you should use item.item_code for item. But as there is no price list name in the material request, you have to hard-code it.

Still not working.

This is my code
{% set u = frappe.get_doc(“User”, doc.owner) %}
Dear {{u.first_name}} {{ u.last_name }}
Your Material request {{ doc.name }} has been approved by manager and needs your approval.

    {% for item in doc.items %}
  • Item requested :- {{ item.item_code }}
  • Quantity :- {{item.qty}}
  • {% set pl_rate = frappe.db.get_value("Item Price", {"item_code": "item.item_code", "price_list": "Standard Buying"}, "price_list_rate") %} Cost of Item {{ pl_rate }} {% endfor %}
  • Reason for purchase :- {{ doc.justification }}

Please approve by login ERP system

Dear Parvez Akhtar Your Material request MREQ-00031 has been approved by manager and needs your approval.
Item requested :- Dell 3543 Laptop
Quantity :- 1
Cost of Item None
Item requested :- laptop
Quantity :- 1
Cost of Item None
Item requested :- Macbook Pro 85W Charger
Quantity :- 1
Cost of Item None
Reason for purchase :- Tsting price

bump

Hi, this is quite long time but I happened to face the same issue as you. Was wondered if you already found the solution. If you do, hope you don’t mind to share it.

my line of codes :

{% 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 %}

However, the item code and the received quantity is not showing anything eventhough there is a record.

is this the correct way ? Seeking advise and guides.
Thank you.