Best approach for field mapping

I need some guidance with mapping data between the Sales Order DocType and the Delivery Note Item doctype during the composing of a new Delivery Note using the 'From Sales Order' action.

My use case:

I have a custom field called po_number on the `Delivery Note Item` object. When building a Delivery Note from one or more Sales Orders, I want the `tabDelivery Note Item`.po_number to be populated with the value from the corresponding `tabSales Order`.po_no value.

For example. I have two Sales Orders, each with their own lines.

SO1 with po_no == abc
|--> SO1Line1
`--> SO1Line2

SO2 with po_no == 123
|--> SO2Line1
`--> SO2Line2


I create a new Delivery Note, and using the 'From Sales Order' action, I load both SO1 and SO2 onto this new delivery note.

The result I want is:

DeliveryNote1
|--> SO1Line1     po_number == abc
|--> SO1Line2     po_number == abc
|--> SO2Line1     po_number == 123
`--> SO2Line2     po_number == 123

What's the best approach for this? A Custom Script? Can someone please provide an example?

Thank you,
-Jev



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/68a5a6e8-2d97-4b37-8c1d-3a74b375f9e1%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

You can look into make_delivery_note() function in selling/doctype/sales_order/sales_order.py file.

That function maps doclist from sales order to delivery note. There is a sub-function called update_item(), you can easily add following line in that function to fulfil your requirements.

target.po_number = source_parent.po_number


On 22-Feb-2014, at 6:01 am, Jev Björsell <eb...@gmail.com> wrote:

I need some guidance with mapping data between the Sales Order DocType and the Delivery Note Item doctype during the composing of a new Delivery Note using the 'From Sales Order' action.

My use case:

I have a custom field called po_number on the `Delivery Note Item` object. When building a Delivery Note from one or more Sales Orders, I want the `tabDelivery Note Item`.po_number to be populated with the value from the corresponding `tabSales Order`.po_no value.

For example. I have two Sales Orders, each with their own lines.

SO1 with po_no == abc
|--> SO1Line1
`--> SO1Line2

SO2 with po_no == 123
|--> SO2Line1
`--> SO2Line2


I create a new Delivery Note, and using the 'From Sales Order' action, I load both SO1 and SO2 onto this new delivery note.

The result I want is:

DeliveryNote1
|--> SO1Line1     po_number == abc
|--> SO1Line2     po_number == abc
|--> SO2Line1     po_number == 123
`--> SO2Line2     po_number == 123

What's the best approach for this? A Custom Script? Can someone please provide an example?

Thank you,
-Jev



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/68a5a6e8-2d97-4b37-8c1d-3a74b375f9e1%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/2791D522-B773-4FA1-9A74-020FFF0B3297%40iwebnotes.com.

For more options, visit https://groups.google.com/groups/opt_out.

1 Like
Great. I put that mapping in place, restarted gunicorn, and everything is working well.

Thank you.
-Jev

On Sunday, February 23, 2014 8:10:52 PM UTC-8, Nabin Hait wrote:
You can look into make_delivery_note() function in selling/doctype/sales_order/sales_order.py file.

That function maps doclist from sales order to delivery note. There is a sub-function called update_item(), you can easily add following line in that function to fulfil your requirements.

target.po_number = source_parent.po_number


On 22-Feb-2014, at 6:01 am, Jev Björsell <eb...@gmail.com> wrote:

I need some guidance with mapping data between the Sales Order DocType and the Delivery Note Item doctype during the composing of a new Delivery Note using the 'From Sales Order' action.

My use case:

I have a custom field called po_number on the `Delivery Note Item` object. When building a Delivery Note from one or more Sales Orders, I want the `tabDelivery Note Item`.po_number to be populated with the value from the corresponding `tabSales Order`.po_no value.

For example. I have two Sales Orders, each with their own lines.

SO1 with po_no == abc
|--> SO1Line1
`--> SO1Line2

SO2 with po_no == 123
|--> SO2Line1
`--> SO2Line2


I create a new Delivery Note, and using the 'From Sales Order' action, I load both SO1 and SO2 onto this new delivery note.

The result I want is:

DeliveryNote1
|--> SO1Line1     po_number == abc
|--> SO1Line2     po_number == abc
|--> SO2Line1     po_number == 123
`--> SO2Line2     po_number == 123

What's the best approach for this? A Custom Script? Can someone please provide an example?

Thank you,
-Jev



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/68a5a6e8-2d97-4b37-8c1d-3a74b375f9e1%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a1055037-98ee-40f1-b552-0e4dc86c33ee%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.