[Frappe] - Param on routes

Hi, guys!

I’m developing a simple registration of persons, to show some differences between Django, web2py and Frappe for some friends, and I have is the following:

Doctype Person: He represents:

  • A generic person or
  • An individual or
  • A company or
  • A supplier or
  • A credit provider or
  • An Employee or
  • A goods carrier

Each variation is a form loaded in a Section Break, what I would do is:

Add a parameter called “ViewMode” in the url eg:
https://localhost.com/app.html#Form/Person/New Person 1?viewmode=Customer

And starting this parameter which manage the Section Breaks should be visible.

I just do not know how to manage URLs with frappe, someone could give me a help?

--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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/CABK1YkOegNPNVToqVtJVKHBAc3OnXJ91hWWShnoohFgbSbkmcQ%40mail.gmail.com.

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

Instead of making separate views, you can use depends_on to hide/unhide fields based on a field's value, like Person Type.


Suppose you want to pass a default value to the person type field, so that when the user navigates to the Person form, appropriate fields are shown, you can use wn.route_options/frappe.route_options dictionary to pass the value from one route to another.


So, if you are in a list of Person's of type Supplier and you click on new, the person type will be automatically filled in the new form.

Or, if you want to create an entirely new custom view which does not use the framework's form builder, you can have a look at: https://github.com/frappe/erpnext/blob/develop/erpnext/public/js/transaction.js#L99


Thanks,
Anand.


On Tue, Mar 11, 2014 at 9:32 AM, Maxwell Morais <ma...@gmail.com> wrote:

Hi, guys!

I’m developing a simple registration of persons, to show some differences between Django, web2py and Frappe for some friends, and I have is the following:

Doctype Person: He represents:

  • A generic person or
  • An individual or
  • A company or
  • A supplier or
  • A credit provider or
  • An Employee or
  • A goods carrier

Each variation is a form loaded in a Section Break, what I would do is:

Add a parameter called “ViewMode” in the url eg:
https://localhost.com/app.html#Form/Person/New Person 1?viewmode=Customer

And starting this parameter which manage the Section Breaks should be visible.

I just do not know how to manage URLs with frappe, someone could give me a help?

--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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/CABK1YkOegNPNVToqVtJVKHBAc3OnXJ91hWWShnoohFgbSbkmcQ%40mail.gmail.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/CAAQzbF3X9%3DS%2BRizv%3DC4EfVhjRavrj3N7LmXf3DL3-3i1w5DNiA%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Also, to understand routing in frappe, start from here:
https://github.com/frappe/frappe/blob/develop/frappe/public/js/frappe/router.js#L95


Thanks,
Anand.


On Tue, Mar 11, 2014 at 11:20 AM, Anand Doshi <an…@erpnext.com> wrote:

Hi Max,

Instead of making separate views, you can use depends_on to hide/unhide fields based on a field's value, like Person Type.



Suppose you want to pass a default value to the person type field, so that when the user navigates to the Person form, appropriate fields are shown, you can use wn.route_options/frappe.route_options dictionary to pass the value from one route to another.


So, if you are in a list of Person's of type Supplier and you click on new, the person type will be automatically filled in the new form.

Or, if you want to create an entirely new custom view which does not use the framework's form builder, you can have a look at: https://github.com/frappe/erpnext/blob/develop/erpnext/public/js/transaction.js#L99


Thanks,
Anand.


On Tue, Mar 11, 2014 at 9:32 AM, Maxwell Morais <ma...@gmail.com> wrote:

Hi, guys!

I’m developing a simple registration of persons, to show some differences between Django, web2py and Frappe for some friends, and I have is the following:

Doctype Person: He represents:

  • A generic person or
  • An individual or
  • A company or
  • A supplier or
  • A credit provider or
  • An Employee or
  • A goods carrier

Each variation is a form loaded in a Section Break, what I would do is:

Add a parameter called “ViewMode” in the url eg:
https://localhost.com/app.html#Form/Person/New Person 1?viewmode=Customer

And starting this parameter which manage the Section Breaks should be visible.

I just do not know how to manage URLs with frappe, someone could give me a help?

--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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/CABK1YkOegNPNVToqVtJVKHBAc3OnXJ91hWWShnoohFgbSbkmcQ%40mail.gmail.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/CAAQzbF2BzLT%2Bkt7LHBcwM3oqEeBAe0r-P5p5Xyyouq5H2JP%2BWg%40mail.gmail.com.

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

Hi, Anand!

I understand your perspective and I will use this, but, the Form (“widget”) is for me like a table, with one difference, tables represents One to Many relations, a form represents a One to One and Links represents a Many to One relation.

In my case I’m have these motivations to use a Form:

  • All person requires one or more addresses - the address showed in Person View is the primary address

  • A Individual person does not contains the same details that a Company

All persons are distincts with few details:

  • Bank:

    • Branch
    • Account
  • Company:

    • Fancy Name
    • CNPJ - Register of Legal Entities
  • Individual

    • RG - State Register of Persons
    • CPF - National Register of Persons
    • Birth Date
      …..

The idea is to partition the tables according to each segmentation of people.
This makes them slightly larger pieces, but improves standardization Database.

  • A Bank


2014-03-11 2:50 GMT-03:00 Anand Doshi <an...@erpnext.com>:
Hi Max,

Instead of making separate views, you can use depends_on to hide/unhide fields based on a field's value, like Person Type.


Suppose you want to pass a default value to the person type field, so that when the user navigates to the Person form, appropriate fields are shown, you can use wn.route_options/frappe.route_options dictionary to pass the value from one route to another.


So, if you are in a list of Person's of type Supplier and you click on new, the person type will be automatically filled in the new form.

Or, if you want to create an entirely new custom view which does not use the framework's form builder, you can have a look at: https://github.com/frappe/erpnext/blob/develop/erpnext/public/js/transaction.js#L99


Thanks,
Anand.


On Tue, Mar 11, 2014 at 9:32 AM, Maxwell Morais <ma...@gmail.com> wrote:

Hi, guys!

I’m developing a simple registration of persons, to show some differences between Django, web2py and Frappe for some friends, and I have is the following:

Doctype Person: He represents:

  • A generic person or
  • An individual or
  • A company or
  • A supplier or
  • A credit provider or
  • An Employee or
  • A goods carrier

Each variation is a form loaded in a Section Break, what I would do is:

Add a parameter called “ViewMode” in the url eg:
https://localhost.com/app.html#Form/Person/New Person 1?viewmode=Customer

And starting this parameter which manage the Section Breaks should be visible.

I just do not know how to manage URLs with frappe, someone could give me a help?

--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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/CABK1YkOegNPNVToqVtJVKHBAc3OnXJ91hWWShnoohFgbSbkmcQ%40mail.gmail.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/CAAQzbF3X9%3DS%2BRizv%3DC4EfVhjRavrj3N7LmXf3DL3-3i1w5DNiA%40mail.gmail.com.

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




--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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/CABK1YkOo-tr-u3us6gpEpgb3Q%3DFTaNjv9jDQSCT9dWPtqQBmJQ%40mail.gmail.com.

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