Hello Everyone and @NCP ,
If Sales invoice is approved and we update address, but in print format only that address will be visible which is approved in doc then how to add updated address dynamically in print format.
For ex. if we update gst, or address line 2 in address , then in approved sales invoice we cant update address but how we can show that updated address in print format.
@Shraddha33 , please add below code in your tag.
{% set links = frappe.get_all('Dynamic Link',
filters={'link_doctype': 'Customer', 'link_name': doc.customer, 'parenttype': 'Address'},
fields=['parent']) %}
{% if links %}
<b>Company Details : <br>{{doc.customer}}</b><br>
<b>Address :</b> {{frappe.db.get_value("Address", links[0].parent, "address_line1")}}
{{ frappe.db.get_value("Address", links[0].parent, "address_line2") }} <br>
{{ frappe.db.get_value("Address", links[0].parent, "city") }} <br>
{{ frappe.db.get_value("Address", links[0].parent, "state") }} -
{{ frappe.db.get_value("Address", links[0].parent, "pincode") }}<br>
<b>Phone :</b> {{ frappe.db.get_value("Address", links[0].parent, "phone") or "---" }}
<br><b>Email :</b> {{ frappe.db.get_value("Address", links[0].parent, "email_id") or "---" }}<br>
<b>Website :</b> yoursite <br>
<b>GSTIN :</b> {{ frappe.db.get_value("Address", links[0].parent, "gstin") or "---" }}
{% endif %}
Two things
- To allow changes on addresses after approval is process wise bad design. E.g Address change have huge impact on sales taxes, tax composition (Central vs State) and credits. Therefore as a business owner I would like to see any changes/amendment that have potential impact on invoices and taxes configuration should be approved or no alteration after submission. In short, change in address changes the GSTINs used in various sales documents. Be careful on un-monitored changes.
- how to: I think easiest way to do is allow edit after submit for that field. You can do this in ‘customize form’ and for that address field check ‘allow on submit’. After that whenever you update address the invoice will take the new address.
Further, what about other documents like delivery notes etc. Address are part of various documents in process, Sales Order, Sales Delivery Note, Sales Invoice? Will you be able to make sure coherence is maintained (which should ideally be the approval checks)
Hello @jalajc sir,
Thanks for reply but in customized form standard fields will not allow to update.
ohh yes, sorry I forgot.
But eventually, why don’t you consider cancel invoice, amend, generate new one? Any specific reason?
Thank you @Suresh_Thakor for your reply…
It works if there is single address for customer.
but if there is single customer and multiple addresses then it will fail to update right one. please suggest
waiting for reply
this is the best suggestion.