Doubts with the creation of a new widget

Hello, All!

I’m trying to create a new widget called Form for my instance of ERPNext, the functionality of it is the same as Table, with the exception that it points only to a single child (would be a one-to-one).

I have already created the code of the widget, and changes in DocField, and webnotes.model.meta.get_link_fields and webnotes.model.meta.get_table_fields

But when I try to fetch the fields in the browser using wn.meta.get_docfields ('Address'), the response I have is none, exists somewhere to r, for this to work?

My idea is to have something like shown below

Imagem inline 1

--

Maxwell Morais
Tecnologia da Informação
+55 11 3931-1412 Ramal 31

www.realizemodulados.com.br



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.

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

This is difficult to say without debugging it using some print statements or breakpoints.

Have you instead, tried to use a table field and restrict the number of rows to just 1. You won't need to create a whole new sub-form widget!

Thanks,
Anand.


On Tue, Dec 17, 2013 at 8:19 PM, Maxwell Morais <ma...@gmail.com> wrote:

Hello, All!

I’m trying to create a new widget called Form for my instance of ERPNext, the functionality of it is the same as Table, with the exception that it points only to a single child (would be a one-to-one).

I have already created the code of the widget, and changes in DocField, and webnotes.model.meta.get_link_fields and webnotes.model.meta.get_table_fields

But when I try to fetch the fields in the browser using wn.meta.get_docfields ('Address'), the response I have is none, exists somewhere to r, for this to work?

My idea is to have something like shown below

Imagem inline 1

--

Maxwell Morais
Tecnologia da Informação
+55 11 3931-1412 Ramal 31

www.realizemodulados.com.br



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.

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




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.

    For more options, visit https://groups.google.com/groups/opt_out.
Anand, when you says:


Have you instead, tried to use a table field and restrict the number of rows to just 1. You won't need to create a whole new sub-form widget!



Are you referring to a custom script to handle this?
Thanks,
Anand.


On Tue, Dec 17, 2013 at 8:19 PM, Maxwell Morais <ma...@gmail.com> wrote:

Hello, All!

I’m trying to create a new widget called Form for my instance of ERPNext, the functionality of it is the same as Table, with the exception that it points only to a single child (would be a one-to-one).

I have already created the code of the widget, and changes in DocField, and webnotes.model.meta.get_link_fields and webnotes.model.meta.get_table_fields

But when I try to fetch the fields in the browser using wn.meta.get_docfields ('Address'), the response I have is none, exists somewhere to r, for this to work?

My idea is to have something like shown below

Imagem inline 1

--

Maxwell Morais
Tecnologia da Informação



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.

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




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.

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




--

Maxwell Morais
Tecnologia da Informação
+55 11 3931-1412 Ramal 31

www.realizemodulados.com.br



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.

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

Uncaught TypeError: Cannot read property 'istable' of undefined

  1. all-app.min.js:1803
    1. _f.Frm.setup_metaall-app.min.js:1803
    2. wn.ui.form.ControlForm.wn.ui.form.Control.extend.makeall-app.min.js:2173
    3. prototype.(anonymous function)all-app.min.js:149
    4. wn.ui.form.Control.Class.extend.initall-app.min.js:2087
    5. wn.ui.form.make_controlall-app.min.js:2085
    6. wn.ui.form.Layout.Class.extend.make_fieldall-app.min.js:633
    7. (anonymous function)all-app.min.js:629
    8. b.extend.eachjquery.min.js:2
    9. wn.ui.form.Layout.Class.extend.renderall-app.min.js:629
    10. wn.ui.form.Layout.Class.extend.makeall-app.min.js:626
    11. _f.Frm.setup_std_layoutall-app.min.js:1794
    12. _f.Frm.refreshall-app.min.js:1813
    13. wn.views.FormFactory.wn.views.Factory.extend.loadall-app.min.js:1280
    14. (anonymous function)all-app.min.js:1280
    15. $.extend.with_docall-app.min.js:701
    16. wn.views.FormFactory.wn.views.Factory.extend.show_docall-app.min.js:1278
    17. (anonymous function)all-app.min.js:1277
    18. $.extend.with_doctypeall-app.min.js:696
    19. wn.views.FormFactory.wn.views.Factory.extend.makeall-app.min.js:1277
    20. wn.views.Factory.Class.extend.showall-app.min.js:1082
    21. (anonymous function)all-app.min.js:356
    22. b.event.dispatchjquery.min.js:2


But I understand that this happens because the doctype does not exist in locals

However, I thought that modify webnotes.model.meta , whatever sufiente to enable loading of the fields automatically, but realized that there's something missing!



2013/12/17 Maxwell Morais <ma...@gmail.com>
Anand, when you says:



