Supplier Items Part Number onto Quotation

The imported items in my installation all have the supplier_part_number set on the supplier_items (as it is already on the e.g. purchase order).
As our customers know these numbers, I would like to also already have them on the quotation.

I already tried via “fetch” an additional “supplier_code” field on the quotation item. Does not work.
Also tried via custom script

frappe.db.get_value("Item Supplier", { "item_code": d.item_code, }, "supplier_part_no", function (value) { if (typeof value.supplier_part_no !== "undefined") { d.supplier_code = value.supplier_part_no; } });

Does not work, only gives a permission error.

How can I get the Supplier Part Number onto the Quotation?

frappe.db.get_value("Item Supplier", { "parent": d.item_code, }, "supplier_part_no", function (value) { 
    if (typeof value.supplier_part_no !== "undefined") 
    { d.supplier_code = value.supplier_part_no; } });

this custom script doesnt work. permision error. seems like th “item supplier” doctype cannot be assigned permissions for actual users?
is this only accessible via server script?

seems like this, within the print format is working:

 {% set supplier_part_no = frappe.db.get_value("Item Supplier", {'parent': n.item_code}, "supplier_part_no") %}

{% if supplier_part_no %}
			{{_("Supplier Part No") + ": "+ supplier_part_no}}
{% endif %}

Hi @moe01325
I have the same issue, please advise how can I use this script to add the Supplier Part Number to the items table in the quotation. I’m mainly concerned about having this in the print format.

Thanks,

the script I posted above is part of the custom print format.

Thanks @moe01325 , actually I’m new in customization, can’t find where to put this code.
I made a customized print format in the Quotation added and removed some fields using the builder. But can’t find where to put your script to launch it with Print or PDF buttons.

Jinja print formats.
in the html field.

1 Like