Why my Child doctype block my master doctype to save?

I have 2 DocTypes, Nota Entrada and Nota Entrada Itens

My problem… We can see on last image, After fill all required fields, try to save, and nothing… continue says Not Saved

Set as these:

Nota Entrada (set as Table [ Tabela ] and on option set my doctype child [ Nota Entrada Itens ] ):

and my Nota Entrada itens, set as Child and Editable Grid :

Here is my DocType when I create a new one:

I do not have any code on my python files… only on nota_entrada .js :

frappe.ui.form.on('Nota Entrada', {
    refresh: function (frm) {

    }
});


// Atualizando o valor total dos itens
frappe.ui.form.on('Nota Entrada Itens', {
	"qtde": function(frm, cdt, cdn) {
		let gridRow = frm.open_grid_row();
		if (!gridRow) {
			gridRow = frm.get_field('itens').grid.get_row(cdn);
		}
		calAmount(gridRow);
	},
	"vlr_unit": function(frm, cdt, cdn) {
		let gridRow = frm.open_grid_row();
		if (!gridRow) {
			gridRow = frm.get_field('itens').grid.get_row(cdn);
		}
		calAmount(gridRow);
	},
});


function calAmount(gridRow) {
	let qtde = gridRow.on_grid_fields_dict.qtde.value;
	let vlr_unit = gridRow.on_grid_fields_dict.vlr_unit.value;
	let amount = qtde * vlr_unit;
	frappe.model.set_value(
		gridRow.doc.doctype,
		gridRow.doc.name,
		'vlr_total',
		amount
		);
}

Hi,

Try debugging. Here are some pointers:

  • In above image the row 2 is empty, but you’ve set produto as mandatory.
  • Sometimes clearing the cache works: Ctrl + Shift + R
  • Check the console.

Got these on browser console:

quill Overwriting modules/mention with 
function Mention()
logger.js:11:20
TypeError: txt.replace is not a function[Learn More] common.js:110:8
Use of Mutation Events is deprecated. Use MutationObserver instead. control.min.js:38:4
TypeError: (intermediate value).trim is not a function[Learn More] toolbar.js:33:74 

I see you have marked Produto as a mandatory field. Can you select an item it and then try saving ?

That’s not the problem… I remove the “empty” row, and tried again… these error appears on Browser console.:

TypeError: (intermediate value).trim is not a function[Learn More] toolbar.js:33:74

console.trace() TypeError: "(intermediate value).trim is not a function"

    set_title toolbar.js:33 refresh toolbar.js:14 init toolbar.js:8 setup form.js:93 refresh form.js:428 load formview.js:85 show_doc formview.js:79 callback model.js:175 callback request.js:73 200 request.js:98 call request.js:217 i4jQuery

request.js:221:4

    call request.js:221 i4jQuery

nothing on python console.

The problem is on these line on toolbar.js:

var title = strip_html((this.frm.doc[this.frm.meta.title_field] || "").trim() || this.frm.docname);

Found the problem.

The problem is on my Master doctype, I set as Title a integer field… just remove the Title Field and put a string one, and woks!

1 Like