Have you instead, tried to use a table field and restrict the number of rows to just 1. You won't need to create a whole new sub-form widget!



Are you referring to a custom script to handle this?
Thanks,
Anand.


On Tue, Dec 17, 2013 at 8:19 PM, Maxwell Morais <ma...@gmail.com> wrote:

Hello, All!

I’m trying to create a new widget called Form for my instance of ERPNext, the functionality of it is the same as Table, with the exception that it points only to a single child (would be a one-to-one).

I have already created the code of the widget, and changes in DocField, and webnotes.model.meta.get_link_fields and webnotes.model.meta.get_table_fields

But when I try to fetch the fields in the browser using wn.meta.get_docfields ('Address'), the response I have is none, exists somewhere to r, for this to work?

My idea is to have something like shown below

Imagem inline 1

--

Maxwell Morais
Tecnologia da Informação



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.

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




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.

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




--

Maxwell Morais
Tecnologia da Informação




--

Maxwell Morais
Tecnologia da Informação
+55 11 3931-1412 Ramal 31

www.realizemodulados.com.br



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.

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

You can use the custom_validate method both on client and server side to check if more than one rows exist.

Also. on the client side, when a new row is added in the grid, if the grid's fieldname is say, "sales_team",
then cur_frm.cscript.custom_sales_team_add is called with arguments (child_doctype, child_docname) - see https://github.com/webnotes/wnframework/blob/master/public/js/wn/form/grid.js#L159

Hence, here you can raise exception if the number of rows exceeds 1 in the doclist and also remove the newly added row from the doclist.

Thanks,
Anand.



On Wed, Dec 18, 2013 at 12:40 AM, Maxwell Morais <ma…@gmail.com> wrote:

Anand, when you says:


Have you instead, tried to use a table field and restrict the number of rows to just 1. You won't need to create a whole new sub-form widget!



Are you referring to a custom script to handle this?
Thanks,
Anand.


On Tue, Dec 17, 2013 at 8:19 PM, Maxwell Morais <ma...@gmail.com> wrote:

Hello, All!

I’m trying to create a new widget called Form for my instance of ERPNext, the functionality of it is the same as Table, with the exception that it points only to a single child (would be a one-to-one).

I have already created the code of the widget, and changes in DocField, and webnotes.model.meta.get_link_fields and webnotes.model.meta.get_table_fields

But when I try to fetch the fields in the browser using wn.meta.get_docfields ('Address'), the response I have is none, exists somewhere to r, for this to work?

My idea is to have something like shown below

Imagem inline 1

--

Maxwell Morais
Tecnologia da Informação



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.

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




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.

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




--

Maxwell Morais
Tecnologia da Informação
+55 11 3931-1412 Ramal 31

www.realizemodulados.com.br



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.

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




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.

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

When a form is loaded, all table type doctypes, which are the children of the main form, are also loaded.

Since your fieldtype is totally new and contains a child doctype, you might need to modify this code.

But, I suggest that you go with the table type field and restrict it to just 1 row using custom script–much easier to maintain in the long run.

Thanks,
Anand.




On Wed, Dec 18, 2013 at 12:49 AM, Maxwell Morais <ma...@gmail.com> wrote:
Anand,


Uncaught TypeError: Cannot read property 'istable' of undefined

  1. all-app.min.js:1803
    1. _f.Frm.setup_metaall-app.min.js:1803
    2. wn.ui.form.ControlForm.wn.ui.form.Control.extend.makeall-app.min.js:2173
    3. prototype.(anonymous function)all-app.min.js:149
    4. wn.ui.form.Control.Class.extend.initall-app.min.js:2087
    5. wn.ui.form.make_controlall-app.min.js:2085
    6. wn.ui.form.Layout.Class.extend.make_fieldall-app.min.js:633
    7. (anonymous function)all-app.min.js:629
    8. b.extend.eachjquery.min.js:2
    9. wn.ui.form.Layout.Class.extend.renderall-app.min.js:629
    10. wn.ui.form.Layout.Class.extend.makeall-app.min.js:626
    11. _f.Frm.setup_std_layoutall-app.min.js:1794
    12. _f.Frm.refreshall-app.min.js:1813
    13. wn.views.FormFactory.wn.views.Factory.extend.loadall-app.min.js:1280
    14. (anonymous function)all-app.min.js:1280
    15. $.extend.with_docall-app.min.js:701
    16. wn.views.FormFactory.wn.views.Factory.extend.show_docall-app.min.js:1278
    17. (anonymous function)all-app.min.js:1277
    18. $.extend.with_doctypeall-app.min.js:696
    19. wn.views.FormFactory.wn.views.Factory.extend.makeall-app.min.js:1277
    20. wn.views.Factory.Class.extend.showall-app.min.js:1082
    21. (anonymous function)all-app.min.js:356
    22. b.event.dispatchjquery.min.js:2


