Override default field mappings Ex: Delivery Note -> Sales Invoice

Hi All,


What's the best practice in V4 to customize field mappings between Doctype transitions?

My use case is as follows;

A shipment is made in 1 Jan, a Delivery Note is created with Posting Date of Jan 1.
On the 3rd of Jan, billing is processed. ERP Billing user goes to the Delivery Note and runs the "Make Invoice" action.
System produces a new Sales Invoice with Posting Date set to 3rd of January. I want the Posting Date to be mapped from the Delivery Note, Sales Invoice Posting Date should be 1 Jan.



Thanks!
-Jev



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

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

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/99f75a14-a98a-4f92-a11f-e496a8deb905%40googlegroups.com.

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

On 20-Jul-2014, at 3:34 am, Jev Björsell <eb...@gmail.com> wrote:

A shipment is made in 1 Jan, a Delivery Note is created with Posting Date of Jan 1.
On the 3rd of Jan, billing is processed. ERP Billing user goes to the Delivery Note and runs the "Make Invoice" action.
System produces a new Sales Invoice with Posting Date set to 3rd of January. I want the Posting Date to be mapped from the Delivery Note, Sales Invoice Posting Date should be 1 Jan.

There are no hooks around mappings right now. One temp solution would be to make a "Draft" invoice on the day of shipment and submit it later.

There could be a hook here though:


`target_doc.run_method('after_mapping', source_doc)`

Then add a hook in `doc_events`

You want to add this / test it and send a PR ?




Thanks!
-Jev



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



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

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

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/99f75a14-a98a-4f92-a11f-e496a8deb905%40googlegroups.com.

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



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

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

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/70217D9D-223C-422F-B5BA-EFD8121B459A%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
I will try find time to add that hook. :)


On Sun, Jul 20, 2014 at 10:18 PM, Rushabh Mehta <rm...@gmail.com> wrote:

On 20-Jul-2014, at 3:34 am, Jev Björsell <eb...@gmail.com> wrote:

A shipment is made in 1 Jan, a Delivery Note is created with Posting Date of Jan 1.
On the 3rd of Jan, billing is processed. ERP Billing user goes to the Delivery Note and runs the "Make Invoice" action.
System produces a new Sales Invoice with Posting Date set to 3rd of January. I want the Posting Date to be mapped from the Delivery Note, Sales Invoice Posting Date should be 1 Jan.

There are no hooks around mappings right now. One temp solution would be to make a "Draft" invoice on the day of shipment and submit it later.

There could be a hook here though:


`target_doc.run_method('after_mapping', source_doc)`

Then add a hook in `doc_events`

You want to add this / test it and send a PR ?




Thanks!
-Jev



Note:



If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

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



Note:



If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to a topic in the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/hugGQNPApXY/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/70217D9D-223C-422F-B5BA-EFD8121B459A%40gmail.com.


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



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

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

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAODcqunGCerFSE4cs7VNJjXSVW%3DQKA0RHvSB5M8u6nO5V7RSQg%40mail.gmail.com.

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