Ignore mandatory fields

I wanna do frappe.new_doc(“Payment Entry”)
But i wanna ignore the mandatory fields, how can i do that?
I tried:

@frappe.whitelist()
def make_payment_entry(name, tipo_de_parte, empresa, data_de_postagem):
        payment_entry = frappe.new_doc("Payment Entry")
        payment_entry.naming_series = "TIT-A-PAGAR-"
        payment_entry.payment_type = "Pay"
        payment_entry.posting_date = data_de_postagem
        payment_entry.party = "Friboi"
        payment_entry.party_type = "Supplier"
        payment_entry.name = name
        payment_entry.party_type = tipo_de_parte
        payment_entry.company = empresa
tried this: payment_entry.save(payment_entry.flags.ignore_mandatory = True)
        return payment_entry.name

Error:
“The resource is not avaible”

have you tried:

@frappe.whitelist()
def make_payment_entry(name, tipo_de_parte, empresa, data_de_postagem):
payment_entry = frappe.new_doc(“Payment Entry”)
payment_entry.naming_series = “TIT-A-PAGAR-”
payment_entry.payment_type = “Pay”
payment_entry.posting_date = data_de_postagem
payment_entry.party = “Friboi”
payment_entry.party_type = “Supplier”
payment_entry.name = name
payment_entry.party_type = tipo_de_parte
payment_entry.company = empresa
payment_entry.flags.ignore_mandatory = True
payment_entry.save()
return payment_entry.name

1 Like

yep :confused:

You’re probably getting the error not because of the ignore flags issue, but something else. It often comes up if there is a syntax error in your code somewhere. It might not even be related to this method, but could be something else in the file. Also make sure your javascript is calling he correct function (full path).

Please share the javascript code as well.

My path method it’s right, my another method(of another post) is in the same file.

frappe.ui.form.on("Titulos", "refresh", function(frm) {
	if(frm.doc.workflow_state=="Liberado"){
		frm.add_custom_button(__("Rascunho"), function() {
        		// When this button is clicked, do this
			frappe.call({
				method: "erpnext.accounts.utils.make_payment_entry",
				args:{
					name: frm.doc.name,
					tipo_de_parte: frm.doc.tipo_de_parte,
					empresa: frm.doc.empresa,
					data_de_postagem: frm.doc.data_de_postagem,
				},
			callback: function(r)
			{}
			});
		});
	}
});

Guys not solved yet, if someone know how can i do this please reply.
Thank you very much! :wink:

Can close the topic, i don’t need ignore the fields.