How to add child table rows if not present

We have added a child table to Opportunity which stores some rows consisting of a string and a date. Code was added in opportunity.py to autopopulate this table with a few rows with predefined strings and initially blank dates, and opportunity.js had code added to set the date in the appropriate row when its corresponding string is selected from a Select in Opportunity (so we can keep track of when these were selected).

This works fine for newly-created Opportunities, but for Opportunities created before the code was modified, the added table is missing some rows. Is there a way we can modify opportunity.js so that when a string is selected from the Select, it will create a new row in the child table if it is not already present? We already have the check for rows' existence implemented, but it is adding new rows from JavaScript when necessary that we are stuck on. Thanks!



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/aa835667-864b-4e02-8ac5-8f8fca631b17%40googlegroups.com.

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

Can you share your fork?

We have a decided that since many devs are not complying with GPL norms (enhancements *must* be public) we will not help unless you share your fork and make public commits.

best,
Rushabh



@rushabh_mehta

On 11-Aug-2014, at 9:25 pm, Chris Horton <ch...@thedrainage.com> wrote:

We have added a child table to Opportunity which stores some rows consisting of a string and a date. Code was added in opportunity.py to autopopulate this table with a few rows with predefined strings and initially blank dates, and opportunity.js had code added to set the date in the appropriate row when its corresponding string is selected from a Select in Opportunity (so we can keep track of when these were selected).

This works fine for newly-created Opportunities, but for Opportunities created before the code was modified, the added table is missing some rows. Is there a way we can modify opportunity.js so that when a string is selected from the Select, it will create a new row in the child table if it is not already present? We already have the check for rows' existence implemented, but it is adding new rows from JavaScript when necessary that we are stuck on. Thanks!



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/aa835667-864b-4e02-8ac5-8f8fca631b17%40googlegroups.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/A68FBD3D-18DB-4D2B-91F8-A21743F2E90E%40gmail.com.

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