Delivery Date Script

I need to add delivery date to my invoice … what is the script for it
i tried following

(doc.transaction_date)

(doc.posting_date)

(doc.lr_date)

delivery date is a part of order form it was not a custom field

someone please help

It’s “delivery_date”

You can check fieldnames via

Setup > Customize > Customize Form View

tried delivery_date but i am not getting anything

If you are making invoice from sales order then it should get copied automatically.

Hi, we were trying also to insert the delivery date in the sales invoice and is not working. Our sales invoices come from delivery notes and DNs come from sales orders.

delivery_date is not one of the fields in Setup > Customize > Customize Form View > Sales Invoice

How can we add it?

Add a Custom Field…

Yes we were following this guide to know more about but the problem is that the new custom field has to be linked with the value of the delivery date of the sales order/delivery note, it is not just a new date field.

You have to add a new custom field with exactly same field name as Sales Order, i.e. “delivery_date”, it should be copied automatically.

While making custom field make sure “No Copy” property is unchecked. Also ensure that “No Copy” property is unchecked for “delivery_date” field in Sales Order as well.

We added a new custom field with the Fieldname delivery_date but it is still not working, we are recalling it in the custom sales invoice print format with date.str_to_user(doc.delivery_date)

I send a screenshot with the new field settings.

Hi, sorry to bother again about this, do you have any idea on how the delivery_date field is not working like this for invoices? Thank you.

It is not working because no_copy property for delivery_date is checked in Sales Order.
You can make a Property Setter record to disable no_copy property.

HI,we tried to make a new Property Setter but is not working, i send screenshot:

Hi, any news on this? As explained no_copy property for delivery_date is disabled but still the delivery date is not forwarded to the sales invoice.

Too bottlenecked to look into this… Can you debug:

Yes, we have exactly the same code in frappe-bench/apps/erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py

doc = get_mapped_doc("Delivery Note", source_name,      {
                "Delivery Note": {
                        "doctype": "Sales Invoice",
                        "validation": {
                                "docstatus": ["=", 1]
                        }
                },
                "Delivery Note Item": {
                        "doctype": "Sales Invoice Item",
                        "field_map": {
                                "name": "dn_detail",
                                "parent": "delivery_note",
                                "prevdoc_detail_docname": "so_detail",
                                "against_sales_order": "sales_order",
                                "serial_no": "serial_no"
                        },
                        "postprocess": update_item,
                        "filter": lambda d: d.qty - invoiced_qty_map.get(d.name, 0)<=0
                },

I meant, you will have to add prints in get_mapped_doc to check why your value is not getting copied over.

But the delivery date comes from the sales order, if you see the history of the post, we were told to “add a new custom field with exactly same field name as Sales Order, i.e. “delivery_date”, it should be copied automatically.”

We do always SO->DN->SINV. Can be that the delivery date from the sales order is not reaching the SINV directly and we have to reach it through the Delivery Note? This would be a problem because the fieldname for the delivery date in DN is posting_date, but posting_date has another meaning in SINV (Invoice date).

Sorry was not able to track this. Yes it has to come via the Delivery Note. You can keep your delivery_note field hidden.

We just opened a feature request in Github, as we think this should work as default. At least for european companies the delivery date must be always in the invoice:
https://github.com/frappe/erpnext/issues/2756

1 Like