But I understand that this happens because the doctype does not exist in locals

However, I thought that modify webnotes.model.meta , whatever sufiente to enable loading of the fields automatically, but realized that there's something missing!



2013/12/17 Maxwell Morais <ma...@gmail.com>
Anand, when you says:



Have you instead, tried to use a table field and restrict the number of rows to just 1. You won't need to create a whole new sub-form widget!



Are you referring to a custom script to handle this?
Thanks,
Anand.


On Tue, Dec 17, 2013 at 8:19 PM, Maxwell Morais <ma...@gmail.com> wrote:

Hello, All!

I’m trying to create a new widget called Form for my instance of ERPNext, the functionality of it is the same as Table, with the exception that it points only to a single child (would be a one-to-one).

I have already created the code of the widget, and changes in DocField, and webnotes.model.meta.get_link_fields and webnotes.model.meta.get_table_fields

But when I try to fetch the fields in the browser using wn.meta.get_docfields ('Address'), the response I have is none, exists somewhere to r, for this to work?

My idea is to have something like shown below

Imagem inline 1

--

Maxwell Morais
Tecnologia da Informação



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.

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




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.

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




--

Maxwell Morais
Tecnologia da Informação




--

Maxwell Morais
Tecnologia da Informação
+55 11 3931-1412 Ramal 31

www.realizemodulados.com.br



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.

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




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.

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

As I am stubborn, I preferred the second alternative you showed me and it really worked.

Here's how it fits:

I'm working on a script to hide the additional fields, and then I'll mecher with styles, but the result has pleased me.




2013/12/18 Anand Doshi <an…@erpnext.com>

Hi Max,

When a form is loaded, all table type doctypes, which are the children of the main form, are also loaded.

Since your fieldtype is totally new and contains a child doctype, you might need to modify this code.

But, I suggest that you go with the table type field and restrict it to just 1 row using custom script–much easier to maintain in the long run.

Thanks,
Anand.




On Wed, Dec 18, 2013 at 12:49 AM, Maxwell Morais <ma...@gmail.com> wrote:
Anand,


Uncaught TypeError: Cannot read property 'istable' of undefined

  1. all-app.min.js:1803
    1. _f.Frm.setup_metaall-app.min.js:1803
    2. wn.ui.form.ControlForm.wn.ui.form.Control.extend.makeall-app.min.js:2173
    3. prototype.(anonymous function)all-app.min.js:149
    4. wn.ui.form.Control.Class.extend.initall-app.min.js:2087
    5. wn.ui.form.make_controlall-app.min.js:2085
    6. wn.ui.form.Layout.Class.extend.make_fieldall-app.min.js:633
    7. (anonymous function)all-app.min.js:629
    8. b.extend.eachjquery.min.js:2
    9. wn.ui.form.Layout.Class.extend.renderall-app.min.js:629
    10. wn.ui.form.Layout.Class.extend.makeall-app.min.js:626
    11. _f.Frm.setup_std_layoutall-app.min.js:1794
    12. _f.Frm.refreshall-app.min.js:1813
    13. wn.views.FormFactory.wn.views.Factory.extend.loadall-app.min.js:1280
    14. (anonymous function)all-app.min.js:1280
    15. $.extend.with_docall-app.min.js:701
    16. wn.views.FormFactory.wn.views.Factory.extend.show_docall-app.min.js:1278
    17. (anonymous function)all-app.min.js:1277
    18. $.extend.with_doctypeall-app.min.js:696
    19. wn.views.FormFactory.wn.views.Factory.extend.makeall-app.min.js:1277
    20. wn.views.Factory.Class.extend.showall-app.min.js:1082
    21. (anonymous function)all-app.min.js:356
    22. b.event.dispatchjquery.min.js:2


But I understand that this happens because the doctype does not exist in locals

However, I thought that modify webnotes.model.meta , whatever sufiente to enable loading of the fields automatically, but realized that there's something missing!



2013/12/17 Maxwell Morais <ma...@gmail.com>
Anand, when you says:



Have you instead, tried to use a table field and restrict the number of rows to just 1. You won't need to create a whole new sub-form widget!



Are you referring to a custom script to handle this?
Thanks,
Anand.


On Tue, Dec 17, 2013 at 8:19 PM, Maxwell Morais <ma...@gmail.com> wrote:

Hello, All!

I’m trying to create a new widget called Form for my instance of ERPNext, the functionality of it is the same as Table, with the exception that it points only to a single child (would be a one-to-one).

I have already created the code of the widget, and changes in DocField, and webnotes.model.meta.get_link_fields and webnotes.model.meta.get_table_fields

