Hi:
I wrote a function that gets triggered when the field is_pos is changed on my client side script for the DocType Sales Invoice.
The problem is that on that script, the evaluation of the field pos_profile is always null.
Printing its content on the console also gives undefined. However if I print its content of the doc returns the expected data for the POS Profile.
Here is my code:
frappe.ui.form.on('Sales Invoice', 'is_pos', function(frm) {
console.log('CUSTOM: This is the content of the document');
console.log(cur_frm.doc);
console.log('CUSTOM: This is the content of the POS Profile on the document ');
console.log(cur_frm.doc.pos_profile);
});
I always get a this:
CUSTOM: This is the content of the document
{docstatus: 0, doctype: "Sales Invoice", name: "New Sales Invoice 1", __islocal: 1, (more content...)plc_conversion_rate: 1**pos_profile: "Alejandra Fernandez"**pos_total_qty: 0
CUSTOM: This is the content of the POS Profile on the document
**undefined**
I guess I’m not understanding something that must be basic. May you please help me to understand?
Thank you!