Quotation item Calculations

Dears

i added a new custom field in quotation item

and added this script from custom script Quotation Item

now it suppose when i selct an item and its quoantity it suppuse to gets a value in the filed Full price

But actually i didnt get any value in it

Hint
i followed that post
Calculate a value for custom field - #3 by Roy_Stephen

any help?
i need to know how can i deal with child table

Hi

or you can try

frappe.ui.form.on("Quotation Item", "full_price", function(frm, doctype, name){
      var row = locals[doctype][name]
     frm.set_value("full_price", row.qty * row.price_list_rate);
})
1 Like

thanks vinhnguyent090
for your help i tried it .
it didnt work also

even i made a custom filed named full_price

and i tried another code But also didnt work .

By the way i added those in custome scrept menue and i choose Quotation Item

should i choose Quotation Or Quotation Item ?

frappe.ui.form.on(“Quotation Item”, “qty”, function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, “full_price”, d.qty * d.price_list_rate); > });
frappe.ui.form.on(“Quotation Item”, “price_list_rate”, function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, “full_price”, d.qty * d.price_list_rate);
});

Hi @sheno

I think you have error at choose Doctype of Custom Script: correct is Quotation not Quotation Item

Pls try again.

v1

1 Like

I followed your advice and changed the Quotation item ToBe Quotation instead.

BUT

I got this error when I create new quotation.

SyntaxError: Unexpected token >
at Class.setup (https://erp.fastgrp.net/assets/js/form.min.js:2507:18)
at _f.Frm.setup (https://erp.fastgrp.net/assets/js/form.min.js:174:22)
at _f.Frm.refresh (https://erp.fastgrp.net/assets/js/form.min.js:454:30)
at Class.load (https://erp.fastgrp.net/assets/js/form.min.js:87:33)
at https://erp.fastgrp.net/assets/js/form.min.js:82:7
at Object.with_doc (https://erp.fastgrp.net/assets/js/desk.min.js:6085:4)
at Class.show_doc (https://erp.fastgrp.net/assets/js/form.min.js:65:16)
at https://erp.fastgrp.net/assets/js/form.min.js:24:8
at Object.with_doctype (https://erp.fastgrp.net/assets/js/desk.min.js:6023:17)
at Class.make (https://erp.fastgrp.net/assets/js/form.min.js:20:17)

Hi

Your js is error. Try again my js

    frappe.ui.form.on("Quotation Item", "full_price", function(frm, doctype, name){
      var row = locals[doctype][name]
     frm.set_value("full_price", row.qty * row.price_list_rate);
})

Your code works with field on Quotation, not on Quotation Item.

1 Like

Yes, you are correct,

try it

frappe.ui.form.on("Quotation Item", "full_price", function(frm, doctype, name){
    var row = locals[doctype][name];
    frappe.model.set_value(doctype, name, "full_price", row.qty * row.price_list_rate);
})