Hello,
I am trying to create invoice child table rows using custom script. But getting error while saving the invoice.
Showing missing fields, which are actually not in the child table.
Also getting below errors on console.
amount: could not find docfield in method precision() desk.min.js:9122:12
price_list_rate: could not find docfield in method precision() desk.min.js:9122:12
base_price_list_rate: could not find docfield in method precision() desk.min.js:9122:12
rate: could not find docfield in method precision() desk.min.js:9122:12
base_rate: could not find docfield in method precision()
Thanks
Shan
Hi, please show us your code
HI
Below is the loop for adding items
var newrow = frappe.model.add_child(cur_frm.doc, "Sales Invoice", "items");
newrow.item_code = r.message[i][0];
newrow.item_name = r.message[i][1];
newrow.stock_uom = r.message[i][2];
newrow.description = "Test";
newrow.item_group = 'Products';
newrow.uom = r.message[i][2];
newrow.conversion_factor = 1;
newrow.stock_qty = 1;
newrow.qty = 1;
newrow.rate = flt(1.00);
newrow.base_rate = flt(1.00);
newrow.income_account = 'Sales - BMESC';
newrow.expense_account = 'Cost of Goods Sold - BMESC';
newrow.cost_center = 'Main - BMESC';
newrow.warehouse = 'Yard - BMESC';
Rows generated properly. But getting error while saving the document.
Try:
frappe.model.set_value(newrow.doctype, newrow.name, 'item_code', r.message[i][0])
Hi @watermelonUAE , can you show your errors? Maybe there are mandatory fields that needs to be set also.