Customize Quotation Item

i want to understand some logics.

for example

1- when i make a new quotation i chose ITEM
and when i chose the item
i see that its and description and some info come automatically

how that fetch process happened is that some hidden script ? can i see it ?

2- when i choose item and choose its quantity
for example

item       = hp 
quantity = 2
 rate = 50
amount = ?

i see that the program make that calculate 2*50=100
so how the program do that

can i see that script ?

thanks a lot for your help

You can use add_fetch for fetching values from master. Refer following link -
https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/custom-script-fetch-values-from-master

Refer following link for field value calculations -

Thanks, Priya

thanks a lot dear
i will read that article now

dear

i follow the links : and what i did is
1- created a new Doctype and give it name calculator
i created three fields
first int
second int
third int

2- i used Custome Script and choose module calculator
and past

frappe.ui.form.on(“doctype_name”, “field1”, function(frm) {
frm.set_value(“field3”, flt(frm.doc.field1) + flt(frm.doc.field2));
})

frappe.ui.form.on(“doctype_name”, “field2”, function(frm) {
frm.set_value(“field3”, flt(frm.doc.field1) + flt(frm.doc.field2));
})

3- i linked that DOCtype with Quotaion
so when i open new quotation i see that new table " calculator "

so when i feed the table with

first 3
second 7
Third didnt calculate any thing even after save the quotation

why i dont know .

@sheno, Calculator is Child Table and syntax are different for child tables also you have to create script for Quotation not for child table(calculator). Try with this -

1 Like

dears

i have a scenario that i want to add a custom filed in the Quotation item table

The filed Name Profit type currency

i need this filed = margine percentage * price * unit number

For example

when we make a quotation we select item table

item code cisco switch
Price List Rate 1000 us
Quantity 5
margine percentage
percentage 10

so
profit=10/100 * 1000 *5=500

how can we do this using scripting?

Best Regards

i used this script

frappe.ui.form.on(“Quotation”, “validate”, function(frm, doc) {
$.each(frm.doc[“Quotation Item”] || [], function(i, d) {
d.margine_value=d.amount * 0.1
});
});

But as we see Margine Value didnt change
according the script it should be

300 * 0.1 = 30

even if press submit .
no thing happen .

waiting your view my friends

Hi,

Any solution to this?