senario
I am using. buying price rate. of items in purchase Purchase Receipt.
to update default selling price list rate of item
I use that client script
frappe.ui.form.on("Purchase Receipt", "on_submit", function(frm) {
$.each(cur_frm.doc.items || [], function(i, v) { // for each item on table do this
var precoAntigo;
frappe.call({
method: "frappe.client.get_list",
args: {
doctype: "Item Price",
filters: [
['price_list', "=", cur_frm.doc.selling_price_list],
["item_code", "=", v.item_code],
],
fields: [
"price_list_rate",
"name"
]
},
callback: function(r) { // do this to found price list doc
precoAntigo = (r.message[0].price_list_rate);
var nomelista = r.message[0].name
// console.log(precoAntigo)
if (precoAntigo && precoAntigo != v.rate) {
frappe.confirm(
`Deseja atualizar o preço do item ${v.item_name} de ${ precoAntigo } para ${ v.rate} na lista de preços ${cur_frm.doc.selling_price_list} ?`, //ask something to update price
function() { // do this if ok
frappe.db.set_value("Item Price", nomelista, "price_list_rate", v.rate)
},
function() { // do nothing if cancel
}
)
}
}
});
})
})```
but it is work the selling price rate in pos. doesn't changed.
any help