But when I try to fetch the fields in the browser using wn.meta.get_docfields ('Address'), the response I have is none, exists somewhere to r, for this to work?

My idea is to have something like shown below

Imagem inline 1

--

Maxwell Morais
Tecnologia da Informação



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.

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




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.

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




--

Maxwell Morais
Tecnologia da Informação




--

Maxwell Morais
Tecnologia da Informação



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.

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




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.

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




--

Maxwell Morais
Tecnologia da Informação
+55 11 3931-1412 Ramal 31

www.realizemodulados.com.br



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.

    For more options, visit https://groups.google.com/groups/opt_out.
Hi Max.. Looks cool. Glad that you were able to figure it out :)

-Anand.


On Wed, Dec 18, 2013 at 7:59 PM, Maxwell Morais <ma...@gmail.com> wrote:
Hello Anand!


As I am stubborn, I preferred the second alternative you showed me and it really worked.

Here's how it fits:

I'm working on a script to hide the additional fields, and then I'll mecher with styles, but the result has pleased me.




2013/12/18 Anand Doshi <an…@erpnext.com>

Hi Max,

When a form is loaded, all table type doctypes, which are the children of the main form, are also loaded.

Since your fieldtype is totally new and contains a child doctype, you might need to modify this code.

But, I suggest that you go with the table type field and restrict it to just 1 row using custom script–much easier to maintain in the long run.

Thanks,
Anand.




On Wed, Dec 18, 2013 at 12:49 AM, Maxwell Morais <ma...@gmail.com> wrote:
Anand,


Uncaught TypeError: Cannot read property 'istable' of undefined

  1. all-app.min.js:1803
    1. _f.Frm.setup_metaall-app.min.js:1803
    2. wn.ui.form.ControlForm.wn.ui.form.Control.extend.makeall-app.min.js:2173
    3. prototype.(anonymous function)all-app.min.js:149
    4. wn.ui.form.Control.Class.extend.initall-app.min.js:2087
    5. wn.ui.form.make_controlall-app.min.js:2085
    6. wn.ui.form.Layout.Class.extend.make_fieldall-app.min.js:633
    7. (anonymous function)all-app.min.js:629
    8. b.extend.eachjquery.min.js:2
    9. wn.ui.form.Layout.Class.extend.renderall-app.min.js:629
    10. wn.ui.form.Layout.Class.extend.makeall-app.min.js:626
    11. _f.Frm.setup_std_layoutall-app.min.js:1794
    12. _f.Frm.refreshall-app.min.js:1813
    13. wn.views.FormFactory.wn.views.Factory.extend.loadall-app.min.js:1280
    14. (anonymous function)all-app.min.js:1280
    15. $.extend.with_docall-app.min.js:701
    16. wn.views.FormFactory.wn.views.Factory.extend.show_docall-app.min.js:1278
    17. (anonymous function)all-app.min.js:1277
    18. $.extend.with_doctypeall-app.min.js:696
    19. wn.views.FormFactory.wn.views.Factory.extend.makeall-app.min.js:1277
    20. wn.views.Factory.Class.extend.showall-app.min.js:1082
    21. (anonymous function)all-app.min.js:356
    22. b.event.dispatchjquery.min.js:2


But I understand that this happens because the doctype does not exist in locals

However, I thought that modify webnotes.model.meta , whatever sufiente to enable loading of the fields automatically, but realized that there's something missing!



2013/12/17 Maxwell Morais <ma...@gmail.com>
Anand, when you says:



Have you instead, tried to use a table field and restrict the number of rows to just 1. You won't need to create a whole new sub-form widget!



Are you referring to a custom script to handle this?
Thanks,
Anand.


On Tue, Dec 17, 2013 at 8:19 PM, Maxwell Morais <ma...@gmail.com> wrote:

Hello, All!

I’m trying to create a new widget called Form for my instance of ERPNext, the functionality of it is the same as Table, with the exception that it points only to a single child (would be a one-to-one).

I have already created the code of the widget, and changes in DocField, and webnotes.model.meta.get_link_fields and webnotes.model.meta.get_table_fields

But when I try to fetch the fields in the browser using wn.meta.get_docfields ('Address'), the response I have is none, exists somewhere to r, for this to work?

My idea is to have something like shown below

Imagem inline 1

--

Maxwell Morais
Tecnologia da Informação



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.

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




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.

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




--

Maxwell Morais
Tecnologia da Informação




--

Maxwell Morais
Tecnologia da Informação



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.

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




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.

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




--

Maxwell Morais
Tecnologia da Informação
+55 11 3931-1412 Ramal 31

www.realizemodulados.com.br



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.

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




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.

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