I have a custom doctype “offers” which links to “Quotation Item”. I want to auto create the “offers” everytime the user inputs an item.
I think this can be done on the server side by adding a create function at on_submit function in quotation.py ? How can I ensure the relation always stays 1:1.
ie for every item in quotation one unique offers is created.
“Quotation Item” table contains link to “Offers” a custom Doctype
In quotation.py
offer is the fieldname given in Quotation Item to link with Offers doctype
def on_update(self):
for d in self.get('quotation_details'):
if not d.offer:
n_offers = frappe.get_doc({"doctype":"Offers"})
n_offers.insert()
frappe.db.set_value(d.doctype, d.offer, "offer", n_offers)
The above code creates my custom doc Offers. I need to link it to Quotation Item. The last line works?